lemon/preflow.h
changeset 2387 317b9a88c350
parent 2386 81b47fc5c444
child 2391 14a343be7a5a
equal deleted inserted replaced
19:9e989f7a250b 20:f66eeda6af1a
    57   ///
    57   ///
    58   ///\param Graph The directed graph type the algorithm runs on.
    58   ///\param Graph The directed graph type the algorithm runs on.
    59   ///\param Num The number type of the capacities and the flow values.
    59   ///\param Num The number type of the capacities and the flow values.
    60   ///\param CapacityMap The capacity map type.
    60   ///\param CapacityMap The capacity map type.
    61   ///\param FlowMap The flow map type.
    61   ///\param FlowMap The flow map type.
    62   ///\param Tolerance The tolerance type. 
    62   ///\param Tol The tolerance type. 
    63   ///
    63   ///
    64   ///\author Jacint Szabo 
    64   ///\author Jacint Szabo 
    65   ///\todo Second template parameter is superfluous
    65   ///\todo Second template parameter is superfluous
    66   template <typename Graph, typename Num,
    66   template <typename Graph, typename Num,
    67 	    typename CapacityMap=typename Graph::template EdgeMap<Num>,
    67 	    typename CapacityMap=typename Graph::template EdgeMap<Num>,
    68             typename FlowMap=typename Graph::template EdgeMap<Num>,
    68             typename FlowMap=typename Graph::template EdgeMap<Num>,
    69 	    typename Tolerance=Tolerance<Num> >
    69 	    typename Tol=Tolerance<Num> >
    70   class Preflow {
    70   class Preflow {
    71   protected:
    71   protected:
    72     typedef typename Graph::Node Node;
    72     typedef typename Graph::Node Node;
    73     typedef typename Graph::NodeIt NodeIt;
    73     typedef typename Graph::NodeIt NodeIt;
    74     typedef typename Graph::EdgeIt EdgeIt;
    74     typedef typename Graph::EdgeIt EdgeIt;
    82     Node _source;
    82     Node _source;
    83     Node _target;
    83     Node _target;
    84     const CapacityMap* _capacity;
    84     const CapacityMap* _capacity;
    85     FlowMap* _flow;
    85     FlowMap* _flow;
    86 
    86 
    87     Tolerance _surely;
    87     Tol _surely;
    88     
    88     
    89     int _node_num;      //the number of nodes of G
    89     int _node_num;      //the number of nodes of G
    90     
    90     
    91     typename Graph::template NodeMap<int> level;  
    91     typename Graph::template NodeMap<int> level;  
    92     typename Graph::template NodeMap<Num> excess;
    92     typename Graph::template NodeMap<Num> excess;
   153     ///\param _gr The directed graph the algorithm runs on. 
   153     ///\param _gr The directed graph the algorithm runs on. 
   154     ///\param _s The source node.
   154     ///\param _s The source node.
   155     ///\param _t The target node.
   155     ///\param _t The target node.
   156     ///\param _cap The capacity of the edges. 
   156     ///\param _cap The capacity of the edges. 
   157     ///\param _f The flow of the edges. 
   157     ///\param _f The flow of the edges. 
   158     ///\param _sr Tolerance class.
   158     ///\param _sr Tol class.
   159     ///Except the graph, all of these parameters can be reset by
   159     ///Except the graph, all of these parameters can be reset by
   160     ///calling \ref source, \ref target, \ref capacityMap and \ref
   160     ///calling \ref source, \ref target, \ref capacityMap and \ref
   161     ///flowMap, resp.
   161     ///flowMap, resp.
   162     Preflow(const Graph& _gr, Node _s, Node _t, 
   162     Preflow(const Graph& _gr, Node _s, Node _t, 
   163             const CapacityMap& _cap, FlowMap& _f,
   163             const CapacityMap& _cap, FlowMap& _f,
   164             const Tolerance &_sr=Tolerance()) :
   164             const Tol &_sr=Tol()) :
   165 	_g(&_gr), _source(_s), _target(_t), _capacity(&_cap),
   165 	_g(&_gr), _source(_s), _target(_t), _capacity(&_cap),
   166 	_flow(&_f), _surely(_sr),
   166 	_flow(&_f), _surely(_sr),
   167 	_node_num(countNodes(_gr)), level(_gr), excess(_gr,0), 
   167 	_node_num(countNodes(_gr)), level(_gr), excess(_gr,0), 
   168 	flow_prop(NO_FLOW), status(AFTER_NOTHING) { 
   168 	flow_prop(NO_FLOW), status(AFTER_NOTHING) { 
   169 	if ( _source==_target )
   169 	if ( _source==_target )
   172     
   172     
   173     ///Give a reference to the tolerance handler class
   173     ///Give a reference to the tolerance handler class
   174 
   174 
   175     ///Give a reference to the tolerance handler class
   175     ///Give a reference to the tolerance handler class
   176     ///\sa Tolerance
   176     ///\sa Tolerance
   177     Tolerance &tolerance() { return _surely; }
   177     Tol &tolerance() { return _surely; }
   178 
   178 
   179     ///Runs the preflow algorithm.  
   179     ///Runs the preflow algorithm.  
   180 
   180 
   181     ///Runs the preflow algorithm.
   181     ///Runs the preflow algorithm.
   182     ///
   182     ///