Re: [Boost-users] Graph: writing graph properties to graphml file

On Thu, 15 Mar 2012, Juerg Tschirren wrote:
I still have a problem getting graph properties written to a graphml
file (vertex and edge properties get written just fine). Following Jeremiah's advise form two weeks
ago I implemented the code below. The problem appears to be that the instance of ref_property_map contained in the dynamic_properties uses the key type Graph*, but the write_graphml function implemented in boost/graph/graphml.hpp expects it to be of type Graph. This of course results in a different typeid and
does not recognize the entry in the dynamic properties as graph
Thanks Jeremiah for the prompt answer. Sorry, I forgot to mention, your suggested change to graphml.hpp was the first thing I tried yesterday. Everything compiles with your suggested change, but the result is a runtime error (boost::any_cast exception). As far as I can tell the problem origins in line 292 in graphml.hpp. But so far I wasn't able to wrap my mind around that dynamic_property_map and I couldn't quite figure out yet what is going on and what is supposed to be going on. Juerg On Thu, 15 Mar 2012, Jeremiah Willcock wrote: the write_graphml function properties. I tried to change the key type of ref_property_map to Graph, which resulted in a compilation
error. Any insight in how to solve that problem would be greatly appreciated! I think (looking at the reading code in libs/graph/example/graphviz.cpp) that it should be Graph* in write_graphml; try changing that (on lines 265, 276, and 290 of boost/graph/graphml.hpp in the trunk) and see if it works. -- Jeremiah Willcock

On Thu, 15 Mar 2012, Juerg Tschirren wrote:
Thanks Jeremiah for the prompt answer. Sorry, I forgot to mention, your suggested change to graphml.hpp was the first thing I tried yesterday. Everything compiles with your suggested change, but the result is a runtime error (boost::any_cast exception). As far as I can tell the problem origins in line 292 in graphml.hpp. But so far I wasn't able to wrap my mind around that dynamic_property_map and I couldn't quite figure out yet what is going on and what is supposed to be going on.
Please try the version of graphml.hpp that is in the trunk now using Graph* as your key type. -- Jeremiah Willcock
participants (2)
-
Jeremiah Willcock
-
Juerg Tschirren