|
Boost Users : |
From: David Abrahams (dave_at_[hidden])
Date: 2008-06-23 14:14:31
Tim Blechmann wrote:
> hi all,
>
> the following trivial code doesn't compile for me:
>
> #include <boost/graph/adjacency_list.hpp>
> #include <boost/graph/depth_first_search.hpp>
>
> typedef boost::adjacency_list<boost::vecS,
> boost::listS
> > graph_t;
> int main()
> {
> graph_t graph;
> boost::depth_first_search(graph, boost::visitor(boost::dfs_visitor<> ()));
> }
>
> is there any way to run a depth_first_search, with an adjacency_list
> based graph class, using a VertexList=listS or setS?
Tim,
See the documentation for the vertex_index_map parameter at
http://www.boost.org/doc/libs/1_35_0/libs/graph/doc/depth_first_search.html:
This maps each vertex to an integer in the range [0,
num_vertices(g)). This parameter is only necessary when the default
color property map is used. The type VertexIndexMap must be a model of
Readable Property Map. The value type of the map must be an integer
type. The vertex descriptor type of the graph needs to be usable as the
key type of the map.
Default: get(vertex_index, g). Note: if you use this default, make
sure your graph has an internal vertex_index property. For example,
adjacenty_list with VertexList=listS does not have an internal
vertex_index property.
HTH,
-- Dave Abrahams BoostPro Computing http://www.boostpro.com
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