int const SIZE=10;
struct DotVertex {
int Attribute[SIZE];
};
struct DotEdge {
std::string label;
};
typedef boost::adjacency_list<boost::vecS, boost::vecS, boost::directedS,
DotVertex, DotEdge> graph_t;
int main() {
graph_t graphviz;
boost::dynamic_properties dp(boost::ignore_other_properties);
dp.property("node_id", boost::get(&DotVertex::name, graph_t));
dp.property("Attribute0", boost::get(&DotVertex::Attribute[0], graph_t));
std::ifstream dot("graphnametest2.dot");
boost::read_graphviz(dot, graph_t, dp);
如何通过 Graphviz DOT 文件中的数组属性 [SIZE] 读取未知属性,甚至不知道它的大小?例如,下面的代码总是错误的: dp.property("Attribute0", boost::get(&DotVertex::Attribute[0], graph_t))