diff -r c0f4ebdc0034 -r 9e9195331ea6 src/lemon/max_matching.h --- a/src/lemon/max_matching.h Wed Jan 19 20:19:31 2005 +0000 +++ b/src/lemon/max_matching.h Thu Jan 20 10:24:38 2005 +0000 @@ -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 void writePos (NMapEnum& map) const { for(NodeIt v(g); v!=INVALID; ++v) map.set(v,position[v]); @@ -290,7 +278,10 @@ template void MaxMatching::runEdmonds( int heur=1 ) { - + + for(NodeIt v(g); v!=INVALID; ++v) + position.set(v,C); + typename Graph::template NodeMap 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 - void MaxMatching::resetPos() { - for(NodeIt v(g); v!=INVALID; ++v) - position.set(v,C); - } - - template void MaxMatching::resetMatching() { for(NodeIt v(g); v!=INVALID; ++v) mate.set(v,INVALID);