Boost logo

Boost Users :

Subject: Re: [Boost-users] Boost graph write_graphml
From: Jeremiah Willcock (jewillco_at_[hidden])
Date: 2010-04-23 12:56:01


On Fri, 23 Apr 2010, Theodore McCormack wrote:

> I am having troubles figuring out how to use write_graphml from the
> documentation. My problem is in creating the dynamic_property. To access
> my vertex properties i use this: 
>
> VERTEXPROPERTIES& properties(const Vertex& v)
> {
> typename property_map<GraphContainer, vertex_properties_t>::type param = get(vertex_properties, graph);
> return param[v];
> }
> where VERTEXPROPERTIES is a type of a structure that i use for vertex properties.
>
> how would i go about creating a dynamic_property from that property map?

dynamic_properties dp;
dp.property("properties", param);

A more complete example is at
<URL:http://www.boost.org/doc/libs/1_42_0/libs/graph/doc/write_graphml.html>.
Note that if you would like separate names for the different properties
you will need to define separate property names and add an entry to dp for
each; property maps can be created using a function call on an existing
property map, though, so you would not need to rearrange your graph data
structures. Are you using bundled properties by any chance? Or do you
really have a single struct that has all of your properties but is not
used as a bundle?

-- Jeremiah Willcock


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