Boost logo

Boost Users :

Subject: Re: [Boost-users] [BGL] Color Maps
From: Andrew Sutton (andrew.n.sutton_at_[hidden])
Date: 2010-01-29 08:50:40


> Is there any way to easily instantiate a Color Map? I'd post my code, but I
> have 6 or 7 versions none of which work. Any help will be much appreciated.
> Thanks ahead!
>

 Yes. First, I would recommend using the named parameter version of the call
since it lets you omit optional parameters. If you really want to pass an
exterior color map, you could do it this like this.

// Set up an external property, initialized to white
// by default.
vector<default_color_type> colors(num_vertices(g), white_color);

// Call the DFS algorithm
// I forget the actual syntax of the call, but it should be similar to this.
depth_first_search(g,
    visitor(vis)
    .start_vertex(v)
    .color_map(colors(&colors[0]));

Hope that helps,

Andrew Sutton
andrew.n.sutton_at_[hidden]



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