lemon/max_matching.h
changeset 2386 81b47fc5c444
parent 2308 cddae1c4fee6
child 2391 14a343be7a5a
     1.1 --- a/lemon/max_matching.h	Fri Mar 02 17:56:22 2007 +0000
     1.2 +++ b/lemon/max_matching.h	Fri Mar 02 18:04:28 2007 +0000
     1.3 @@ -355,7 +355,8 @@
     1.4  
     1.5    template <typename Graph>
     1.6    void MaxMatching<Graph>::lateShrink(Node v, typename Graph::template 
     1.7 -				      NodeMap<Node>& ear, UFE& blossom, UFE& tree) {
     1.8 +				      NodeMap<Node>& ear, UFE& blossom, 
     1.9 +                                      UFE& tree) {
    1.10      //We have one tree which we grow, and also shrink but only if it cannot be
    1.11      //postponed. If we augment then we return to the "for" cycle of
    1.12      //runEdmonds().
    1.13 @@ -372,7 +373,8 @@
    1.14  	Node y=g.runningNode(e);
    1.15  	//growOrAugment grows if y is covered by the matching and
    1.16  	//augments if not. In this latter case it returns 1.
    1.17 -	if ( position[y]==C && growOrAugment(y, x, ear, blossom, tree, Q) ) return;
    1.18 +	if ( position[y]==C && growOrAugment(y, x, ear, blossom, tree, Q) ) 
    1.19 +          return;
    1.20        }
    1.21        R.push(x);
    1.22      }
    1.23 @@ -389,15 +391,16 @@
    1.24  	  shrink( x, y, ear, blossom, tree, Q);	
    1.25  	
    1.26  	while ( !Q.empty() ) {
    1.27 -	  Node x=Q.front();
    1.28 +	  Node z=Q.front();
    1.29  	  Q.pop();
    1.30 -	  for( IncEdgeIt e(g,x); e!= INVALID; ++e ) {
    1.31 -	    Node y=g.runningNode(e);
    1.32 +	  for( IncEdgeIt f(g,z); f!= INVALID; ++f ) {
    1.33 +	    Node w=g.runningNode(f);
    1.34  	    //growOrAugment grows if y is covered by the matching and
    1.35  	    //augments if not. In this latter case it returns 1.
    1.36 -	    if ( position[y]==C && growOrAugment(y, x, ear, blossom, tree, Q) ) return;
    1.37 +	    if ( position[w]==C && growOrAugment(w, z, ear, blossom, tree, Q) )
    1.38 +              return;
    1.39  	  }
    1.40 -	  R.push(x);
    1.41 +	  R.push(z);
    1.42  	}
    1.43        } //for e
    1.44      } // while ( !R.empty() )