[Lemon-user] Question regarding ListUGraph

Dragos Trinca dnt04001 at engr.uconn.edu
Sun Jul 20 22:14:36 CEST 2008


 
 
Hi,
 
I need to use the class ListUGraph in such a way that every node in the graph is of my defined type, say ``T'' (where T can be anything), and not of type ``Node'' (as implicitly is).
 
Does anyone know how to add nodes of locally defined type ``T'' to a graph ?
 
Thanks in advance,
 
Dragos
 
 

________________________________

From: lemon-user-bounces at lemon.cs.elte.hu on behalf of Balazs Dezso
Sent: Thu 7/17/2008 9:42 AM
To: lemon-user at lemon.cs.elte.hu
Cc: Dragos Trinca
Subject: Re: [Lemon-user] Question regarding the MaxWeightedPerfectMatchingclass



Hi

The current algorithm runs on undirected graphs, so the solution is to use
ListUGraph instead of ListGraph.

The fixed code:

#include <iostream>
#include <lemon/list_graph.h>
#include <lemon/max_matching.h>

int main()
{
  typedef lemon::ListUGraph UGraph;
  typedef Graph::UEdgeMap<int> LengthMap;
  using lemon::INVALID;

  UGraph g;

  LengthMap length(g);

  typedef lemon::MaxWeightedPerfectMatching<UGraph,LengthMap> MWPM;
  // MWPM gg(g, length);
}

If you would like to use directed graphs, you can use the UndirGraphAdaptor to
give the directed graph object for the matching algorithm.

Best, Balazs


On Thursday 17 July 2008 14:44:30 Dragos Trinca wrote:
> Hi,
>
> I have a question regarding the MaxWeightedPerfectMatching class.
>
> The following code works well:
>
>
> #include <iostream>
> #include <lemon/list_graph.h>
> #include <lemon/max_matching.h>
>
> int main()
> {
>   typedef lemon::ListGraph Graph;
>   typedef Graph::EdgeMap<int> LengthMap;
>   using lemon::INVALID;
>
>   Graph g;
>
>   LengthMap length(g);
>
>   typedef lemon::MaxWeightedPerfectMatching<Graph,LengthMap> MWPM;
>   // MWPM gg(g, length);
> }
>
>
> However, if I remove the comments from the last line, it gives me errors as
> follows:
>
> /home/dnt04001/lemon-0.7/include/lemon/max_matching.h: In instantiation of
> âlemon::MaxWeightedPerfectMatching<lemon::ListGraph,
> lemon::GraphExtender<lemon::ListGraphBase>::EdgeMap<int> >â:
> hello_lemon.cc:95:   instantiated from here
> /home/dnt04001/lemon-0.7/include/lemon/max_matching.h:2024: error: no type
> named âUEdgeâ in âclass lemon::ListGraphâ
> /home/dnt04001/lemon-0.7/include/lemon/max_matching.h:2024: error: no type
> named âUEdgeItâ in âclass lemon::ListGraphâ
> /home/dnt04001/lemon-0.7/include/lemon/max_matching.h:2024: error: no type
> named âIncEdgeItâ in âclass lemon::ListGraphâ
> /home/dnt04001/lemon-0.7/include/lemon/max_matching.h: In instantiation of
> âlemon::MaxWeightedPerfectMatching<lemon::ListGraph,
> lemon::GraphExtender<lemon::ListGraphBase>::EdgeMap<int> >â:
> hello_lemon.cc:95:   instantiated from here
> /home/dnt04001/lemon-0.7/include/lemon/max_matching.h:2055: error: no class
> template named âUEdgeMapâ in âclass lemon::ListGraphâ
> /home/dnt04001/lemon-0.7/include/lemon/max_matching.h:2100: error: no class
> template named âUEdgeMapâ in âclass lemon::ListGraphâ
> /home/dnt04001/lemon-0.7/include/lemon/max_matching.h:2101: error: no class
> template named âUEdgeMapâ in âclass lemon::ListGraphâ
> /home/dnt04001/lemon-0.7/include/lemon/max_matching.h:2474: error: no type
> named âUEdgeâ in âclass lemon::ListGraphâ
> /home/dnt04001/lemon-0.7/include/lemon/max_matching.h:2508: error: no type
> named âUEdgeâ in âclass lemon::ListGraphâ
> /home/dnt04001/lemon-0.7/include/lemon/max_matching.h:2990: error: no type
> named âUEdgeâ in âclass lemon::ListGraphâ
> /home/dnt04001/lemon-0.7/include/lemon/max_matching.h: In constructor
> âlemon::MaxWeightedPerfectMatching<_UGraph,
> _WeightMap>::MaxWeightedPerfectMatching(const _UGraph&, const _WeightMap&)
> [with _UGraph = lemon::ListGraph, _WeightMap =
> lemon::GraphExtender<lemon::ListGraphBase>::EdgeMap<int>]â:
> hello_lemon.cc:95:   instantiated from here
> /home/dnt04001/lemon-0.7/include/lemon/max_matching.h:2825: error: using
> invalid field âlemon::MaxWeightedPerfectMatching<_UGraph,
> _WeightMap>::_delta3_indexâ
> /home/dnt04001/lemon-0.7/include/lemon/max_matching.h:2825: error: using
> invalid field âlemon::MaxWeightedPerfectMatching<_UGraph,
> _WeightMap>::_delta3â
> /home/dnt04001/lemon-0.7/include/lemon/max_matching.h: In member function
> âvoid lemon::MaxWeightedPerfectMatching<_UGraph,
> _WeightMap>::destroyStructures() [with _UGraph = lemon::ListGraph,
> _WeightMap = lemon::GraphExtender<lemon::ListGraphBase>::EdgeMap<int>]â:
> /home/dnt04001/lemon-0.7/include/lemon/max_matching.h:2828:   instantiated
> from âlemon::MaxWeightedPerfectMatching<_UGraph,
> _WeightMap>::~MaxWeightedPerfectMatching() [with _UGraph =
> lemon::ListGraph, _WeightMap =
> lemon::GraphExtender<lemon::ListGraphBase>::EdgeMap<int>]â
> hello_lemon.cc:95:   instantiated from here
> /home/dnt04001/lemon-0.7/include/lemon/max_matching.h:2179: error: using
> invalid field âlemon::MaxWeightedPerfectMatching<_UGraph,
> _WeightMap>::_delta3â
> /home/dnt04001/lemon-0.7/include/lemon/max_matching.h:2180: error: using
> invalid field âlemon::MaxWeightedPerfectMatching<_UGraph,
> _WeightMap>::_delta3_indexâ
> /home/dnt04001/lemon-0.7/include/lemon/max_matching.h:2181: error: using
> invalid field âlemon::MaxWeightedPerfectMatching<_UGraph,
> _WeightMap>::_delta3â
>
> Maybe somebody can tell me how to use the MaxWeightedPerfectMatching class.
>
> Thanks,
>
> Dragos
>
>
>
> _______________________________________________
> Lemon-user mailing list
> Lemon-user at lemon.cs.elte.hu
> http://lemon.cs.elte.hu/mailman/listinfo/lemon-user

_______________________________________________
Lemon-user mailing list
Lemon-user at lemon.cs.elte.hu
http://lemon.cs.elte.hu/mailman/listinfo/lemon-user





More information about the Lemon-user mailing list