
On Wednesday, 9. February 2011 16:58:21 Soso F wrote:
please could someone tell me how can i read from file using BGL. the data in a file will be the graph component. I don,t want to use graphviz, any other way?
thanks
As Nicholas Mario Wardhana pointed out in the eMail you just answered to, this depends on the input file. You may have several different layouts possible so you should either provide an example-layout so that one might help you quick or, even better, write the parser on your own. Because after all that's also part of the work, I assume. An example layout might be: v1<tab>v2 v2<tab>v3 v1<tab>v2 which is not based on the layout imposed by graphviz. Your data may also originate from a table and might actually represent an adjacency matrix. However, no one can know this if you don't provide more and, especially, helpful information. You might want to use boost::split() to split up your lines and use std::getline() to read in a file line-by-line. Maybe there are more sophisticated solutions using Boost, like a tokenizer or such. Best, Cedric
________________________________ From: Nicholas Mario Wardhana
To: boost-users@lists.boost.org Sent: Tue, February 8, 2011 8:32:24 PM Subject: Re: [Boost-users] graph On 9 February 2011 05:22, Soso F
wrote: Hello,
I'm using BGL to build a graph which represents a network. I'm wondering if I can read a file to be the input " vertices , edges and weight" without using graphviz.
Thx
Hi,
I think your problem is independent from BGL. Once you can parse the file and get the data correctly, you can make them the attributes of your vertices, edges, and weights. You can simply use STL or any other library.
Best regards, Nicholas Mario Wardhana _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users