469,643 Members | 2,064 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,643 developers. It's quick & easy.

ColorMap for Boost Graph Library "depth_first_search"

Hi,

I want to use the depth_first_search algorithm from the Boost
Graph Library. However, I've problems with the definition of
my own ColorMap. To illustrate this, here is an example
(taken from http://www.boost.org/libs/graph/exam...-example.cpp):

int
main()
{
// Select the graph type we wish to use
typedef adjacency_list < vecS, vecS, directedS graph_t;
typedef graph_traits < graph_t >::vertices_size_type size_type;

// Set up the vertex names
enum
{ u, v, w, x, y, z, N };
char name[] = { 'u', 'v', 'w', 'x', 'y', 'z' };

// Specify the edges in the graph
typedef std::pair < int, int >E;
E edge_array[] = { E(u, v), E(u, x), E(x, v), E(y, x),
E(v, y), E(w, y), E(w, z), E(z, z) };

graph_t g(edge_array, edge_array + sizeof(edge_array) / sizeof(E), N);

// Typedefs
typedef boost::graph_traits < graph_t >::vertex_descriptor Vertex;
typedef size_type* Iiter;

// discover time and finish time properties
std::vector < size_type dtime(num_vertices(g));
std::vector < size_type ftime(num_vertices(g));
size_type t = 0;
dfs_time_visitor < size_type * >vis(&dtime[0], &ftime[0], t);

// Some arbitrary vertex as root (start point of DFS)
Vertex root = source( edge_array[2],g );

depth_first_search(g, visitor(vis), myColorMap, root );

return 0;
}

My problem is the definition of "myColorMap" which must be
a model of Read/Write Property Map. However, I have no idea
how to define a working ColorMap. It would be fully sufficient
to take the default color map which is used when DFS is invoked
with "depth_first_search(g, visitor(vis));"

Do you have an idea how I define a ColorMap that I can use
for "myColorMap"?

Thank you.

Regards,
Tim

Feb 26 '08 #1
0 1906

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by eyal.susser | last post: by
1 post views Thread by George Sakkis | last post: by
3 posts views Thread by =?ISO-8859-2?Q?Miros=B3aw?= Makowiecki | last post: by
4 posts views Thread by mavrik | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.