简体   繁体   中英

Edge weights with the lemon graph library

I am using the Lemon graph library.

I want to assign integer weights to the edges. Thus I am using EdgeMap . Unfortunality my code doesn't compile.

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

Any ideas?

#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;
}

Looks like you're trying to call a forbidden copy constructor here. The copy constructor of lemon::ListGraph() is marked as private and EdgeMap (const Graph &) wants a const Graph & parameter.

In other words, the concepts for ListGraph and EdgeMap don't match. As far as I understood from their documentation ListGraph provides the concepts::Digraph concept, where EdgeMap requires a ReferenceMap compliant implementation.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM