lemon/preflow.h
changeset 1176 2e0c2c25d63e
parent 1092 dceba191c00d
     1.1 --- a/lemon/preflow.h	Wed Oct 17 18:56:08 2018 +0200
     1.2 +++ b/lemon/preflow.h	Wed Oct 17 18:56:32 2018 +0200
     1.3 @@ -476,7 +476,7 @@
     1.4      /// Initializes the internal data structures and sets the initial
     1.5      /// flow to the given \c flowMap. The \c flowMap should contain a
     1.6      /// flow or at least a preflow, i.e. at each node excluding the
     1.7 -    /// source node the incoming flow should greater or equal to the
     1.8 +    /// source node the incoming flow should be greater or equal to the
     1.9      /// outgoing flow.
    1.10      /// \return \c false if the given \c flowMap is not a preflow.
    1.11      template <typename FlowMap>
    1.12 @@ -495,7 +495,7 @@
    1.13          for (OutArcIt e(_graph, n); e != INVALID; ++e) {
    1.14            excess -= (*_flow)[e];
    1.15          }
    1.16 -        if (excess < 0 && n != _source) return false;
    1.17 +        if (_tolerance.negative(excess) && n != _source) return false;
    1.18          (*_excess)[n] = excess;
    1.19        }
    1.20  
    1.21 @@ -639,7 +639,7 @@
    1.22  
    1.23            (*_excess)[n] = excess;
    1.24  
    1.25 -          if (excess != 0) {
    1.26 +          if (_tolerance.nonZero(excess)) {
    1.27              if (new_level + 1 < _level->maxLevel()) {
    1.28                _level->liftHighestActive(new_level + 1);
    1.29              } else {
    1.30 @@ -720,7 +720,7 @@
    1.31  
    1.32            (*_excess)[n] = excess;
    1.33  
    1.34 -          if (excess != 0) {
    1.35 +          if (_tolerance.nonZero(excess)) {
    1.36              if (new_level + 1 < _level->maxLevel()) {
    1.37                _level->liftActiveOn(level, new_level + 1);
    1.38              } else {
    1.39 @@ -791,7 +791,7 @@
    1.40        for (NodeIt n(_graph); n != INVALID; ++n) {
    1.41          if (!reached[n]) {
    1.42            _level->dirtyTopButOne(n);
    1.43 -        } else if ((*_excess)[n] > 0 && _target != n) {
    1.44 +        } else if (_tolerance.positive((*_excess)[n]) && _target != n) {
    1.45            _level->activate(n);
    1.46          }
    1.47        }
    1.48 @@ -852,7 +852,7 @@
    1.49  
    1.50          (*_excess)[n] = excess;
    1.51  
    1.52 -        if (excess != 0) {
    1.53 +        if (_tolerance.nonZero(excess)) {
    1.54            if (new_level + 1 < _level->maxLevel()) {
    1.55              _level->liftHighestActive(new_level + 1);
    1.56            } else {