|
Boost Users : |
Subject: Re: [Boost-users] BGL and property maps
From: Andrew Sutton (andrew.n.sutton_at_[hidden])
Date: 2009-10-18 11:07:09
> In the Boost Graph Library, I need to map between two separate graphs where
> the IDs for the nodes are identical. I am unsure how to do this. It seems
> the property maps only allow mapping from vertex and edge descriptors to
> properties. How do we invert this? That is, how can we map from properties
> to vertex descriptors? If I have a vertex descriptor in one graph, I can map
> it to the vertex name-property, but then I want to map the vertex-name
> property to a vertex descriptor for the other graph. Please help.
>
Your best bet is to simply declare an map or unordered_map and pass that
around with your graph. You could abstract that as a property map if you
wanted to make it gel with the BGL abstractions.
There are two undocumented features in the BGL for doing similar things, but
I'd say they aren't fully supported. The name_graph extension of the
adjacency_list can be used to internalize the mapping of names to vertices,
and the labeled_graph adaptor essentially wraps a graph and a map as
described above. Like I said, though... not fully supported.
Andrew Sutton
andrew.n.sutton_at_[hidden]
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