[Lemon-user] Adapting digraph arc weighting

Kovács Péter kpeter at inf.elte.hu
Thu Feb 18 18:28:38 CET 2010


Dear D Haley,

The last line of your code is wrong:

lemon::MaxWeightedMatching<lemon::ListGraph,
   lemon::ListGraph::EdgeMap<float> > matching(undirectedGraph,arc_cost);

The parameters of the constructor are `undirectedGraph` and `arc_cost`, 
thus you must specify their types as template parameters.

1. `undirectedGraph` is of type `lemon::Undirector<lemon::ListDigraph>`, 
not `lemon::ListGraph` (they are not the same!),
2. `arc_cost` is of type `lemon::ListDigraph::ArcMap<float>`, not 
`lemon::ListGraph::EdgeMap<float>`.

The correct line is:
lemon::MaxWeightedMatching<lemon::Undirector<lemon::ListDigraph>,
lemon::ListDigraph::ArcMap<float> > matching(undirectedGraph,arc_cost);

You can find a working example attached.

Regards,
Peter

> Hello,
> 
> I have a bipartite digraph that I want to perform minimum cost matching upon. The digraph has only arcs from nodes in set A to set B, i.e. no reverse nodes.
> 
> I have something like the following (arc_cost contains the regularised inverse weights).
> 
> typedef lemon::ListDigraph Graph;
> Graph g;
> lemon::ListDigraph::ArcMap<float> arc_cost(g);
> 
> 
> ... code to build digraph ..
> 
> 
> lemon::Undirector<lemon::ListDigraph>  undirectedGraph(g);
> lemon::MaxWeightedMatching<lemon::ListGraph,lemon::ListGraph::EdgeMap<float> > matching(undirectedGraph,arc_cost);
> 
> However, this won't work, particularly as I have no adaptor for arc_cost to make it a valid edgeMap
> 
> Quite, GCC doesn't like it, spitting out a difficult to decipher error, which i think means that it either (1) has the wrong template parameters or (2) the constructor arguments are of the wrong type(arc_cost)
> 
> main.cpp: In function 'int main()':
> main.cpp:95: error: no matching function for call to 'lemon::MaxWeightedMatching<lemon::ListGraph, lemon::GraphExtender<lemon::ListGraphBase>::EdgeMap<float> >::MaxWeightedMatching(lemon::Undirector<lemon::ListDigraph>&, lemon::DigraphExtender<lemon::ListDigraphBase>::ArcMap<float>&)'
> /usr/local/include/lemon/matching.h:1656: note: candidates are: lemon::MaxWeightedMatching<GR, WM>::MaxWeightedMatching(const GR&, const WM&) [with GR = lemon::ListGraph, WM = lemon::GraphExtender<lemon::ListGraphBase>::EdgeMap<float>]
> /usr/local/include/lemon/matching.h:693: note:                 lemon::MaxWeightedMatching<lemon::ListGraph, lemon::GraphExtender<lemon::ListGraphBase>::EdgeMap<float> >::MaxWeightedMatching(const lemon::MaxWeightedMatching<lemon::ListGraph, lemon::GraphExtender<lemon::ListGraphBase>::EdgeMap<float> >&)
> main.cpp:99: error: 'class lemon::MaxWeightedMatching<lemon::ListGraph, lemon::GraphExtender<lemon::ListGraphBase>::EdgeMap<float> >' has no member named 'matchingCost'
> 
> 
> Does anyone have any suggestions, other than manually rebuilding the weighted graph from the weighted digraph?
> 
> Thanks,
> 
> D Haley
> 
> 
> 
>       
> _______________________________________________
> Lemon-user mailing list
> Lemon-user at lemon.cs.elte.hu
> http://lemon.cs.elte.hu/mailman/listinfo/lemon-user
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: max_weighted_matching_test.cpp
URL: <http://lemon.cs.elte.hu/pipermail/lemon-user/attachments/20100218/12ae06d3/attachment.ksh>


More information about the Lemon-user mailing list