<html><head></head><body><div>Hi,</div><div><br></div><div>You should also declare the type of the map containing the edge weights, i.e.:</div><div><br></div><div>MaxWeightedPerfectMatching<ListGraph,ListGraph::EdgeMap<double> > mwpm(G, weight);</div><div><br></div><div>For the second template parameter, GR::EdgeMap<int> is default setting. That's why it worked without explicitly specifying it.</div><div><br></div><div>Regards,</div><div>Alpár</div><div><br></div><div><br></div><div><br></div><div>On Wed, 2016-09-14 at 16:05 -0400, Matthew Galati wrote:</div><blockquote type="cite"><div dir="ltr"><div>I am trying to do a simple test of the matching algorithm.</div><div><br></div><div>It works fine with ListGraph::EdgeMap<int> weight(G);</div><div><br></div><div>But, if I change this to ListGraph::EdgeMap<double> weight(G), I get the following compiler error:</div><div><br></div><div>/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</div><div> argument types are: (lemon::ListGraph, lemon::GraphExtender<lemon::ListGraphBase>::EdgeMap<double>)</div><div> MaxWeightedPerfectMatching<ListGraph> mwpm(G, weight);</div><div> </div><div><br></div><div>Here is the full code:</div><div><br></div><div><div>int LemonC::CreateGraph(const int nNodes,</div><div> const int64_t nLinks,</div><div> const int * linkO,</div><div> const int * linkD,</div><div> const double * linkWt){ </div><div> TEMPLATE_GRAPH_TYPEDEFS(ListGraph);</div><div> cout << "hello test lemon create graph" << endl;</div><div> ListGraph G;</div><div> ListGraph::EdgeMap<double> weight(G);</div><div> //ListGraph::EdgeMap<int> weight(G);</div><div> ListGraph::Edge e;</div><div> ListGraph::Node n[10000];</div><div> G.reserveNode(nNodes);</div><div> G.reserveEdge(nLinks);</div><div> int64_t i;</div><div> for(i = 0; i < nNodes; i++){<br></div><div> n[i] = G.addNode();</div><div> }</div><div> for(i = 0; i < nLinks; i++){</div><div> e = G.addEdge(n[linkO[i]], n[linkD[i]]);</div><div> weight[e] = linkWt[i];</div><div> }</div><div><br></div><div> MaxWeightedPerfectMatching<ListGraph> mwpm(G, weight);</div><div> bool result = mwpm.run();</div><div> cout << "Matching weight = " << mwpm.matchingWeight() << endl;</div><div><br></div><div> return 1;</div><div>}</div></div><div><br></div></div>
<pre>_______________________________________________
Lemon-user mailing list
<a href="mailto:Lemon-user@lemon.cs.elte.hu">Lemon-user@lemon.cs.elte.hu</a>
<a href="http://lemon.cs.elte.hu/mailman/listinfo/lemon-user">http://lemon.cs.elte.hu/mailman/listinfo/lemon-user</a>
</pre></blockquote></body></html>