473,763 Members | 4,584 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ColorMap for Boost Graph Library "depth_first_se arch"

Hi,

I want to use the depth_first_sea rch 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_siz e_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_arr ay) / sizeof(E), N);

// Typedefs
typedef boost::graph_tr aits < graph_t >::vertex_descr iptor Vertex;
typedef size_type* Iiter;

// discover time and finish time properties
std::vector < size_type dtime(num_verti ces(g));
std::vector < size_type ftime(num_verti ces(g));
size_type t = 0;
dfs_time_visito r < 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_sea rch(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_se arch(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 2131

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

Similar topics

2
2528
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 files only. Although implementing one is easy, I would like to have one that has already been tested... Thanks,
0
1545
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 vertex, and creating an edge to this new vertex from every incident vertex of any of the end-points (and then deleting the end points and every incident edge). The problem with this approach is that edge properties are not maintained. The newly added...
3
7832
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 one extra property for the vertex (the region label): typedef boost::adjacency_list< boost::listS, // Adjacency list boost::listS, // Vertex list boost::undirectedS, // Undirected graph unsigned int, // Vertex property...
1
1483
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 iterating over the existing ones. This essentially prevents, among other things, storing vertices as keys in a dictionary since the hashes of the stored and the new vertex differ although they
3
1780
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 boost.spirit but at above a establishment I do not know! Thanks in advice.
4
2557
by: Man4ish | last post by:
namespace ve/////////////////ve.h { struct VertexProperties { std::size_t index; boost::default_color_type color; }; } /////////////////////////////////////////////////////////////////////////////////////////////////// namespace ed///////////////////////ed.h
2
2315
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 <boost/graph/adjacency_list.hpp> #include <boost/tuple/tuple.hpp> #include <set> using namespace std;
4
3373
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 System. This pool should get destructed only when application terminates. So memory usage of my application will remian constant. For this purpose, I am planning to use Boost Pool Library. Can anybody help me in using Boost library. Is Boost right...
1
3167
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> #include <boost/graph/depth_first_search.hpp> #include <fstream> #include <utility> #include <boost/graph/breadth_first_search.hpp> #include <algorithm>
0
9563
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9386
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
9937
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9822
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8821
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7366
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6642
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5405
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
3522
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.