Boost logo

Boost Users :

Subject: Re: [Boost-users] [graph] Compilation problem using depth_first_visit with a listS as a VertexListS
From: alex (alexhighviz_at_[hidden])
Date: 2013-12-05 04:39:30


> From that I isolated the following code which compiles without any
problem:
>
> typedef adjacency_list < vecS, vecS,
bidirectionalS,GraphvizVertexProperty,GraphvizEdgeProperty,
GraphvizGraphProperty > Graph;
>
...
> depth_first_visit(_graph2, loop_head, default_dfs_visitor(),
make_iterator_property_map(reachable_from_head.begin(),get(vertex_index,
_graph2), c));
> So this works fine!

> Then, I would like to change the type of graph, so more precisely, to use
a std::list (or listS) instead of a std..vector (vecS) for the VertexListS
> So the first line declaration becomes:

> typedef adjacency_list < vecS, listS,
bidirectionalS,GraphvizVertexProperty,GraphvizEdgeProperty,
GraphvizGraphProperty > Graph;
> //only the 2nd argument changes
> But then when I compile the code, I get 1 error during the compilation as
described hereafter.

"If the VertexList of the graph is vecS, then the graph has a builtin vertex
indices accessed via the property map for the vertex_index_t property."
(http://www.boost.org/doc/libs/1_55_0/libs/graph/doc/adjacency_list.html)

So when you use listS instead you have to supply your own vertex index map.


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net