[BGL] Correct way to retrieve properties
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
2006/10/20, Leandro Melo
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
Graph; //....
std::pair
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
participants (2)
-
Leandro Melo
-
Stephan Diederich