[Lemon-commits] [lemon_svn] jacint: r1486 - hugo/trunk/src/lemon

Lemon SVN svn at lemon.cs.elte.hu
Mon Nov 6 20:45:49 CET 2006


Author: jacint
Date: Thu Jan 20 11:24:38 2005
New Revision: 1486

Modified:
   hugo/trunk/src/lemon/max_matching.h

Log:
resetPos deleted

Modified: hugo/trunk/src/lemon/max_matching.h
==============================================================================
--- hugo/trunk/src/lemon/max_matching.h	(original)
+++ hugo/trunk/src/lemon/max_matching.h	Thu Jan 20 11:24:38 2005
@@ -47,8 +47,7 @@
   ///a graph with factor-critical components, the nodes in A form the
   ///barrier, and the nodes in C induce a graph having a perfect
   ///matching. This decomposition can be attained by calling \ref
-  ///writePos after running the algorithm. Before subsequent runs,
-  ///the function \ref resetPos() must be called.
+  ///writePos after running the algorithm. 
   ///
   ///\param Graph The undirected graph type the algorithm runs on.
   ///
@@ -87,22 +86,20 @@
      
   public:
     
-    MaxMatching(const Graph& _g) : g(_g), mate(_g,INVALID), position(_g,C) {}
+    MaxMatching(const Graph& _g) : g(_g), mate(_g,INVALID), position(_g) {}
 
     ///Runs Edmonds' algorithm.
 
     ///Runs Edmonds' algorithm for sparse graphs (number of edges <
     ///2*number of nodes), and a heuristical Edmonds' algorithm with a
-    ///heuristic of postponing shrinks for dense graphs. \pre Before
-    ///the subsequent calls \ref resetPos must be called.
+    ///heuristic of postponing shrinks for dense graphs. 
     inline void run();
 
     ///Runs Edmonds' algorithm.
     
     ///If heur=0 it runs Edmonds' algorithm. If heur=1 it runs
     ///Edmonds' algorithm with a heuristic of postponing shrinks,
-    ///giving a faster algorithm for dense graphs.  \pre Before the
-    ///subsequent calls \ref resetPos must be called.
+    ///giving a faster algorithm for dense graphs.  
     void runEdmonds( int heur );
 
     ///Finds a greedy matching starting from the actual matching.
@@ -117,14 +114,6 @@
     ///run() it returns the size of a maximum matching in the graph.
     int size() const;
 
-    ///Resets the map storing the Gallai-Edmonds decomposition.
-    
-    ///Resets the map storing the Gallai-Edmonds decomposition of the
-    ///graph, making it possible to run the algorithm. Must be called
-    ///before all runs of the Edmonds algorithm, except for the first
-    ///run.
-    void resetPos();
-
     ///Resets the actual matching to the empty matching.
 
     ///Resets the actual matching to the empty matching.  
@@ -245,10 +234,9 @@
     ///Writes the canonical decomposition of the graph after running
     ///the algorithm.
 
-    ///After calling any run methods of the class, and before calling
-    ///\ref resetPos(), it writes the Gallai-Edmonds canonical
-    ///decomposition of the graph. \c map must be a node map
-    ///of \ref pos_enum 's.
+    ///After calling any run methods of the class, it writes the
+    ///Gallai-Edmonds canonical decomposition of the graph. \c map
+    ///must be a node map of \ref pos_enum 's.
     template<typename NMapEnum>
     void writePos (NMapEnum& map) const {
       for(NodeIt v(g); v!=INVALID; ++v)  map.set(v,position[v]);
@@ -290,7 +278,10 @@
 
   template <typename Graph>
   void MaxMatching<Graph>::runEdmonds( int heur=1 ) {
-      
+
+    for(NodeIt v(g); v!=INVALID; ++v)
+      position.set(v,C);      
+
     typename Graph::template NodeMap<Node> ear(g,INVALID); 
     //undefined for the base nodes of the blossoms (i.e. for the
     //representative elements of UFE blossom) and for the nodes in C
@@ -476,12 +467,6 @@
   }
 
   template <typename Graph>
-  void MaxMatching<Graph>::resetPos() {
-    for(NodeIt v(g); v!=INVALID; ++v)
-      position.set(v,C);      
-  }
-
-  template <typename Graph>
   void MaxMatching<Graph>::resetMatching() {
     for(NodeIt v(g); v!=INVALID; ++v)
       mate.set(v,INVALID);      



More information about the Lemon-commits mailing list