Boost logo

Boost Users :

From: Douglas Gregor (doug.gregor_at_[hidden])
Date: 2005-02-18 23:06:08


On Feb 15, 2005, at 5:24 PM, gast128 wrote:
> Sometimes this boost::graph stuff even suprises me from time to time.
> For
> example feeding a depth_search with a graph and vecS type vertex
> storage will
> work if the color map is not specified. However changing this to
> listS, and
> one gets a crash.

With listS, you'll need to create and maintain a mapping from vertices
to index values, e.g., add a property<vertex_index_t, std::size_t> to
the vertex properties, and be sure to set these properties to numbers
in the range [0, num_vertices(g)). For instance, with graph g of type
Graph:

graph_traits<Graph>::vertex_iterator vi, vi_end;
std::size_t i = 0;
for(tie(vi, vi_end) = vertices(g); vi != vi_end; ++vi, ++i)
   put(vertex_index, g, *vi, i);

        Doug


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