|
Boost Users : |
Subject: Re: [Boost-users] [Graph] Switching from depth_first_search to depth_first_visit
From: Jeremiah Willcock (jewillco_at_[hidden])
Date: 2011-03-17 15:39:07
On Thu, 17 Mar 2011, Marcus Riemer wrote:
>> A raw std::vector is not enough to use as a color map. If your graph has
>> a vertex index map (which is probably true), you can make a color map as:
>>
>> two_bit_color_map<property_map<Graph, vertex_index_t>::const_type>
>> color_map(num_vertices(graph), get(vertex_index, graph));
> One general question: Wouldn't the const_type be, umm, constant? And
> therefore the algorithm can't alter the colors? I guess I am wrong, because
> passing an constant single color map would not make much sense. Or am I
> overseeing something?
The map you are getting using const_type is the vertex index map, which is
read-only for many graph types simply because it is a function (often the
identity, but don't rely on that). From your error message, it looks like
you are missing the ::const_type when you try to get the vertex index map,
or it is after two_bit_color_map rather than property_map<Graph,
vertex_index_t>.
>> I believe that is automatically cleared; otherwise, see the code in
>> depth_first_search() that clears the color map (depth_first_visit() will
>> not do that for you).
> I will take a look, but I would hope that boost would not copy my local color
> map and reuse it.
It won't copy it (just a shallow copy), and depth_first_visit() won't
clear it for you, but I believe a two_bit_color_map constructed with just
an element count will be cleared by the constructor.
-- Jeremiah Willcock
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