[Lemon-user] matching with double edge weights
Matthew Galati
matthew.galati at gmail.com
Wed Sep 14 22:05:53 CEST 2016
I am trying to do a simple test of the matching algorithm.
It works fine with ListGraph::EdgeMap<int> weight(G);
But, if I change this to ListGraph::EdgeMap<double> weight(G), I get the
following compiler error:
/u/magala/cpp/lemon/tkegraph/src/lemoncpp.cpp(53): error: no instance of
constructor "lemon::MaxWeightedPerfectMatching<GR,
WM>::MaxWeightedPerfectMatching [with GR=lemon::ListGraph,
WM=lemon::GraphExtender<lemon::ListGraphBase>::EdgeMap<int>]" matches the
argument list
argument types are: (lemon::ListGraph,
lemon::GraphExtender<lemon::ListGraphBase>::EdgeMap<double>)
MaxWeightedPerfectMatching<ListGraph> mwpm(G, weight);
Here is the full code:
int LemonC::CreateGraph(const int nNodes,
const int64_t nLinks,
const int * linkO,
const int * linkD,
const double * linkWt){
TEMPLATE_GRAPH_TYPEDEFS(ListGraph);
cout << "hello test lemon create graph" << endl;
ListGraph G;
ListGraph::EdgeMap<double> weight(G);
//ListGraph::EdgeMap<int> weight(G);
ListGraph::Edge e;
ListGraph::Node n[10000];
G.reserveNode(nNodes);
G.reserveEdge(nLinks);
int64_t i;
for(i = 0; i < nNodes; i++){
n[i] = G.addNode();
}
for(i = 0; i < nLinks; i++){
e = G.addEdge(n[linkO[i]], n[linkD[i]]);
weight[e] = linkWt[i];
}
MaxWeightedPerfectMatching<ListGraph> mwpm(G, weight);
bool result = mwpm.run();
cout << "Matching weight = " << mwpm.matchingWeight() << endl;
return 1;
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lemon.cs.elte.hu/pipermail/lemon-user/attachments/20160914/cd159237/attachment.html>
More information about the Lemon-user
mailing list