Boost logo

Boost Users :

Subject: Re: [Boost-users] Custom Edge Properties (boost-graph) - struct
From: Jeremiah Willcock (jewillco_at_[hidden])
Date: 2010-03-15 10:21:36


On Sun, 14 Mar 2010, Kya Bey wrote:

> Hi All , 
> I've been trying to use a custom structure for describing the various edge properties of a graph. I'm defining a graph as the following
>
> struct edge_properties {
>     int         capacity ; 
>     double      weight ;
>     typedef struct edge_properties_tag kind ;  // NOT SURE what this does ? 
> };
>
> typedef boost::adjacency_list<listS, vecS, bidirectionalS,
>                               property<vertex_name_t, std::string>,
>                               edge_properties > Graph;
>
>
> This allows me to create a Graph instance g. I've been trying to retrieve the edge properties via a get call, but have not been able to
> do so. 

It appears that you are trying to use bundled properties. There is
information on using them at
<URL:http://www.boost.org/doc/libs/1_42_0/libs/graph/doc/bundles.html>.
You do not need the kind in your structure in that case.

> I've tried various variants but seems to me i'm missing something fundamental in the way boost-graph keeps the edge_properties hidden. 
> Any pointers will be useful. 

The syntax you want is get(&edge_properties::capacity, g) to get the
capacity, and something similar for the weight.

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