src/hugo/max_flow.h
changeset 736 ba76a7f56b23
parent 726 835ebe1b3250
child 745 d976ba609099
equal deleted inserted replaced
0:fcd243525ea6 1:5027979724cc
   416     /// Returns the maximum value of a flow, by counting the 
   416     /// Returns the maximum value of a flow, by counting the 
   417     /// over-flow of the target node \ref t.
   417     /// over-flow of the target node \ref t.
   418     /// It can be called already after running \ref preflowPhase1.
   418     /// It can be called already after running \ref preflowPhase1.
   419     Num flowValue() const {
   419     Num flowValue() const {
   420       Num a=0;
   420       Num a=0;
   421       for(InEdgeIt e(*g,t);g->valid(e);G.next(e)) a+=(*flow)[e];
   421       for(InEdgeIt e(*g,t);g->valid(e);g->next(e)) a+=(*flow)[e];
   422       for(OutEdgeIt e(*g,t);g->valid(e);G.next(e)) a-=(*flow)[e];
   422       for(OutEdgeIt e(*g,t);g->valid(e);g->next(e)) a-=(*flow)[e];
   423 
   423 
   424       //marci figyu: excess[t] epp ezt adja preflow 1. fazisa utan   
   424       //marci figyu: excess[t] epp ezt adja preflow 1. fazisa utan   
   425     }
   425     }
   426 
   426 
   427     ///Returns a minimum value cut after calling \ref preflowPhase1.
   427     ///Returns a minimum value cut after calling \ref preflowPhase1.
   451 	break;
   451 	break;
   452       case AFTER_PRE_FLOW_PHASE_2:
   452       case AFTER_PRE_FLOW_PHASE_2:
   453       case AFTER_NOTHING:
   453       case AFTER_NOTHING:
   454 	minMinCut(M);
   454 	minMinCut(M);
   455 	break;
   455 	break;
   456       case AFTER_AUGMENTING:
       
   457 	for(g->first(v); g->valid(v); g->next(v)) {
       
   458 	  if (level[v]) {
       
   459 	    M.set(v, true);
       
   460 	  } else {
       
   461 	    M.set(v, false);
       
   462 	  }
       
   463 	}
       
   464 	break;
       
   465       case AFTER_FAST_AUGMENTING:
       
   466 	for(g->first(v); g->valid(v); g->next(v)) {
       
   467 	  if (level[v]==number_of_augmentations) {
       
   468 	    M.set(v, true);
       
   469 	  } else {
       
   470 	    M.set(v, false);
       
   471 	  }
       
   472 	}
       
   473 	break;
       
   474       }
   456       }
   475     }
   457     }
   476 
   458 
   477     ///Returns the inclusionwise minimum of the minimum value cuts.
   459     ///Returns the inclusionwise minimum of the minimum value cuts.
   478 
   460