In nutshell: how can I check whether a property map has some given

key?

The exact problem is as follows. I have graph edges with the property

"lambdas" of positive integers, but its the exact meaning is not

important here. With the read_graphviz function I am loading graph

files which look like this:

graph {

a;

b;

c;

c -- a [distance="100"];

a -- b [lambdas="8"];

}

After I load the file I want to examine which edges have the "lambdas"

property, but I don't know how to do this. If I request the property

value with the "get" function, I get some random value. My program is

at the bottom of this email.

The program prints the edge and the value of the "lambdas" property.

I get this:

(2,0): 33489268

(0,1): 8

The first line is bad: the edge (2,0), i.e. c -- a in my graphviz

file, has the reported value of 33489268. The second line is OK.

Thanks for reading.

Best,

Irek

*********************************************************************

#include <boost/graph/adjacency_list.hpp>

#include <boost/graph/depth_first_search.hpp>

#include <boost/graph/iteration_macros.hpp>

#include <boost/graph/graphviz.hpp>

using namespace boost;

typedef boost::adjacency_list<vecS, vecS, undirectedS,

property<vertex_name_t, std::string>,

property<edge_weight_t, double,

property<edge_weight2_t, int> >,

no_property > Graph;

int

main()

{

Graph g;

dynamic_properties dp;

dp.property("node_id", get(vertex_name, g));

dp.property("distance", get(edge_weight, g));

dp.property("lambdas", get(edge_weight2, g));

read_graphviz(std::cin, g, dp);

typedef boost::property_map<Graph, edge_weight2_t>::type lambdas_t;

lambdas_t weight2_map = get(edge_weight2, g);

BGL_FORALL_EDGES(e, g, Graph)

// Before printing this out I would like to make sure that an edge

// has this property.

std::cout << e << ": " << get(weight2_map, e) << std::endl;

}

_______________________________________________

Boost-users mailing list

[hidden email]
http://lists.boost.org/mailman/listinfo.cgi/boost-users