
Andrew Sutton wrote:
The adjacency_list class constructor takes a property type for graph attributes. However I could not figure out how to create the appropriate dynamic_property map for graph attributes and - not surprisingly - this subtle detail is left out in the "documentation".
Maybe someone can enlighten my path (and those of all people I found asking the same question without getting any responses).
Why is documentation in quotes? I haven't seen this question posted before. Maybe you can reference a previous instance.
For example here: http://www.nabble.com/-BGL--Graph-properties-and-dynamic-properties- tt3340645.html Googling intensively for things like "dynamic_property graph properties" guides you to more hits... Regarding the "documentation": Replacing the doc by <html><body>Browse the sources.</body></html> would have saved me a lot of time I suppose. I cannot find anything that allows me to search for definitions like e.g. the one for graph_properties. And everywhere in the documentation I stumble across terms like property (think * = wildcard) they are inside sentences like "see xyz for an example of how to create custom edge/vertex properties" or "A Property Tag is a type used to name or identify properties that are attached to the vertices and edges of a graph." Which makes me think the writers mainly forgot to think about graph attributes and guides me to the following question: Looking at graphml.hpp I find the following piece of code: // Output keys for (dynamic_properties::const_iterator i = dp.begin(); i != dp.end(); ++i) { std::string key_id = "key" + lexical_caststd::string(key_count++); if (i->second->key() == typeid(Graph)) vertex_key_ids[i->first] = key_id; else if (i->second->key() == typeid(vertex_descriptor)) vertex_key_ids[i->first] = key_id; else if (i->second->key() == typeid(edge_descriptor)) edge_key_ids[i->first] = key_id; else continue; ... } ... for (dynamic_properties::const_iterator i = dp.begin(); i != dp.end(); ++i){ if (i->second->key() == typeid(Graph)) { out << " first] << "\">" << i->second->get_string(g) << "</data>\n"; } } So the first snippet inserts all graph attributes into vertex_key_ids and the second one outputs graph_key_ids. Can there be anything output? Looks like totally untested code to me, but correct me on that.
I believe you can construct property maps over the GraphProperty parameter using:
get_property(g) // Where g is your graph object.
I (and g++) can't find a get_property which takes one argument.
The semantically closest I could find is
get_property(adjacency_list& g, GraphPropertyTag);
However this:
typedef boost::propertyboost::matching_count_t,int GProp;
typedef boost::adjacency_list<
boost::vecS, boost::vecS, boost::undirectedS,
NumberedNodeProperties, NumberedEdgeProperties, GProp > Graph;
Graph g(connections.begin(), connections.end(), m_NumberedNodes.size());
boost::graph_property