|
Boost Users : |
From: Stephan Diederich (stephan.diederich_at_[hidden])
Date: 2006-11-09 05:28:19
Hi Thom,
2006/11/8, Thom DeCarlo <t.r.decarlo_at_[hidden]>:
> I have a couple of n00b questions. I have constructed a BGL graph that uses
> the edge_name_t property to road names. I want to change the weights of some
> of the roads based on input from the user. Is there a way to set up an
> iterator to step through edges that have names which match elements of a
> set? (e.g., "A,B,B1,L,M")
>
> In a related question, I need to extract a vertex whose vertex_index_t value
> matches a specific value. The vertices were not entered in any specific
> order, so the "vertex(1, g)" function returns the first vertex to have been
> entered into the graph, but not necessarily the one whose index value is
> "1".
If I don't get you wrong, there's no direct way in the BGL to do that.
The properties you attach to a vertex or an edge are normally accessed
through the edge or vertex descriptor respectively.
What you want to do is the other way around. Get from a property to
the edge desciptor(s) that match that property or in the case of
vertex_index to the vertex descriptor.
Maybe you can use Bimap (http://tinyurl.com/y95qng), where you can get
keys (edge/vertex-descriptors) from values together with the concept
of exterior property maps (http://tinyurl.com/yhju58) and Constructing
an Exterior Property Map.
Reading further in the Bimap docs, I think I found what you want:
http://tinyurl.com/yxzpme
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