Boost logo

Boost Users :

Subject: Re: [Boost-users] Regarding property maps
From: alex (alexhighviz_at_[hidden])
Date: 2015-09-22 08:14:40


>Rohith Reddy wrote:
> I have been working on a graph using boost graph library with edge
>properties as bundled properties.I have the following struct as my edge
>property,
>
>typedef struct Edge{
>int id;
>int source;
>int target;
>float cost;
>float reverse_cost;
>} Edge;
>
> Provided that I am inserting the data correctly,how do I get a property map
>for each of the elements of the struct,that is a property map for id,a property
>map for the source and so on.And moreover I also want to know how to extract
>the type of property map,as it is required to pass its type to other function as a
>template parameter.
>
>Thanks in advance.

I had the same problem and developed a member_property_map to access the member of a bundled map.

It allows the following:

  typedef boost::vector_property_map<edge> bundle_map_type;
  typedef blink::member_property_map<bundle_map_type, float> cost_map_type;

  bundle_map_type bundle_map;
  cost_map_type cost_map(bundle_map, &edge::cost);

See attached for the implementation and example.





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