|
Boost Users : |
From: Christian Sturz (linuxkaffee_at_[hidden])
Date: 2008-02-26 09:14:47
Hi,
I've an urgent question on a BGL algorithm.
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/example/dfs-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"?
Any help is appreciated.
Thank you.
Christian
-- Psst! Geheimtipp: Online Games kostenlos spielen bei den GMX Free Games! http://games.entertainment.web.de/de/entertainment/games/free
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