Hi Tom,
2006/9/19, Tom Lenaerts
Hi stephan, [snip]
I examined your code and adapted mine to yours and noticed that the error disappears when I change g=new Graph(); to g=new Graph(1); in the member function parseFile. It seems that this is the error that I made (as I expected it is a silly one). Could you tell me why the '1' is required here?
Quoting from ajacency-list docs:
adjacency_list(vertices_size_type n, const GraphProperty& p = GraphProperty()) Creates a graph object with n vertices and zero edges.
You've just missed to add vertices to the graph. The call Graph(1) creates an adjacency_list with one vertex (which was enough for my example). Maybe you want to create a graph with "numnodes", which you read from the beginning of your file. Additionally you may want to have a look at the add_edge(..) documentation, too. As it describes why your program worked with just one vertex added in the beginning. (The others were created through add_edge, if the first edge(...) call didn't fail, I think). Cheers, Stephan btw: check http://www.boost.org/libs/tokenizer/index.html