|
Boost Users : |
Subject: Re: [Boost-users] read_graphviz with a simple graph
From: David Doria (daviddoria_at_[hidden])
Date: 2011-06-22 19:35:43
> I think you will need some kind of property to store the vertex names from
> Graphviz; you might be able to use null_property_map for that (from
> <boost/graph/property_maps/null_property_map.hpp>) though.
>
> -- Jeremiah Willcock
The following works, but it seems very confusing. I tried the two
commented lines separately but they don't compile. Is this the
recommended method?
typedef boost::property < boost::vertex_name_t, std::string> VertexProperty;
typedef boost::adjacency_list < boost::vecS, boost::vecS,
boost::directedS, VertexProperty> graph_t;
//typedef boost::adjacency_list < boost::vecS, boost::vecS,
boost::directedS, boost::no_property> graph_t;
//typedef boost::adjacency_list < boost::vecS, boost::vecS,
boost::directedS, boost::null_property_map> graph_t;
graph_t graph;
boost::dynamic_properties dp;
boost::property_map<graph_t, boost::vertex_name_t>::type name =
get(boost::vertex_name, graph);
dp.property("node_id",name);
bool status = boost::read_graphviz(stream,graph,dp,"node_id");
David
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