Boost logo

Boost Users :

Subject: [Boost-users] [Boost Graph Library] read_graphviz example
From: Robert Johannes Langenberg (robert.langenberg_at_[hidden])
Date: 2014-01-07 09:34:33


Hello,

I've recently started using the boost graph library to read a graph in dot format generated with pygraphviz and run some analysis on it. I get the basic example

http://www.boost.org/doc/libs/1_55_0/libs/graph/doc/read_graphviz.html#example

to compile, but it then segfaults when reading the file because it can't find the property "colors" (stack trace below). Now I understand that I didn't define this property but I also have no idea how to do it. Debugging it, i find the name="colors", key=0 and value="red" for the function call below:

#11 0x000000010001b40c in boost::put<unsigned long, std::string> (name=@0x100205880, dp=@0x7fff5fbff5f8, key=@0x100204d78, value=@0x100205888) at dynamic_property_map.hpp:292
292 boost::shared_ptr<dynamic_property_map> new_map = dp.generate(name, key, value);

For a general understanding of what's happening: What is "key" good for? In the example, where is the variable vertex_color declared? What is this "mass" property and why does it contain vertex_color? What is the type vertex_color_t? The documentation didn't help me, maybe there are easier starting points or i've just looked in the wrong parts of

http://www.boost.org/doc/libs/1_55_0/libs/graph/doc/table_of_contents.html

If someone could point me to a proper example/tutorial/documentation it'd be greatly appreciated.

Best regards,
Robert Langenberg

Stacktrace:

Program received signal SIGABRT, Aborted.
0x00007fff971e8d46 in __kill ()
(gdb) where
#0 0x00007fff971e8d46 in __kill ()
#1 0x00007fff8fa28f83 in abort ()
#2 0x00007fff8f35c9eb in abort_message ()
#3 0x00007fff8f35a39a in default_terminate ()
#4 0x00007fff8df32887 in _objc_terminate ()
#5 0x00007fff8f35a3c9 in safe_handler_caller ()
#6 0x00007fff8f35a424 in std::terminate ()
#7 0x00007fff8f35b58b in __cxa_throw ()
#8 0x0000000100016eae in boost::throw_exception<boost::exception_detail::error_info_injector<boost::property_not_found> > (e=@0x7fff5fbfedb8) at throw_exception.hpp:70
#9 0x0000000100016ff0 in boost::exception_detail::throw_exception_<boost::property_not_found> (x=@0x7fff5fbfee90, current_function=0x100061188 "boost::shared_ptr<boost::dynamic_property_map> boost::dynamic_properties::generate(const std::string&, const Key&, const Value&) [with Key = long unsigned int, Value = std::basic_string<char, std::cha"..., file=0x100061008 "/Users/rlangenb/workspace/boost_1_55_0/boost/property_map/dynamic_property_map.hpp", line=268) at throw_exception.hpp:87
#10 0x000000010001ae6e in boost::dynamic_properties::generate<unsigned long, std::string> (this=0x7fff5fbff5f8, name=@0x100205880, key=@0x100204d78, value=@0x100205888) at dynamic_property_map.hpp:268
#11 0x000000010001b40c in boost::put<unsigned long, std::string> (name=@0x100205880, dp=@0x7fff5fbff5f8, key=@0x100204d78, value=@0x100205888) at dynamic_property_map.hpp:292
#12 0x000000010000bf4a in boost::detail::graph::mutate_graph_impl<boost::adjacency_list<boost::vecS, boost::vecS, boost::directedS, boost::property<boost::vertex_name_t, std::string, boost::property<boost::vertex_color_t, float, boost::no_property> >, boost::property<boost::edge_weight_t, double, boost::no_property>, boost::property<boost::graph_name_t, std::string, boost::no_property>, boost::listS> >::set_node_property (this=0x7fff5fbff340, key=@0x100205880, node=@0x1002063d0, value=@0x100205888) at graphviz.hpp:775
#13 0x000000010001f006 in boost::read_graphviz_detail::translate_results_to_graph (r=@0x7fff5fbff140, mg=0x7fff5fbff340) at read_graphviz_new.cpp:770




Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net