Boost logo

Boost :

From: Douglas Gregor (doug.gregor_at_[hidden])
Date: 2005-07-09 22:52:40


On Jul 9, 2005, at 10:38 PM, David Abrahams wrote:
> Douglas Gregor <doug.gregor_at_[hidden]> writes:
>> color_map has a nontrivial default of:
>> vector_property_map<color_type, typeof(index_map)>
>>
>
> Say, that doesn't correspond to what I see at
> http://www.boost-consulting.com/boost/libs/graph/doc/
> depth_first_search.html
> and furthermore I think that last "nontrivial default" is a type, not
> a value. Can you clear this up? Did you mean a different algorithm?

I changed two things, to try to simplify the example:

1) I dropped the optional root_vertex parameter.

2) I changed the default for the color_map to something a little
simpler. The real color map will be built like this:

   typename graph_traits<Graph>::vertices_size_type n =
num_vertices(graph);
   std::vector<default_color_type> color_vec(n);
   iterator_property_map<typename
std::vector<default_color_type>::iterator, IndexMap>
     default_color_map(color_vec.begin(), index_map);

The really tough part is that color_vec needs to stick around, so it
can't be buried in a function object somewhere. An equivalent (but
slightly simpler) alternative is to use:

        typename graph_traits<Graph>::vertices_size_type n =
num_vertices(graph);
        vector_property_map<default_color_type, IndexMap>(n, index_map);

        Doug


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk