On Thu, 26 Jan 2012, David Doria wrote:
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
::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
::const_type indexMapType; indexMapType indexMap(get(boost::vertex_index, graph)); boost::vector_property_map
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.
There isn't any way to do that as far as I know, since the graph type doesn't know about the property map that you create later. There are dynamic_properties objects that do property lookups by name for I/O, but those aren't quite the same as what you are asking about. I'm sure http://osl.iu.edu/~dgregor/bgl-python/ also has something like that for dynamically adding properties, but I do not know how it works. -- Jeremiah Willcock