473,388 Members | 870 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,388 software developers and data experts.

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 2096

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: eyal.susser | last post by:
Hi, I'm using the Boost serialization library. Iwant to serialize classes into simple buffers on RAM. There doesn't seem to be a suitable archiver. Am I missing it? The ones I saw were for...
0
by: Ferdi Smit | last post by:
I wrote a generic algorithm for boost.graph to merge two vertices, ie. the end-points of an edge are joined together as if they are a single vertex. I'm currently doing this by creating a new...
3
by: Jef Driesen | last post by:
I'm trying to create a graph from an image, where pixel values are regions labels. I have defined my graph to use lists instead of the vectors (because I need to add/remove vertices and edges) and...
1
by: George Sakkis | last post by:
I've just started toying with the python bindings of BGL and I'm puzzled from the following: True False It seems that the vertices iterator creates new vertex objects every time instead of...
3
by: =?ISO-8859-2?Q?Miros=B3aw?= Makowiecki | last post by:
How do it's by next of boost.spirit library it are not discrimitation a letter size that a small letters and big letters it are not discrimitation? I'm know how write s small parser by next of...
4
by: Man4ish | last post by:
namespace ve/////////////////ve.h { struct VertexProperties { std::size_t index; boost::default_color_type color; }; }...
2
by: Man4ish | last post by:
I have created Graph object without vertex and edge property.It is working fine. #include <boost/config.hpp> #include <iostream> #include <vector> #include <string> #include...
4
by: mavrik | last post by:
Hi all, I've a requirement of creating a memory pool for all memory needed by my application, when my application starts. And I should take all memory from that pool without returning to the...
1
by: rboorgapally | last post by:
Hi everyone, I am trying to run BFS on a graph that is created with input from a file. I am facing problems with the output though the code is compiling: #include <boost/graph/adjacency_list.hpp>...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.