Index: lemon/preflow.h
===================================================================
--- lemon/preflow.h	(revision 985)
+++ lemon/preflow.h	(revision 1027)
@@ -3,5 +3,5 @@
  * This file is a part of LEMON, a generic C++ optimization library.
  *
- * Copyright (C) 2003-2010
+ * Copyright (C) 2003-2009
  * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
  * (Egervary Research Group on Combinatorial Optimization, EGRES).
@@ -53,9 +53,5 @@
     /// The type of the map that stores the flow values.
     /// It must meet the \ref concepts::ReadWriteMap "ReadWriteMap" concept.
-#ifdef DOXYGEN
-    typedef GR::ArcMap<Value> FlowMap;
-#else
     typedef typename Digraph::template ArcMap<Value> FlowMap;
-#endif
 
     /// \brief Instantiates a FlowMap.
@@ -72,10 +68,7 @@
     /// The elevator type used by Preflow algorithm.
     ///
-    /// \sa Elevator, LinkedElevator
-#ifdef DOXYGEN
-    typedef lemon::Elevator<GR, GR::Node> Elevator;
-#else
-    typedef lemon::Elevator<Digraph, typename Digraph::Node> Elevator;
-#endif
+    /// \sa Elevator
+    /// \sa LinkedElevator
+    typedef LinkedElevator<Digraph, typename Digraph::Node> Elevator;
 
     /// \brief Instantiates an Elevator.
@@ -103,8 +96,7 @@
   /// This class provides an implementation of Goldberg-Tarjan's \e preflow
   /// \e push-relabel algorithm producing a \ref max_flow
-  /// "flow of maximum value" in a digraph \ref clrs01algorithms,
-  /// \ref amo93networkflows, \ref goldberg88newapproach.
+  /// "flow of maximum value" in a digraph.
   /// The preflow algorithms are the fastest known maximum
-  /// flow algorithms. The current implementation uses a mixture of the
+  /// flow algorithms. The current implementation use a mixture of the
   /// \e "highest label" and the \e "bound decrease" heuristics.
   /// The worst case time complexity of the algorithm is \f$O(n^2\sqrt{e})\f$.
@@ -114,15 +106,7 @@
   /// second phase constructs a feasible maximum flow on each arc.
   ///
-  /// \warning This implementation cannot handle infinite or very large
-  /// capacities (e.g. the maximum value of \c CAP::Value).
-  ///
   /// \tparam GR The type of the digraph the algorithm runs on.
   /// \tparam CAP The type of the capacity map. The default map
   /// type is \ref concepts::Digraph::ArcMap "GR::ArcMap<int>".
-  /// \tparam TR The traits class that defines various types used by the
-  /// algorithm. By default, it is \ref PreflowDefaultTraits
-  /// "PreflowDefaultTraits<GR, CAP>".
-  /// In most cases, this parameter should not be set directly,
-  /// consider to use the named template parameters instead.
 #ifdef DOXYGEN
   template <typename GR, typename CAP, typename TR>
@@ -274,5 +258,5 @@
     /// able to automatically created by the algorithm (i.e. the
     /// digraph and the maximum level should be passed to it).
-    /// However, an external elevator object could also be passed to the
+    /// However an external elevator object could also be passed to the
     /// algorithm with the \ref elevator(Elevator&) "elevator()" function
     /// before calling \ref run() or \ref init().
@@ -388,8 +372,7 @@
     }
 
-    /// \brief Sets the tolerance used by the algorithm.
-    ///
-    /// Sets the tolerance object used by the algorithm.
-    /// \return <tt>(*this)</tt>
+    /// \brief Sets the tolerance used by algorithm.
+    ///
+    /// Sets the tolerance used by algorithm.
     Preflow& tolerance(const Tolerance& tolerance) {
       _tolerance = tolerance;
@@ -399,6 +382,5 @@
     /// \brief Returns a const reference to the tolerance.
     ///
-    /// Returns a const reference to the tolerance object used by
-    /// the algorithm.
+    /// Returns a const reference to the tolerance.
     const Tolerance& tolerance() const {
       return _tolerance;
@@ -408,6 +390,6 @@
     /// The simplest way to execute the preflow algorithm is to use
     /// \ref run() or \ref runMinCut().\n
-    /// If you need better control on the initial solution or the execution,
-    /// you have to call one of the \ref init() functions first, then
+    /// If you need more control on the initial solution or the execution,
+    /// first you have to call one of the \ref init() functions, then
     /// \ref startFirstPhase() and if you need it \ref startSecondPhase().
 
@@ -544,7 +526,4 @@
           _flow->set(e, (*_capacity)[e]);
           (*_excess)[u] += rem;
-          if (u != _target && !_level->active(u)) {
-            _level->activate(u);
-          }
         }
       }
@@ -556,9 +535,10 @@
           _flow->set(e, 0);
           (*_excess)[v] += rem;
-          if (v != _target && !_level->active(v)) {
-            _level->activate(v);
-          }
-        }
-      }
+        }
+      }
+      for (NodeIt n(_graph); n != INVALID; ++n) 
+        if(n!=_source && n!=_target && _tolerance.positive((*_excess)[n]))
+          _level->activate(n);
+          
       return true;
     }
