I am trying to read a graph from Graphviz DOT file. I am interested in two properties for Vertex - its id and peripheries. A also want to load graph labels.
My code looks like this:
struct DotVertex {
std::string name;
int peripheries;
};
struct DotEdge {
std::string label;
};
typedef boost::adjacency_list<boost::vecS, boost::vecS, boost::directedS,
DotVertex, DotEdge> graph_t;
graph_t graphviz;
boost::dynamic_properties dp;
dp.property("node_id", boost::get(&DotVertex::name, graphviz));
dp.property("peripheries", boost::get(&DotVertex::peripheries, graphviz));
dp.property("edge_id", boost::get(&DotEdge::label, graphviz));
bool status = boost::read_graphviz(dot, graphviz, dp);
My sample DOT file looks like this:
digraph G {
rankdir=LR
I [label="", style=invis, width=0]
I -> 0
0 [label="0", peripheries=2]
0 -> 0 [label="a"]
0 -> 1 [label="!a"]
1 [label="1"]
1 -> 0 [label="a"]
1 -> 1 [label="!a"]
}
When I run it, I get exception "Property not found: label". What am I doing wrong?