[BGL] dynamic_properties for graph attributes

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). Greetings, Paul Hilbert

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. I believe you can construct property maps over the GraphProperty parameter using: get_property(g) // Where g is your graph object. You should be able to insert that property map into a dynamic_properties object. Andrew Sutton andrew.n.sutton@gmail.com

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:
I believe you can construct property maps over the GraphProperty parameter using:
get_property(g) // Where g is your graph object.
You should be able to insert that property map into a dynamic_properties object.
Andrew Sutton andrew.n.sutton@gmail.com

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

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);
Sorry. I was a way off on that one. What I meant to write was:
get_property(g, p)
where property is a property tag like vertex_index or edge_weight. It uses
the same mechanism as get(g, p) for getting property maps over vertex or
edge properties. None of the graph classes or adapters support bundled graph
properties there's a ticket filed.
There's an example (sort of) of this in libs/graph/test/graphviz.cpp. The
graph is constructed (more or less) as:
typedef property
I definitely appreciate your help and am sorry for any offence my rambling may have produced (I'm just totally depressed trying to implement some- thing supposedly trivial for 3 days now and not being able to find ANY example for this in the docs).
Graph properties have never really been thoroughly evaluated (or documented). There just haven't been that many people that really seemed to use them. Unfortunately, when people were asking, there wasn't a lot of forward momentum on BGL development. Andrew Sutton andrew.n.sutton@gmail.com
participants (2)
-
Andrew Sutton
-
Paul Hilbert