
Thanks for your answer, now after adding this associative property map, should I care about any problem with the vertex/edge iterator stability or invalidation (like it is the case for vecS) if I use the method described here http://www.cs.brown.edu/~jwicks/boost/libs/graph/doc/adjacency_list.html(usi... next etc) ? 2011/11/2 Jeremiah Willcock <jewillco@osl.iu.edu>
On Wed, 2 Nov 2011, ShNaYkHs ShNaYkHs wrote:
Hello,
Since my graph use setS as a VertexList, I have to either provide a vertex_index property map for my graph to be able to use some functions requiring a vertex_index (e.g. write_graphviz). My graph is defined as: typedef adjacency_list<setS, setS, undirectedS, NodeData, EdgeData> Graph; Where NodeData and EdgeData are structures. Can you please give me a very simple example of how to provide a vertex_index property map for my graph ? I mean, since an adjacency_list that uses listS or setS as the vertex container does not automatically provide this vertex_id property, how can I add it to the code bellow ?
I tried to use an associative_property_map to include index for vertices, but it doesn't work (errors):
If you are going to use an associative_property_map, the key type of the map needs to be your graph's vertex_descriptor type, not vecS (which probably doesn't have any data members and is just a tag). You can then pass that property map to algorithms. Alternatively, as stated in the other reply to your post, you can add a vertex index member (with whatever name) into your NodeData structure and use that as the property map (e.g., using syntax such as "get(&NodeData::index, g)").
-- Jeremiah Willcock
______________________________**_________________ Unsubscribe & other changes: http://lists.boost.org/** mailman/listinfo.cgi/boost<http://lists.boost.org/mailman/listinfo.cgi/boost>