equal
  deleted
  inserted
  replaced
  
    
    
    42   ///edges should be passed to the algorithm through the  | 
    42   ///edges should be passed to the algorithm through the  | 
    43   ///constructor. It is possible to change these quantities using the  | 
    43   ///constructor. It is possible to change these quantities using the  | 
    44   ///functions \ref setSource, \ref setTarget, \ref setCap and \ref  | 
    44   ///functions \ref setSource, \ref setTarget, \ref setCap and \ref  | 
    45   ///setFlow.  | 
    45   ///setFlow.  | 
    46   ///  | 
    46   ///  | 
    47   ///After running \ref phase1() or \ref preflow(), the actual flow  | 
    47   ///After running \ref hugo::Preflow::phase1() "phase1()"  | 
         | 
    48   ///or \ref hugo::Preflow::run() "run()", the actual flow  | 
    48   ///value can be obtained by calling \ref flowValue(). The minimum  | 
    49   ///value can be obtained by calling \ref flowValue(). The minimum  | 
    49   ///value cut can be written into a <tt>bool</tt> node map by  | 
    50   ///value cut can be written into a <tt>bool</tt> node map by  | 
    50   ///calling \ref minCut(). (\ref minMinCut() and \ref maxMinCut() writes  | 
    51   ///calling \ref minCut(). (\ref minMinCut() and \ref maxMinCut() writes  | 
    51   ///the inclusionwise minimum and maximum of the minimum value cuts,  | 
    52   ///the inclusionwise minimum and maximum of the minimum value cuts,  | 
    52   ///resp.)  | 
    53   ///resp.)  | 
    94     ///- \c GEN_FLOW: any flow, i.e. the sum of the in-flows equals to  | 
    95     ///- \c GEN_FLOW: any flow, i.e. the sum of the in-flows equals to  | 
    95     ///the sum of the out-flows in every node except the \e source and  | 
    96     ///the sum of the out-flows in every node except the \e source and  | 
    96     ///the \e target.  | 
    97     ///the \e target.  | 
    97     ///- \c PRE_FLOW: any preflow, i.e. the sum of the in-flows is at   | 
    98     ///- \c PRE_FLOW: any preflow, i.e. the sum of the in-flows is at   | 
    98     ///least the sum of the out-flows in every node except the \e source.  | 
    99     ///least the sum of the out-flows in every node except the \e source.  | 
    99     ///- \c NO_FLOW: indicates an unspecified edge map. \ref flow will be   | 
   100     ///- \c NO_FLOW: indicates an unspecified edge map. \c flow will be   | 
   100     ///set to the constant zero flow in the beginning of the algorithm in this case.  | 
   101     ///set to the constant zero flow in the beginning of  | 
         | 
   102     ///the algorithm in this case.  | 
   101     ///  | 
   103     ///  | 
   102     enum FlowEnum{ | 
   104     enum FlowEnum{ | 
   103       NO_FLOW,  | 
   105       NO_FLOW,  | 
   104       ZERO_FLOW,  | 
   106       ZERO_FLOW,  | 
   105       GEN_FLOW,  | 
   107       GEN_FLOW,  | 
   192   | 
   194   | 
   193     ///The preflow algorithm consists of two phases, this method runs the  | 
   195     ///The preflow algorithm consists of two phases, this method runs the  | 
   194     ///first phase. After the first phase the maximum flow value and a  | 
   196     ///first phase. After the first phase the maximum flow value and a  | 
   195     ///minimum value cut can already be computed, though a maximum flow  | 
   197     ///minimum value cut can already be computed, though a maximum flow  | 
   196     ///is not yet obtained. So after calling this method \ref flowValue  | 
   198     ///is not yet obtained. So after calling this method \ref flowValue  | 
   197     ///and \ref actMinCut gives proper results.  | 
   199     ///and \ref MinCut() gives proper results.  | 
   198     ///\warning \ref minCut, \ref minMinCut and \ref maxMinCut do not  | 
   200     ///\warning \ref minCut(), \ref minMinCut() and \ref maxMinCut() do not  | 
   199     ///give minimum value cuts unless calling \ref phase2.  | 
   201     ///give minimum value cuts unless calling \ref phase2().  | 
   200     void phase1()  | 
   202     void phase1()  | 
   201     { | 
   203     { | 
   202       int heur0=(int)(H0*n);  //time while running 'bound decrease'  | 
   204       int heur0=(int)(H0*n);  //time while running 'bound decrease'  | 
   203       int heur1=(int)(H1*n);  //time while running 'highest label'  | 
   205       int heur1=(int)(H1*n);  //time while running 'highest label'  | 
   204       int heur=heur1;         //starting time interval (#of relabels)  | 
   206       int heur=heur1;         //starting time interval (#of relabels)  | 
   347     }  | 
   349     }  | 
   348   | 
   350   | 
   349     /// Returns the value of the maximum flow.  | 
   351     /// Returns the value of the maximum flow.  | 
   350   | 
   352   | 
   351     /// Returns the value of the maximum flow by returning the excess  | 
   353     /// Returns the value of the maximum flow by returning the excess  | 
   352     /// of the target node \ref t. This value equals to the value of  | 
   354     /// of the target node \c t. This value equals to the value of  | 
   353     /// the maximum flow already after running \ref phase1.  | 
   355     /// the maximum flow already after running \ref phase1.  | 
   354     Num flowValue() const { | 
   356     Num flowValue() const { | 
   355       return excess[t];  | 
   357       return excess[t];  | 
   356     }  | 
   358     }  | 
   357   | 
   359   | 
   360   | 
   362   | 
   361     ///Sets \c M to the characteristic vector of a minimum value  | 
   363     ///Sets \c M to the characteristic vector of a minimum value  | 
   362     ///cut. This method can be called both after running \ref  | 
   364     ///cut. This method can be called both after running \ref  | 
   363     ///phase1 and \ref phase2. It is much faster after  | 
   365     ///phase1 and \ref phase2. It is much faster after  | 
   364     ///\ref phase1.  \pre M should be a bool-valued node-map. \pre  | 
   366     ///\ref phase1.  \pre M should be a bool-valued node-map. \pre  | 
   365     ///If \ref mincut is called after \ref phase2 then M should  | 
   367     ///If \ref minCut() is called after \ref phase2() then M should  | 
   366     ///be initialized to false.  | 
   368     ///be initialized to false.  | 
   367     template<typename _CutMap>  | 
   369     template<typename _CutMap>  | 
   368     void minCut(_CutMap& M) const { | 
   370     void minCut(_CutMap& M) const { | 
   369       switch ( status ) { | 
   371       switch ( status ) { | 
   370 	case AFTER_PREFLOW_PHASE_1:  | 
   372 	case AFTER_PREFLOW_PHASE_1:  | 
   423     ///Returns the inclusionwise maximum of the minimum value cuts.  | 
   425     ///Returns the inclusionwise maximum of the minimum value cuts.  | 
   424   | 
   426   | 
   425     ///Sets \c M to the characteristic vector of the minimum value cut  | 
   427     ///Sets \c M to the characteristic vector of the minimum value cut  | 
   426     ///which is inclusionwise maximum. It is computed by processing a  | 
   428     ///which is inclusionwise maximum. It is computed by processing a  | 
   427     ///backward bfs from the target node \c t in the residual graph.  | 
   429     ///backward bfs from the target node \c t in the residual graph.  | 
   428     ///\pre \ref phase2() or preflow() should already be run.  | 
   430     ///\pre \ref phase2() or run() should already be run.  | 
   429     template<typename _CutMap>  | 
   431     template<typename _CutMap>  | 
   430     void maxMinCut(_CutMap& M) const { | 
   432     void maxMinCut(_CutMap& M) const { | 
   431   | 
   433   | 
   432       for(NodeIt v(*g) ; v!=INVALID; ++v) M.set(v, true);  | 
   434       for(NodeIt v(*g) ; v!=INVALID; ++v) M.set(v, true);  | 
   433   | 
   435   |