lemon/circulation.h
changeset 641 756a5ec551c8
parent 622 28f58740b6f8
child 688 1f08e846df29
child 713 4ac30454f1c1
     1.1 --- a/lemon/circulation.h	Wed Apr 29 03:15:24 2009 +0200
     1.2 +++ b/lemon/circulation.h	Wed Apr 29 14:25:51 2009 +0200
     1.3 @@ -64,15 +64,15 @@
     1.4      /// It must conform to the \ref concepts::ReadMap "ReadMap" concept.
     1.5      typedef SM SupplyMap;
     1.6  
     1.7 -    /// \brief The type of the flow values.
     1.8 -    typedef typename SupplyMap::Value Flow;
     1.9 +    /// \brief The type of the flow and supply values.
    1.10 +    typedef typename SupplyMap::Value Value;
    1.11  
    1.12      /// \brief The type of the map that stores the flow values.
    1.13      ///
    1.14      /// The type of the map that stores the flow values.
    1.15      /// It must conform to the \ref concepts::ReadWriteMap "ReadWriteMap"
    1.16      /// concept.
    1.17 -    typedef typename Digraph::template ArcMap<Flow> FlowMap;
    1.18 +    typedef typename Digraph::template ArcMap<Value> FlowMap;
    1.19  
    1.20      /// \brief Instantiates a FlowMap.
    1.21      ///
    1.22 @@ -104,7 +104,7 @@
    1.23      /// \brief The tolerance used by the algorithm
    1.24      ///
    1.25      /// The tolerance used by the algorithm to handle inexact computation.
    1.26 -    typedef lemon::Tolerance<Flow> Tolerance;
    1.27 +    typedef lemon::Tolerance<Value> Tolerance;
    1.28  
    1.29    };
    1.30  
    1.31 @@ -187,8 +187,8 @@
    1.32      typedef TR Traits;
    1.33      ///The type of the digraph the algorithm runs on.
    1.34      typedef typename Traits::Digraph Digraph;
    1.35 -    ///The type of the flow values.
    1.36 -    typedef typename Traits::Flow Flow;
    1.37 +    ///The type of the flow and supply values.
    1.38 +    typedef typename Traits::Value Value;
    1.39  
    1.40      ///The type of the lower bound map.
    1.41      typedef typename Traits::LowerMap LowerMap;
    1.42 @@ -221,7 +221,7 @@
    1.43      Elevator* _level;
    1.44      bool _local_level;
    1.45  
    1.46 -    typedef typename Digraph::template NodeMap<Flow> ExcessMap;
    1.47 +    typedef typename Digraph::template NodeMap<Value> ExcessMap;
    1.48      ExcessMap* _excess;
    1.49  
    1.50      Tolerance _tol;
    1.51 @@ -530,7 +530,7 @@
    1.52            (*_excess)[_g.target(e)] += (*_lo)[e];
    1.53            (*_excess)[_g.source(e)] -= (*_lo)[e];
    1.54          } else {
    1.55 -          Flow fc = -(*_excess)[_g.target(e)];
    1.56 +          Value fc = -(*_excess)[_g.target(e)];
    1.57            _flow->set(e, fc);
    1.58            (*_excess)[_g.target(e)] = 0;
    1.59            (*_excess)[_g.source(e)] -= fc;
    1.60 @@ -563,11 +563,11 @@
    1.61        while((act=_level->highestActive())!=INVALID) {
    1.62          int actlevel=(*_level)[act];
    1.63          int mlevel=_node_num;
    1.64 -        Flow exc=(*_excess)[act];
    1.65 +        Value exc=(*_excess)[act];
    1.66  
    1.67          for(OutArcIt e(_g,act);e!=INVALID; ++e) {
    1.68            Node v = _g.target(e);
    1.69 -          Flow fc=(*_up)[e]-(*_flow)[e];
    1.70 +          Value fc=(*_up)[e]-(*_flow)[e];
    1.71            if(!_tol.positive(fc)) continue;
    1.72            if((*_level)[v]<actlevel) {
    1.73              if(!_tol.less(fc, exc)) {
    1.74 @@ -591,7 +591,7 @@
    1.75          }
    1.76          for(InArcIt e(_g,act);e!=INVALID; ++e) {
    1.77            Node v = _g.source(e);
    1.78 -          Flow fc=(*_flow)[e]-(*_lo)[e];
    1.79 +          Value fc=(*_flow)[e]-(*_lo)[e];
    1.80            if(!_tol.positive(fc)) continue;
    1.81            if((*_level)[v]<actlevel) {
    1.82              if(!_tol.less(fc, exc)) {
    1.83 @@ -661,13 +661,13 @@
    1.84  
    1.85      ///@{
    1.86  
    1.87 -    /// \brief Returns the flow on the given arc.
    1.88 +    /// \brief Returns the flow value on the given arc.
    1.89      ///
    1.90 -    /// Returns the flow on the given arc.
    1.91 +    /// Returns the flow value on the given arc.
    1.92      ///
    1.93      /// \pre Either \ref run() or \ref init() must be called before
    1.94      /// using this function.
    1.95 -    Flow flow(const Arc& arc) const {
    1.96 +    Value flow(const Arc& arc) const {
    1.97        return (*_flow)[arc];
    1.98      }
    1.99  
   1.100 @@ -750,7 +750,7 @@
   1.101          if((*_flow)[e]<(*_lo)[e]||(*_flow)[e]>(*_up)[e]) return false;
   1.102        for(NodeIt n(_g);n!=INVALID;++n)
   1.103          {
   1.104 -          Flow dif=-(*_supply)[n];
   1.105 +          Value dif=-(*_supply)[n];
   1.106            for(InArcIt e(_g,n);e!=INVALID;++e) dif-=(*_flow)[e];
   1.107            for(OutArcIt e(_g,n);e!=INVALID;++e) dif+=(*_flow)[e];
   1.108            if(_tol.negative(dif)) return false;
   1.109 @@ -765,10 +765,10 @@
   1.110      ///\sa barrierMap()
   1.111      bool checkBarrier() const
   1.112      {
   1.113 -      Flow delta=0;
   1.114 -      Flow inf_cap = std::numeric_limits<Flow>::has_infinity ?
   1.115 -        std::numeric_limits<Flow>::infinity() :
   1.116 -        std::numeric_limits<Flow>::max();
   1.117 +      Value delta=0;
   1.118 +      Value inf_cap = std::numeric_limits<Value>::has_infinity ?
   1.119 +        std::numeric_limits<Value>::infinity() :
   1.120 +        std::numeric_limits<Value>::max();
   1.121        for(NodeIt n(_g);n!=INVALID;++n)
   1.122          if(barrier(n))
   1.123            delta-=(*_supply)[n];