lemon/pr_bipartite_matching.h
changeset 2550 f26368148b9c
parent 2466 feb7974cf4ec
child 2553 bfced05fa852
equal deleted inserted replaced
2:63942ea43538 3:d8c5dfc93c38
   177 		bedge=tbedge;
   177 		bedge=tbedge;
   178 	      }
   178 	      }
   179 	}
   179 	}
   180 	if(nlevel<_node_num) {
   180 	if(nlevel<_node_num) {
   181 	  if(nlevel>=actlevel)
   181 	  if(nlevel>=actlevel)
   182 	    _levels.liftHighestActiveTo(nlevel+1);
   182 	    _levels.liftHighestActive(nlevel+1);
   183 	  bact=_g.bNode(_matching[_g.aNode(bedge)]);
   183 	  bact=_g.bNode(_matching[_g.aNode(bedge)]);
   184 	  if(--_cov[bact]<1) {
   184 	  if(--_cov[bact]<1) {
   185 	    _levels.activate(bact);
   185 	    _levels.activate(bact);
   186 	    last_activated=bact;
   186 	    last_activated=bact;
   187 	  }
   187 	  }
   188 	  _matching[_g.aNode(bedge)]=bedge;
   188 	  _matching[_g.aNode(bedge)]=bedge;
   189 	  _cov[act]=1;
   189 	  _cov[act]=1;
   190 	  _levels.deactivate(act);
   190 	  _levels.deactivate(act);
   191 	}
   191 	}
   192 	else {
   192 	else {
   193 	  if(_node_num>actlevel) 
   193 	  _levels.liftHighestActiveToTop();
   194 	    _levels.liftHighestActiveTo(_node_num);
   194 	}
   195 	  _levels.deactivate(act); 
   195 
   196 	}
   196 	if(_levels.emptyLevel(actlevel))
   197 
       
   198 	if(_levels.onLevel(actlevel)==0)
       
   199 	  _levels.liftToTop(actlevel);
   197 	  _levels.liftToTop(actlevel);
   200       }
   198       }
   201       
   199       
   202       for(ANodeIt n(_g);n!=INVALID;++n) {
   200       for(ANodeIt n(_g);n!=INVALID;++n) {
   203 	if (_matching[n]==INVALID)continue;
   201 	if (_matching[n]==INVALID)continue;
   244 		bedge=tbedge;
   242 		bedge=tbedge;
   245 	      }
   243 	      }
   246 	}
   244 	}
   247 	if(nlevel<_node_num) {
   245 	if(nlevel<_node_num) {
   248 	  if(nlevel>=actlevel)
   246 	  if(nlevel>=actlevel)
   249 	    _levels.liftHighestActiveTo(nlevel+1);
   247 	    _levels.liftHighestActive(nlevel+1);
   250 	  bact=_g.bNode(_matching[_g.aNode(bedge)]);
   248 	  bact=_g.bNode(_matching[_g.aNode(bedge)]);
   251 	  if(--_cov[bact]<1) {
   249 	  if(--_cov[bact]<1) {
   252 	    _levels.activate(bact);
   250 	    _levels.activate(bact);
   253 	    last_activated=bact;
   251 	    last_activated=bact;
   254 	  }
   252 	  }
   255 	  _matching[_g.aNode(bedge)]=bedge;
   253 	  _matching[_g.aNode(bedge)]=bedge;
   256 	  _cov[act]=1;
   254 	  _cov[act]=1;
   257 	  _levels.deactivate(act);
   255 	  _levels.deactivate(act);
   258 	}
   256 	}
   259 	else {
   257 	else {
   260 	  if(_node_num>actlevel) 
   258 	  _levels.liftHighestActiveToTop();
   261 	    _levels.liftHighestActiveTo(_node_num);
   259 	}
   262 	  _levels.deactivate(act); 
   260 
   263 	}
   261 	if(_levels.emptyLevel(actlevel))
   264 
       
   265 	if(_levels.onLevel(actlevel)==0)
       
   266 	  _empty_level=actlevel;
   262 	  _empty_level=actlevel;
   267 	  return false;
   263 	  return false;
   268       }
   264       }
   269       _matching_size = _node_num;
   265       _matching_size = _node_num;
   270       return true;
   266       return true;