resetPos deleted
authorjacint
Thu, 20 Jan 2005 10:24:38 +0000
changeset 10909e9195331ea6
parent 1089 c0f4ebdc0034
child 1091 c756973cd53c
resetPos deleted
src/lemon/max_matching.h
     1.1 --- a/src/lemon/max_matching.h	Wed Jan 19 20:19:31 2005 +0000
     1.2 +++ b/src/lemon/max_matching.h	Thu Jan 20 10:24:38 2005 +0000
     1.3 @@ -47,8 +47,7 @@
     1.4    ///a graph with factor-critical components, the nodes in A form the
     1.5    ///barrier, and the nodes in C induce a graph having a perfect
     1.6    ///matching. This decomposition can be attained by calling \ref
     1.7 -  ///writePos after running the algorithm. Before subsequent runs,
     1.8 -  ///the function \ref resetPos() must be called.
     1.9 +  ///writePos after running the algorithm. 
    1.10    ///
    1.11    ///\param Graph The undirected graph type the algorithm runs on.
    1.12    ///
    1.13 @@ -87,22 +86,20 @@
    1.14       
    1.15    public:
    1.16      
    1.17 -    MaxMatching(const Graph& _g) : g(_g), mate(_g,INVALID), position(_g,C) {}
    1.18 +    MaxMatching(const Graph& _g) : g(_g), mate(_g,INVALID), position(_g) {}
    1.19  
    1.20      ///Runs Edmonds' algorithm.
    1.21  
    1.22      ///Runs Edmonds' algorithm for sparse graphs (number of edges <
    1.23      ///2*number of nodes), and a heuristical Edmonds' algorithm with a
    1.24 -    ///heuristic of postponing shrinks for dense graphs. \pre Before
    1.25 -    ///the subsequent calls \ref resetPos must be called.
    1.26 +    ///heuristic of postponing shrinks for dense graphs. 
    1.27      inline void run();
    1.28  
    1.29      ///Runs Edmonds' algorithm.
    1.30      
    1.31      ///If heur=0 it runs Edmonds' algorithm. If heur=1 it runs
    1.32      ///Edmonds' algorithm with a heuristic of postponing shrinks,
    1.33 -    ///giving a faster algorithm for dense graphs.  \pre Before the
    1.34 -    ///subsequent calls \ref resetPos must be called.
    1.35 +    ///giving a faster algorithm for dense graphs.  
    1.36      void runEdmonds( int heur );
    1.37  
    1.38      ///Finds a greedy matching starting from the actual matching.
    1.39 @@ -117,14 +114,6 @@
    1.40      ///run() it returns the size of a maximum matching in the graph.
    1.41      int size() const;
    1.42  
    1.43 -    ///Resets the map storing the Gallai-Edmonds decomposition.
    1.44 -    
    1.45 -    ///Resets the map storing the Gallai-Edmonds decomposition of the
    1.46 -    ///graph, making it possible to run the algorithm. Must be called
    1.47 -    ///before all runs of the Edmonds algorithm, except for the first
    1.48 -    ///run.
    1.49 -    void resetPos();
    1.50 -
    1.51      ///Resets the actual matching to the empty matching.
    1.52  
    1.53      ///Resets the actual matching to the empty matching.  
    1.54 @@ -245,10 +234,9 @@
    1.55      ///Writes the canonical decomposition of the graph after running
    1.56      ///the algorithm.
    1.57  
    1.58 -    ///After calling any run methods of the class, and before calling
    1.59 -    ///\ref resetPos(), it writes the Gallai-Edmonds canonical
    1.60 -    ///decomposition of the graph. \c map must be a node map
    1.61 -    ///of \ref pos_enum 's.
    1.62 +    ///After calling any run methods of the class, it writes the
    1.63 +    ///Gallai-Edmonds canonical decomposition of the graph. \c map
    1.64 +    ///must be a node map of \ref pos_enum 's.
    1.65      template<typename NMapEnum>
    1.66      void writePos (NMapEnum& map) const {
    1.67        for(NodeIt v(g); v!=INVALID; ++v)  map.set(v,position[v]);
    1.68 @@ -290,7 +278,10 @@
    1.69  
    1.70    template <typename Graph>
    1.71    void MaxMatching<Graph>::runEdmonds( int heur=1 ) {
    1.72 -      
    1.73 +
    1.74 +    for(NodeIt v(g); v!=INVALID; ++v)
    1.75 +      position.set(v,C);      
    1.76 +
    1.77      typename Graph::template NodeMap<Node> ear(g,INVALID); 
    1.78      //undefined for the base nodes of the blossoms (i.e. for the
    1.79      //representative elements of UFE blossom) and for the nodes in C
    1.80 @@ -476,12 +467,6 @@
    1.81    }
    1.82  
    1.83    template <typename Graph>
    1.84 -  void MaxMatching<Graph>::resetPos() {
    1.85 -    for(NodeIt v(g); v!=INVALID; ++v)
    1.86 -      position.set(v,C);      
    1.87 -  }
    1.88 -
    1.89 -  template <typename Graph>
    1.90    void MaxMatching<Graph>::resetMatching() {
    1.91      for(NodeIt v(g); v!=INVALID; ++v)
    1.92        mate.set(v,INVALID);