
On Apr 5, 2010, at 2:59 PM, Marcus Fontaine wrote:
The following code demonstrates the problem; the adjacent vertices to 4 in subG should be 2 and 3. However, I get 5 when I run the program.
I believe the problem has something to do with the way you are adding vertices to the subgraph. Try printing out the vertices of the subgraph: typedef graph_traits<Graph>::vertex_descriptor Vertex; typedef graph_traits<Graph>::vertex_iterator VertexIterator; std::pair<VertexIterator, VertexIterator> vp; for (vp = vertices(subG); vp.first != vp.second; ++vp.first) { Vertex vertex = *vp.first; cout << "vertex: " << vertex << endl; } And you will get: vertex: 0 vertex: 1 vertex: 2 vertex: 3 vertex: 4 vertex: 5 This is probably not what you were expecting. Trevor