[graph] Building a graph from file
Dear all, I am a new boost::graph user, and I have a pb that should be very common, but I do not find any simple way to do it. I have a graph, with, in a file, some vertex name, and, in another file, edge described from vertex name, something like -- nodes.txt -- AAA BBB CCC -- edges.txt -- AAA BBB xx AAA CCC yy CCC AAA zz With the book, it is quite easy to set the vertex names in the graph (with an internal property and the name_map). What seems not easy to me is how to add the edges ? I add to find a way to get a vertex from its name, and the map only do the opposite. Did I have to build a tempory reverse map ? Best regards, Marc Boyer
On Mar 15, 2007, at 12:59 PM, Marc Boyer wrote:
What seems not easy to me is how to add the edges ? I add to find a way to get a vertex from its name, and the map only do the opposite.
Did I have to build a tempory reverse map ?
Yes, you will need to build a temporary map to map from the names of the vertices to their vertex descriptors. Cheers, Doug
Le 16-03-2007, Douglas Gregor
On Mar 15, 2007, at 12:59 PM, Marc Boyer wrote:
What seems not easy to me is how to add the edges ? I add to find a way to get a vertex from its name, and the map only do the opposite.
Did I have to build a tempory reverse map ?
Yes, you will need to build a temporary map to map from the names of the vertices to their vertex descriptors.
Thank you. That was the solution I adopted, but I was wondering if I was using the right tool. Marc Boyer
participants (3)
-
Douglas Gregor
-
Marc Boyer
-
Marc Boyer