Boost logo

Boost Users :

From: Stephan Diederich (stephan.diederich_at_[hidden])
Date: 2006-10-23 03:00:34


2006/10/20, Leandro Melo <ltcmelo_at_[hidden]>:
> Hi, I'd like to make about whether this is the correct way to retrieve
> a vertex (or edge) property from graph. In this case, the vertex is
> property is my_v_prop and the edge property is my_e_prop.
> //...
> typedef adjacency_list<vecS, vecS, directedS, my_v_prop, my_e_prop> Graph;
>
> //....
>
> std::pair<VI, VI> vi = vertices(g); //VI are vertices iterators.
> for (; !(vi.first == vi.second); ++vi.first)
> {
> vertex_descriptor v = *vi.first;
> //Now, I want to retrieve the property of v.
> my_v_prop data = g[v];
> }
>
> Is it the the best/fastest/easiest way to retrieve the property?

For general access to the properties I'd say yes.
If you are using only one property (of your bundle) at a time, you
could extract a property-map first. You might want to look at
http://tinyurl.com/ynd6f6 "Properties maps from bundled properties".

HTH,
Stephan


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