|
Boost Users : |
Subject: [Boost-users] Accessing exterior graph properties by name
From: David Doria (daviddoria_at_[hidden])
Date: 2012-01-26 13:01:16
Is there a way to "associate" an external property map to a name so
that it can be retrieved from the graph?
With a standard interior property, you can do:
// Declare that you will be able to identify a property map by "vertex_data"
namespace boost {
enum vertex_data_t { vertex_data };
BOOST_INSTALL_PROPERTY(vertex, data);
};
// Get the vertex_data property map from the graph
typedef boost::property_map<Graph, boost::vertex_data_t>::type PropertyMapType;
PropertyMapType propertyMap = get(boost::vertex_data, g);
However, with the exterior properties, I can associate the property
map with the nodes of the graph:
typedef boost::property_map<GraphType,
boost::vertex_index_t>::const_type indexMapType;
indexMapType indexMap(get(boost::vertex_index, graph));
boost::vector_property_map<float, indexMapType> myMap(100, indexMap);
but how would I then be able to, only having the graph object, get
this map? That is, there was never any name, like "vertex_data"
introduced in this case.
Thanks,
David
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