
Jeff Holle wrote:
I would like to write a "generic" routine that prints the named vertex and edges properties.
Eeh... you must mean (name,value) pairs from graphvis graph?
I can see in this code sibit (from graphviz.cpp) that the info that I want is present:
vertex_label(const Vertex& u, const GraphvizDigraph& g) { boost::property_map<GraphvizDigraph, boost::vertex_attribute_t>::const_type va = boost::get(boost::vertex_attribute, g); return (*(va[u].find("label"))).second; }
It appears that va is a map<Vertex, map<string, "property value"> >
Yep.
How would I write code that prints the names of the properites of a given vertex? (It would involve iterating over the map whose find method is used in the above code segment).
In the code above, "va[u]" has the type std::map<std::string, std::string>. You can just iterate over all elements of that map, printing keys: boost::property_map<GraphvizDigraph, boost::vertex_attribute_t>::const_type va = boost::get(boost::vertex_attribute, g); const map<string, string>& m = va[u]; for (const map<string, string>::const_iterator i = m.begin(); i != m.end(); ++i) std::cout << i->first << "\n"; Is it what you're after? - Volodya