Index: lemon/preflow.h
===================================================================
--- lemon/preflow.h	(revision 581)
+++ lemon/preflow.h	(revision 610)
@@ -33,6 +33,6 @@
   /// Default traits class of Preflow class.
   /// \tparam GR Digraph type.
-  /// \tparam CAP Capacity map type.
-  template <typename GR, typename CAP>
+  /// \tparam CM Capacity map type.
+  template <typename GR, typename CM>
   struct PreflowDefaultTraits {
 
@@ -44,8 +44,8 @@
     /// The type of the map that stores the arc capacities.
     /// It must meet the \ref concepts::ReadMap "ReadMap" concept.
-    typedef CAP CapacityMap;
+    typedef CM CapacityMap;
 
     /// \brief The type of the flow values.
-    typedef typename CapacityMap::Value Value;
+    typedef typename CapacityMap::Value Flow;
 
     /// \brief The type of the map that stores the flow values.
@@ -53,10 +53,10 @@
     /// The type of the map that stores the flow values.
     /// It must meet the \ref concepts::ReadWriteMap "ReadWriteMap" concept.
-    typedef typename Digraph::template ArcMap<Value> FlowMap;
+    typedef typename Digraph::template ArcMap<Flow> FlowMap;
 
     /// \brief Instantiates a FlowMap.
     ///
     /// This function instantiates a \ref FlowMap.
-    /// \param digraph The digraph, to which we would like to define
+    /// \param digraph The digraph for which we would like to define
     /// the flow map.
     static FlowMap* createFlowMap(const Digraph& digraph) {
@@ -75,5 +75,5 @@
     ///
     /// This function instantiates an \ref Elevator.
-    /// \param digraph The digraph, to which we would like to define
+    /// \param digraph The digraph for which we would like to define
     /// the elevator.
     /// \param max_level The maximum level of the elevator.
@@ -85,5 +85,5 @@
     ///
     /// The tolerance used by the algorithm to handle inexact computation.
-    typedef lemon::Tolerance<Value> Tolerance;
+    typedef lemon::Tolerance<Flow> Tolerance;
 
   };
@@ -95,7 +95,6 @@
   ///
   /// 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.
-  /// The preflow algorithms are the fastest known maximum
+  /// \e push-relabel algorithm producing a flow of maximum value in a
+  /// digraph. The preflow algorithms are the fastest known maximum
   /// flow algorithms. The current implementation use a mixture of the
   /// \e "highest label" and the \e "bound decrease" heuristics.
@@ -107,12 +106,12 @@
   ///
   /// \tparam GR The type of the digraph the algorithm runs on.
-  /// \tparam CAP The type of the capacity map. The default map
+  /// \tparam CM The type of the capacity map. The default map
   /// type is \ref concepts::Digraph::ArcMap "GR::ArcMap<int>".
 #ifdef DOXYGEN
-  template <typename GR, typename CAP, typename TR>
+  template <typename GR, typename CM, typename TR>
 #else
   template <typename GR,
-            typename CAP = typename GR::template ArcMap<int>,
-            typename TR = PreflowDefaultTraits<GR, CAP> >
+            typename CM = typename GR::template ArcMap<int>,
+            typename TR = PreflowDefaultTraits<GR, CM> >
 #endif
   class Preflow {
@@ -126,5 +125,5 @@
     typedef typename Traits::CapacityMap CapacityMap;
     ///The type of the flow values.
-    typedef typename Traits::Value Value;
+    typedef typename Traits::Flow Flow;
 
     ///The type of the flow map.
@@ -152,5 +151,5 @@
     bool _local_level;
 
-    typedef typename Digraph::template NodeMap<Value> ExcessMap;
+    typedef typename Digraph::template NodeMap<Flow> ExcessMap;
     ExcessMap* _excess;
 
@@ -196,7 +195,7 @@
     ///@{
 
-    template <typename T>
+    template <typename _FlowMap>
     struct SetFlowMapTraits : public Traits {
-      typedef T FlowMap;
+      typedef _FlowMap FlowMap;
       static FlowMap *createFlowMap(const Digraph&) {
         LEMON_ASSERT(false, "FlowMap is not initialized");
@@ -210,14 +209,14 @@
     /// \ref named-templ-param "Named parameter" for setting FlowMap
     /// type.
-    template <typename T>
+    template <typename _FlowMap>
     struct SetFlowMap
-      : public Preflow<Digraph, CapacityMap, SetFlowMapTraits<T> > {
+      : public Preflow<Digraph, CapacityMap, SetFlowMapTraits<_FlowMap> > {
       typedef Preflow<Digraph, CapacityMap,
-                      SetFlowMapTraits<T> > Create;
+                      SetFlowMapTraits<_FlowMap> > Create;
     };
 
-    template <typename T>
+    template <typename _Elevator>
     struct SetElevatorTraits : public Traits {
-      typedef T Elevator;
+      typedef _Elevator Elevator;
       static Elevator *createElevator(const Digraph&, int) {
         LEMON_ASSERT(false, "Elevator is not initialized");
@@ -235,14 +234,14 @@
     /// \ref run() or \ref init().
     /// \sa SetStandardElevator
-    template <typename T>
+    template <typename _Elevator>
     struct SetElevator
-      : public Preflow<Digraph, CapacityMap, SetElevatorTraits<T> > {
+      : public Preflow<Digraph, CapacityMap, SetElevatorTraits<_Elevator> > {
       typedef Preflow<Digraph, CapacityMap,
-                      SetElevatorTraits<T> > Create;
+                      SetElevatorTraits<_Elevator> > Create;
     };
 
-    template <typename T>
+    template <typename _Elevator>
     struct SetStandardElevatorTraits : public Traits {
-      typedef T Elevator;
+      typedef _Elevator Elevator;
       static Elevator *createElevator(const Digraph& digraph, int max_level) {
         return new Elevator(digraph, max_level);
@@ -262,10 +261,10 @@
     /// before calling \ref run() or \ref init().
     /// \sa SetElevator
-    template <typename T>
+    template <typename _Elevator>
     struct SetStandardElevator
       : public Preflow<Digraph, CapacityMap,
-                       SetStandardElevatorTraits<T> > {
+                       SetStandardElevatorTraits<_Elevator> > {
       typedef Preflow<Digraph, CapacityMap,
-                      SetStandardElevatorTraits<T> > Create;
+                      SetStandardElevatorTraits<_Elevator> > Create;
     };
 
@@ -405,5 +404,5 @@
       _phase = true;
       for (NodeIt n(_graph); n != INVALID; ++n) {
-        (*_excess)[n] = 0;
+        _excess->set(n, 0);
       }
 
@@ -418,8 +417,8 @@
 
       std::vector<Node> queue;
-      reached[_source] = true;
+      reached.set(_source, true);
 
       queue.push_back(_target);
-      reached[_target] = true;
+      reached.set(_target, true);
       while (!queue.empty()) {
         _level->initNewLevel();
@@ -430,5 +429,5 @@
             Node u = _graph.source(e);
             if (!reached[u] && _tolerance.positive((*_capacity)[e])) {
-              reached[u] = true;
+              reached.set(u, true);
               _level->initAddItem(u);
               nqueue.push_back(u);
@@ -445,5 +444,5 @@
           if ((*_level)[u] == _level->maxLevel()) continue;
           _flow->set(e, (*_capacity)[e]);
-          (*_excess)[u] += (*_capacity)[e];
+          _excess->set(u, (*_excess)[u] + (*_capacity)[e]);
           if (u != _target && !_level->active(u)) {
             _level->activate(u);
@@ -471,5 +470,5 @@
 
       for (NodeIt n(_graph); n != INVALID; ++n) {
-        Value excess = 0;
+        Flow excess = 0;
         for (InArcIt e(_graph, n); e != INVALID; ++e) {
           excess += (*_flow)[e];
@@ -479,5 +478,5 @@
         }
         if (excess < 0 && n != _source) return false;
-        (*_excess)[n] = excess;
+        _excess->set(n, excess);
       }
 
@@ -488,8 +487,8 @@
 
       std::vector<Node> queue;
-      reached[_source] = true;
+      reached.set(_source, true);
 
       queue.push_back(_target);
-      reached[_target] = true;
+      reached.set(_target, true);
       while (!queue.empty()) {
         _level->initNewLevel();
@@ -501,5 +500,5 @@
             if (!reached[u] &&
                 _tolerance.positive((*_capacity)[e] - (*_flow)[e])) {
-              reached[u] = true;
+              reached.set(u, true);
               _level->initAddItem(u);
               nqueue.push_back(u);
@@ -509,5 +508,5 @@
             Node v = _graph.target(e);
             if (!reached[v] && _tolerance.positive((*_flow)[e])) {
-              reached[v] = true;
+              reached.set(v, true);
               _level->initAddItem(v);
               nqueue.push_back(v);
@@ -520,10 +519,10 @@
 
       for (OutArcIt e(_graph, _source); e != INVALID; ++e) {
-        Value rem = (*_capacity)[e] - (*_flow)[e];
+        Flow rem = (*_capacity)[e] - (*_flow)[e];
         if (_tolerance.positive(rem)) {
           Node u = _graph.target(e);
           if ((*_level)[u] == _level->maxLevel()) continue;
           _flow->set(e, (*_capacity)[e]);
-          (*_excess)[u] += rem;
+          _excess->set(u, (*_excess)[u] + rem);
           if (u != _target && !_level->active(u)) {
             _level->activate(u);
@@ -532,10 +531,10 @@
       }
       for (InArcIt e(_graph, _source); e != INVALID; ++e) {
-        Value rem = (*_flow)[e];
+        Flow rem = (*_flow)[e];
         if (_tolerance.positive(rem)) {
           Node v = _graph.source(e);
           if ((*_level)[v] == _level->maxLevel()) continue;
           _flow->set(e, 0);
-          (*_excess)[v] += rem;
+          _excess->set(v, (*_excess)[v] + rem);
           if (v != _target && !_level->active(v)) {
             _level->activate(v);
@@ -565,9 +564,9 @@
 
         while (num > 0 && n != INVALID) {
-          Value excess = (*_excess)[n];
+          Flow excess = (*_excess)[n];
           int new_level = _level->maxLevel();
 
           for (OutArcIt e(_graph, n); e != INVALID; ++e) {
-            Value rem = (*_capacity)[e] - (*_flow)[e];
+            Flow rem = (*_capacity)[e] - (*_flow)[e];
             if (!_tolerance.positive(rem)) continue;
             Node v = _graph.target(e);
@@ -578,10 +577,10 @@
               if (!_tolerance.less(rem, excess)) {
                 _flow->set(e, (*_flow)[e] + excess);
-                (*_excess)[v] += excess;
+                _excess->set(v, (*_excess)[v] + excess);
                 excess = 0;
                 goto no_more_push_1;
               } else {
                 excess -= rem;
-                (*_excess)[v] += rem;
+                _excess->set(v, (*_excess)[v] + rem);
                 _flow->set(e, (*_capacity)[e]);
               }
@@ -592,5 +591,5 @@
 
           for (InArcIt e(_graph, n); e != INVALID; ++e) {
-            Value rem = (*_flow)[e];
+            Flow rem = (*_flow)[e];
             if (!_tolerance.positive(rem)) continue;
             Node v = _graph.source(e);
@@ -601,10 +600,10 @@
               if (!_tolerance.less(rem, excess)) {
                 _flow->set(e, (*_flow)[e] - excess);
-                (*_excess)[v] += excess;
+                _excess->set(v, (*_excess)[v] + excess);
                 excess = 0;
                 goto no_more_push_1;
               } else {
                 excess -= rem;
-                (*_excess)[v] += rem;
+                _excess->set(v, (*_excess)[v] + rem);
                 _flow->set(e, 0);
               }
@@ -616,5 +615,5 @@
         no_more_push_1:
 
-          (*_excess)[n] = excess;
+          _excess->set(n, excess);
 
           if (excess != 0) {
@@ -638,9 +637,9 @@
         num = _node_num * 20;
         while (num > 0 && n != INVALID) {
-          Value excess = (*_excess)[n];
+          Flow excess = (*_excess)[n];
           int new_level = _level->maxLevel();
 
           for (OutArcIt e(_graph, n); e != INVALID; ++e) {
-            Value rem = (*_capacity)[e] - (*_flow)[e];
+            Flow rem = (*_capacity)[e] - (*_flow)[e];
             if (!_tolerance.positive(rem)) continue;
             Node v = _graph.target(e);
@@ -651,10 +650,10 @@
               if (!_tolerance.less(rem, excess)) {
                 _flow->set(e, (*_flow)[e] + excess);
-                (*_excess)[v] += excess;
+                _excess->set(v, (*_excess)[v] + excess);
                 excess = 0;
                 goto no_more_push_2;
               } else {
                 excess -= rem;
-                (*_excess)[v] += rem;
+                _excess->set(v, (*_excess)[v] + rem);
                 _flow->set(e, (*_capacity)[e]);
               }
@@ -665,5 +664,5 @@
 
           for (InArcIt e(_graph, n); e != INVALID; ++e) {
-            Value rem = (*_flow)[e];
+            Flow rem = (*_flow)[e];
             if (!_tolerance.positive(rem)) continue;
             Node v = _graph.source(e);
@@ -674,10 +673,10 @@
               if (!_tolerance.less(rem, excess)) {
                 _flow->set(e, (*_flow)[e] - excess);
-                (*_excess)[v] += excess;
+                _excess->set(v, (*_excess)[v] + excess);
                 excess = 0;
                 goto no_more_push_2;
               } else {
                 excess -= rem;
-                (*_excess)[v] += rem;
+                _excess->set(v, (*_excess)[v] + rem);
                 _flow->set(e, 0);
               }
@@ -689,5 +688,5 @@
         no_more_push_2:
 
-          (*_excess)[n] = excess;
+          _excess->set(n, excess);
 
           if (excess != 0) {
@@ -732,5 +731,5 @@
       typename Digraph::template NodeMap<bool> reached(_graph);
       for (NodeIt n(_graph); n != INVALID; ++n) {
-        reached[n] = (*_level)[n] < _level->maxLevel();
+        reached.set(n, (*_level)[n] < _level->maxLevel());
       }
 
@@ -740,5 +739,5 @@
       std::vector<Node> queue;
       queue.push_back(_source);
-      reached[_source] = true;
+      reached.set(_source, true);
 
       while (!queue.empty()) {
@@ -750,5 +749,5 @@
             Node v = _graph.target(e);
             if (!reached[v] && _tolerance.positive((*_flow)[e])) {
-              reached[v] = true;
+              reached.set(v, true);
               _level->initAddItem(v);
               nqueue.push_back(v);
@@ -759,5 +758,5 @@
             if (!reached[u] &&
                 _tolerance.positive((*_capacity)[e] - (*_flow)[e])) {
-              reached[u] = true;
+              reached.set(u, true);
               _level->initAddItem(u);
               nqueue.push_back(u);
@@ -779,10 +778,10 @@
       Node n;
       while ((n = _level->highestActive()) != INVALID) {
-        Value excess = (*_excess)[n];
+        Flow excess = (*_excess)[n];
         int level = _level->highestActiveLevel();
         int new_level = _level->maxLevel();
 
         for (OutArcIt e(_graph, n); e != INVALID; ++e) {
-          Value rem = (*_capacity)[e] - (*_flow)[e];
+          Flow rem = (*_capacity)[e] - (*_flow)[e];
           if (!_tolerance.positive(rem)) continue;
           Node v = _graph.target(e);
@@ -793,10 +792,10 @@
             if (!_tolerance.less(rem, excess)) {
               _flow->set(e, (*_flow)[e] + excess);
-              (*_excess)[v] += excess;
+              _excess->set(v, (*_excess)[v] + excess);
               excess = 0;
               goto no_more_push;
             } else {
               excess -= rem;
-              (*_excess)[v] += rem;
+              _excess->set(v, (*_excess)[v] + rem);
               _flow->set(e, (*_capacity)[e]);
             }
@@ -807,5 +806,5 @@
 
         for (InArcIt e(_graph, n); e != INVALID; ++e) {
-          Value rem = (*_flow)[e];
+          Flow rem = (*_flow)[e];
           if (!_tolerance.positive(rem)) continue;
           Node v = _graph.source(e);
@@ -816,10 +815,10 @@
             if (!_tolerance.less(rem, excess)) {
               _flow->set(e, (*_flow)[e] - excess);
-              (*_excess)[v] += excess;
+              _excess->set(v, (*_excess)[v] + excess);
               excess = 0;
               goto no_more_push;
             } else {
               excess -= rem;
-              (*_excess)[v] += rem;
+              _excess->set(v, (*_excess)[v] + rem);
               _flow->set(e, 0);
             }
@@ -831,5 +830,5 @@
       no_more_push:
 
-        (*_excess)[n] = excess;
+        _excess->set(n, excess);
 
         if (excess != 0) {
@@ -898,5 +897,5 @@
     /// \pre Either \ref run() or \ref init() must be called before
     /// using this function.
-    Value flowValue() const {
+    Flow flowValue() const {
       return (*_excess)[_target];
     }
@@ -909,5 +908,5 @@
     /// \pre Either \ref run() or \ref init() must be called before
     /// using this function.
-    Value flow(const Arc& arc) const {
+    Flow flow(const Arc& arc) const {
       return (*_flow)[arc];
     }
@@ -948,5 +947,5 @@
     ///
     /// \note This function calls \ref minCut() for each node, so it runs in
-    /// O(n) time.
+    /// \f$O(n)\f$ time.
     ///
     /// \pre Either \ref run() or \ref init() must be called before
