
Hi Carlo, how you can read in: http://www.boost.org/doc/libs/1_46_1/libs/graph/doc/adjacency_list.html the "boost::vertex" free function returns a vertex_descriptor, not a vertex_iterator. Try with this: graph_traits<Graph>::vertex_descriptor vd; vd = vertex(i,g); You should obtain a vertex_descriptor of the requested vertex. If you need a vertex_iterator, you can try with this: graph_traits<Graph>::vertex_iterator it, end; for (boost::tie( it, end ) = vertices(g); it != end; ++it) if ( i == *it ) break; Now "it" points to the requested vertex. I don't know a smart method to retrieve it. Hope this helps. Best regards, Cosimo Calabrese. Il 04/05/2011 13.07, Carlo jardinier ha scritto:
I try to use the adjacency list from boost. I can fill the list with vertices and edges, but somehow I cannot access a specific vertex or edge.
For example this is not working (see test.cpp): ** struct EdgeProperties { bool bConnectedBond; EdgeProperties(){bConnectedBond=false;} }; struct VertexProperties{ int index; int spin; bool bOnCluster; VertexProperties(): spin(){ bOnCluster = false;} ~VertexProperties(){ } }; typedef adjacency_list< vecS, vecS, bidirectionalS, VertexProperties, EdgeProperties> Graph; typedef graph_traits< Graph>::vertex_iterator Vit;
Graph g(9); unsigned int i = 3; Vit vi; vi = vertex(i,g); **
I want vi to bi an iterator that points on the 3. vertex of the graph g. I attached the error message from g++ when compiling.
Can anyone help?
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users