【问题标题】:How to load Graph from graphml file with boost如何使用 boost 从 graphml 文件加载 Graph
【发布时间】:2017-04-12 05:15:37
【问题描述】:

我不知道如何使用 boost 从 graphml 文件加载图形。我可以保存 graphml 文件,但无法加载。

我的图表有类型

 typedef  boost::labeled_graph<boost::adjacency_list<
        boost::listS, boost::vecS, boost::directedS,
        Vertex, Edge>, int> Graph;
 Graph graph;

我的加载函数看起来像。

boost::dynamic_properties dp(boost::ignore_other_properties);

dp.property("IdV", boost::get(&Vertex::ID, graph.graph()));
dp.property("LabelV", boost::get(&Vertex::Name, graph.graph()));
dp.property("TypeV", boost::get(&Vertex::Type, graph.graph()));

dp.property("WeightE", boost::get(&Edge::Weight, graph.graph()));
dp.property("TypeE", boost::get(&Edge::Type, graph.graph()));
dp.property("LabelE", boost::get(&Edge::Name, graph.graph()));

std::ifstream dot(std::string(inputPath) + "");
boost::read_graphml(dot, graph.graph(), dp);

我收到此错误消息:

[ilink64 错误] 错误:未解决的外部 'boost::read_graphml(std::istream&, boost::mutate_graph&, 无符号 long long)' 引用自 ...\GRAPH_UNIT.O

谁能给我一个简单的好例子,如何在 boost.js 中读取 graphml 文件。我刚刚发现以下 2 个示例 - 我认为我的代码是一样的?

Boost read_graphml examplehttps://stackoverflow.com/questions/16667175/using-vertex-name-when-reading-a-graphml-file-with-boost-graph

或者有人可以在我的代码中看到错误吗?

最好的 迈克尔

【问题讨论】:

    标签: c++ boost graph unresolved-external graphml


    【解决方案1】:

    Boost.Graph 库在使用时不是一个只有头文件的库,例如。 g.,read_graphml()。您只需要链接到 boost 图形库,另请参阅 boost::read_graphml visual studio 2013

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-10-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多