柠檬图库的边权重

Edge weights with the lemon graph library

本文关键字:权重 柠檬      更新时间:2023-10-16

我正在使用Lemon图形库。

我想给边赋整数权值。因此我使用的是EdgeMap。不幸的是,我的代码无法编译。

no matching function for call to 'lemon::concepts::Graph::EdgeMap<int>::EdgeMap(lemon::ListGraph&)'

任何想法?

#include <lemon/list_graph.h>
#include <lemon/concepts/graph.h>
#include <iostream>
using namespace lemon;
using namespace std;
int main(int argc, const char * argv[])
{    
   ListGraph g;
   lemon::concepts::Graph::EdgeMap<int> map(g);
   return 0;
}

看起来你在这里试图调用一个禁止的复制构造函数。lemon::ListGraph()的复制构造函数被标记为private, EdgeMap (const Graph &)需要一个const Graph &参数。

换句话说,ListGraphEdgeMap的概念不匹配。据我从他们的文档中了解,ListGraph提供了concepts::Digraph的概念,而EdgeMap需要一个符合ReferenceMap的实现。