lemon/preflow.h
changeset 952 98961d3556a7
parent 892 a22b3f1bf83e
parent 923 30d5f950aa5f
child 966 c8fce9beb46a
equal deleted inserted replaced
24:fd570853c214 26:8a8888041e19
   541         if (_tolerance.positive(rem)) {
   541         if (_tolerance.positive(rem)) {
   542           Node u = _graph.target(e);
   542           Node u = _graph.target(e);
   543           if ((*_level)[u] == _level->maxLevel()) continue;
   543           if ((*_level)[u] == _level->maxLevel()) continue;
   544           _flow->set(e, (*_capacity)[e]);
   544           _flow->set(e, (*_capacity)[e]);
   545           (*_excess)[u] += rem;
   545           (*_excess)[u] += rem;
   546           if (u != _target && !_level->active(u)) {
       
   547             _level->activate(u);
       
   548           }
       
   549         }
   546         }
   550       }
   547       }
   551       for (InArcIt e(_graph, _source); e != INVALID; ++e) {
   548       for (InArcIt e(_graph, _source); e != INVALID; ++e) {
   552         Value rem = (*_flow)[e];
   549         Value rem = (*_flow)[e];
   553         if (_tolerance.positive(rem)) {
   550         if (_tolerance.positive(rem)) {
   554           Node v = _graph.source(e);
   551           Node v = _graph.source(e);
   555           if ((*_level)[v] == _level->maxLevel()) continue;
   552           if ((*_level)[v] == _level->maxLevel()) continue;
   556           _flow->set(e, 0);
   553           _flow->set(e, 0);
   557           (*_excess)[v] += rem;
   554           (*_excess)[v] += rem;
   558           if (v != _target && !_level->active(v)) {
   555         }
   559             _level->activate(v);
   556       }
   560           }
   557       for (NodeIt n(_graph); n != INVALID; ++n) 
   561         }
   558         if(n!=_source && n!=_target && _tolerance.positive((*_excess)[n]))
   562       }
   559           _level->activate(n);
       
   560           
   563       return true;
   561       return true;
   564     }
   562     }
   565 
   563 
   566     /// \brief Starts the first phase of the preflow algorithm.
   564     /// \brief Starts the first phase of the preflow algorithm.
   567     ///
   565     ///