lemon/preflow.h
changeset 967 63fd58460c39
parent 891 bb70ad62c95f
child 924 a80381c43760
child 964 2b6bffe0e7e8
equal deleted inserted replaced
23:5556ff6c75ed 25:76e7a61787e6
   523         if (_tolerance.positive(rem)) {
   523         if (_tolerance.positive(rem)) {
   524           Node u = _graph.target(e);
   524           Node u = _graph.target(e);
   525           if ((*_level)[u] == _level->maxLevel()) continue;
   525           if ((*_level)[u] == _level->maxLevel()) continue;
   526           _flow->set(e, (*_capacity)[e]);
   526           _flow->set(e, (*_capacity)[e]);
   527           (*_excess)[u] += rem;
   527           (*_excess)[u] += rem;
   528           if (u != _target && !_level->active(u)) {
       
   529             _level->activate(u);
       
   530           }
       
   531         }
   528         }
   532       }
   529       }
   533       for (InArcIt e(_graph, _source); e != INVALID; ++e) {
   530       for (InArcIt e(_graph, _source); e != INVALID; ++e) {
   534         Value rem = (*_flow)[e];
   531         Value rem = (*_flow)[e];
   535         if (_tolerance.positive(rem)) {
   532         if (_tolerance.positive(rem)) {
   536           Node v = _graph.source(e);
   533           Node v = _graph.source(e);
   537           if ((*_level)[v] == _level->maxLevel()) continue;
   534           if ((*_level)[v] == _level->maxLevel()) continue;
   538           _flow->set(e, 0);
   535           _flow->set(e, 0);
   539           (*_excess)[v] += rem;
   536           (*_excess)[v] += rem;
   540           if (v != _target && !_level->active(v)) {
   537         }
   541             _level->activate(v);
   538       }
   542           }
   539       for (NodeIt n(_graph); n != INVALID; ++n) 
   543         }
   540         if(n!=_source && n!=_target && _tolerance.positive((*_excess)[n]))
   544       }
   541           _level->activate(n);
       
   542           
   545       return true;
   543       return true;
   546     }
   544     }
   547 
   545 
   548     /// \brief Starts the first phase of the preflow algorithm.
   546     /// \brief Starts the first phase of the preflow algorithm.
   549     ///
   547     ///