Boost logo

Boost Users :

Subject: Re: [Boost-users] newbie question on boost/graph library: how to use read_graphViz with bundled vertex/edge properties
From: Jeremiah Willcock (jewillco_at_[hidden])
Date: 2010-03-23 10:18:04


On Mon, 22 Mar 2010, Rong She wrote:

> I have declared CustomVertex and CustomEdge classes, each with a bunch of internal properties.
> class CustomVertex {
> int length;
> string name;
> bool ori;
> public:
> CustomVertex() {}
> ~CustomVertex() {}
> FlipVertex() { ori = !ori; }
> };
> class CustomEdge {
> char type;
> int distance;
> bool src_ori;
> bool dst_ori;
> public:
> CustomEdge() {}
> ~CustomEdge() {}
> };
>
> Tried to use bundled properties, the graph is defined as:
> typedef adjacency_list<vecS, vecS, directedS, CustomVertex, CustomEdge> myGraph;
>
> I want to read from a dot file (which contains all appropriate vertex,
> edge information) and populate the graph. I know I'm supposed to use
> dynamic_properties etc. Could someone show me how exactly? Thanks.

Please look at libs/graph/example/graphviz.cpp in your Boost source tree.
The important part you need to change is the top of main() where the id
and weight properties are registered. You should change those to your own
property maps and names. You should then be able to do a read_graphviz
call similar to the one in that example.

-- 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