3
我正嘗試使用Boost Graph Library訪問格式化輸入文件的點(graphviz)的圖形標籤。以下是圖表類型的typedef:訪問BGL GraphProperty
struct DotVertex {
std::string label;
};
struct DotEdge {
std::string label;
};
struct DotGraph {
std::string label;
};
typedef boost::adjacency_list<boost::vecS, boost::vecS, boost::directedS,
DotVertex, DotEdge, DotGraph> graph_t;
這就是我如何分配的動態特性:
graph_t graphviz;
boost::dynamic_properties dp(boost::ignore_other_properties);
dp.property("label", boost::get(&DotGraph::label, graphviz));
dp.property("label", boost::get(&DotVertex::label, graphviz));
dp.property("label", boost::get(&DotEdge::label, graphviz));
std::ifstream ifs("sample.dot");
bool status = boost::read_graphviz(ifs, graphviz, dp);
編譯器抱怨分配爲DotGraph ::標籤有錯誤消息:
read_graph.cc:25:30: error: no matching function for call to 'get' dp.property("label", boost::get(&DotGraph::label, graphviz));
有人可以指出在這種情況下閱讀圖形標籤的方便方法是什麼?謝謝!
我已經忘記了這一點,雖然我寫的回答鏈接:) – sehe