lemon/preflow.h
changeset 1924 9fdc893e2199
parent 1875 98698b69a902
child 1953 d4f411003580
equal deleted inserted replaced
7:50b65fb6d468 8:f3b9f936df84
   106     
   106     
   107     
   107     
   108     ///Indicates the property of the starting flow map.
   108     ///Indicates the property of the starting flow map.
   109     
   109     
   110     ///Indicates the property of the starting flow map.
   110     ///Indicates the property of the starting flow map.
   111     ///The meanings are as follows:
       
   112     ///- \c ZERO_FLOW: constant zero flow
       
   113     ///- \c GEN_FLOW: any flow, i.e. the sum of the in-flows equals to
       
   114     ///the sum of the out-flows in every node except the \e source and
       
   115     ///the \e target.
       
   116     ///- \c PRE_FLOW: any preflow, i.e. the sum of the in-flows is at 
       
   117     ///least the sum of the out-flows in every node except the \e source.
       
   118     ///- \c NO_FLOW: indicates an unspecified edge map. \c flow will be 
       
   119     ///set to the constant zero flow in the beginning of
       
   120     ///the algorithm in this case.
       
   121     ///
   111     ///
   122     enum FlowEnum{
   112     enum FlowEnum{
       
   113       ///indicates an unspecified edge map. \c flow will be 
       
   114       ///set to the constant zero flow in the beginning of
       
   115       ///the algorithm in this case.
   123       NO_FLOW,
   116       NO_FLOW,
       
   117       ///constant zero flow
   124       ZERO_FLOW,
   118       ZERO_FLOW,
       
   119       ///any flow, i.e. the sum of the in-flows equals to
       
   120       ///the sum of the out-flows in every node except the \c source and
       
   121       ///the \c target.
   125       GEN_FLOW,
   122       GEN_FLOW,
       
   123       ///any preflow, i.e. the sum of the in-flows is at 
       
   124       ///least the sum of the out-flows in every node except the \c source.
   126       PRE_FLOW
   125       PRE_FLOW
   127     };
   126     };
   128 
   127 
   129     ///Indicates the state of the preflow algorithm.
   128     ///Indicates the state of the preflow algorithm.
   130 
   129 
   131     ///Indicates the state of the preflow algorithm.
   130     ///Indicates the state of the preflow algorithm.
   132     ///The meanings are as follows:
       
   133     ///- \c AFTER_NOTHING: before running the algorithm or
       
   134     ///  at an unspecified state.
       
   135     ///- \c AFTER_PREFLOW_PHASE_1: right after running \c phase1
       
   136     ///- \c AFTER_PREFLOW_PHASE_2: after running \ref phase2()
       
   137     ///
   131     ///
   138     enum StatusEnum {
   132     enum StatusEnum {
       
   133       ///before running the algorithm or
       
   134       ///at an unspecified state.
   139       AFTER_NOTHING,
   135       AFTER_NOTHING,
       
   136       ///right after running \ref phase1()
   140       AFTER_PREFLOW_PHASE_1,      
   137       AFTER_PREFLOW_PHASE_1,      
       
   138       ///after running \ref phase2()
   141       AFTER_PREFLOW_PHASE_2
   139       AFTER_PREFLOW_PHASE_2
   142     };
   140     };
   143     
   141     
   144   protected: 
   142   protected: 
   145     FlowEnum flow_prop;
   143     FlowEnum flow_prop;
   166 	flow_prop(NO_FLOW), status(AFTER_NOTHING) { 
   164 	flow_prop(NO_FLOW), status(AFTER_NOTHING) { 
   167 	if ( _source==_target )
   165 	if ( _source==_target )
   168 	  throw InvalidArgument();
   166 	  throw InvalidArgument();
   169       }
   167       }
   170     
   168     
   171 
   169     ///Give a reference to the tolerance handler class
   172                                                                               
   170 
       
   171     ///Give a reference to the tolerance handler class
       
   172     ///\sa Tolerance
       
   173     TOL &tolerance() { return surely; }
       
   174 
   173     ///Runs the preflow algorithm.  
   175     ///Runs the preflow algorithm.  
   174 
   176 
   175     ///Runs the preflow algorithm.
   177     ///Runs the preflow algorithm.
   176     ///
   178     ///
   177     void run() {
   179     void run() {