Index: lemon/bellman_ford.h
===================================================================
--- lemon/bellman_ford.h	(revision 844)
+++ lemon/bellman_ford.h	(revision 877)
@@ -1,7 +1,7 @@
-/* -*- C++ -*-
+/* -*- mode: C++; indent-tabs-mode: nil; -*-
  *
- * This file is a part of LEMON, a generic C++ optimization library
+ * This file is a part of LEMON, a generic C++ optimization library.
  *
- * Copyright (C) 2003-2008
+ * Copyright (C) 2003-2010
  * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
  * (Egervary Research Group on Combinatorial Optimization, EGRES).
@@ -37,5 +37,5 @@
 
   /// \brief Default operation traits for the BellmanFord algorithm class.
-  ///  
+  ///
   /// This operation traits class defines all computational operations
   /// and constants that are used in the Bellman-Ford algorithm.
@@ -46,5 +46,5 @@
   /// \see BellmanFordToleranceOperationTraits
   template <
-    typename V, 
+    typename V,
     bool has_inf = std::numeric_limits<V>::has_infinity>
   struct BellmanFordDefaultOperationTraits {
@@ -87,5 +87,5 @@
     }
   };
-  
+
   /// \brief Operation traits for the BellmanFord algorithm class
   /// using tolerance.
@@ -140,5 +140,5 @@
   template<typename GR, typename LEN>
   struct BellmanFordDefaultTraits {
-    /// The type of the digraph the algorithm runs on. 
+    /// The type of the digraph the algorithm runs on.
     typedef GR Digraph;
 
@@ -159,8 +159,8 @@
     /// BellmanFordToleranceOperationTraits
     typedef BellmanFordDefaultOperationTraits<Value> OperationTraits;
- 
-    /// \brief The type of the map that stores the last arcs of the 
+
+    /// \brief The type of the map that stores the last arcs of the
     /// shortest paths.
-    /// 
+    ///
     /// The type of the map that stores the last
     /// arcs of the shortest paths.
@@ -169,6 +169,6 @@
 
     /// \brief Instantiates a \c PredMap.
-    /// 
-    /// This function instantiates a \ref PredMap. 
+    ///
+    /// This function instantiates a \ref PredMap.
     /// \param g is the digraph to which we would like to define the
     /// \ref PredMap.
@@ -185,6 +185,6 @@
     /// \brief Instantiates a \c DistMap.
     ///
-    /// This function instantiates a \ref DistMap. 
-    /// \param g is the digraph to which we would like to define the 
+    /// This function instantiates a \ref DistMap.
+    /// \param g is the digraph to which we would like to define the
     /// \ref DistMap.
     static DistMap *createDistMap(const GR& g) {
@@ -193,9 +193,9 @@
 
   };
-  
+
   /// \brief %BellmanFord algorithm class.
   ///
   /// \ingroup shortest_path
-  /// This class provides an efficient implementation of the Bellman-Ford 
+  /// This class provides an efficient implementation of the Bellman-Ford
   /// algorithm. The maximum time complexity of the algorithm is
   /// <tt>O(ne)</tt>.
@@ -208,5 +208,5 @@
   ///
   /// The arc lengths are passed to the algorithm using a
-  /// \ref concepts::ReadMap "ReadMap", so it is easy to change it to any 
+  /// \ref concepts::ReadMap "ReadMap", so it is easy to change it to any
   /// kind of length. The type of the length values is determined by the
   /// \ref concepts::ReadMap::Value "Value" type of the length map.
@@ -238,5 +238,5 @@
     ///The type of the underlying digraph.
     typedef typename TR::Digraph Digraph;
-    
+
     /// \brief The type of the arc lengths.
     typedef typename TR::LengthMap::Value Value;
@@ -285,10 +285,10 @@
     void create_maps() {
       if(!_pred) {
-	_local_pred = true;
-	_pred = Traits::createPredMap(*_gr);
+        _local_pred = true;
+        _pred = Traits::createPredMap(*_gr);
       }
       if(!_dist) {
-	_local_dist = true;
-	_dist = Traits::createDistMap(*_gr);
+        _local_dist = true;
+        _dist = Traits::createDistMap(*_gr);
       }
       if(!_mask) {
@@ -296,7 +296,7 @@
       }
     }
-    
+
   public :
- 
+
     typedef BellmanFord Create;
 
@@ -321,9 +321,9 @@
     /// It must conform to the \ref concepts::WriteMap "WriteMap" concept.
     template <class T>
-    struct SetPredMap 
+    struct SetPredMap
       : public BellmanFord< Digraph, LengthMap, SetPredMapTraits<T> > {
       typedef BellmanFord< Digraph, LengthMap, SetPredMapTraits<T> > Create;
     };
-    
+
     template <class T>
     struct SetDistMapTraits : public Traits {
@@ -342,5 +342,5 @@
     /// It must conform to the \ref concepts::WriteMap "WriteMap" concept.
     template <class T>
-    struct SetDistMap 
+    struct SetDistMap
       : public BellmanFord< Digraph, LengthMap, SetDistMapTraits<T> > {
       typedef BellmanFord< Digraph, LengthMap, SetDistMapTraits<T> > Create;
@@ -351,6 +351,6 @@
       typedef T OperationTraits;
     };
-    
-    /// \brief \ref named-templ-param "Named parameter" for setting 
+
+    /// \brief \ref named-templ-param "Named parameter" for setting
     /// \c OperationTraits type.
     ///
@@ -364,13 +364,13 @@
       Create;
     };
-    
+
     ///@}
 
   protected:
-    
+
     BellmanFord() {}
 
-  public:      
-    
+  public:
+
     /// \brief Constructor.
     ///
@@ -382,5 +382,5 @@
       _pred(0), _local_pred(false),
       _dist(0), _local_dist(false), _mask(0) {}
-    
+
     ///Destructor.
     ~BellmanFord() {
@@ -409,6 +409,6 @@
     BellmanFord &predMap(PredMap &map) {
       if(_local_pred) {
-	delete _pred;
-	_local_pred=false;
+        delete _pred;
+        _local_pred=false;
       }
       _pred = &map;
@@ -427,6 +427,6 @@
     BellmanFord &distMap(DistMap &map) {
       if(_local_dist) {
-	delete _dist;
-	_local_dist=false;
+        delete _dist;
+        _local_dist=false;
       }
       _dist = &map;
@@ -446,5 +446,5 @@
 
     /// \brief Initializes the internal data structures.
-    /// 
+    ///
     /// Initializes the internal data structures. The optional parameter
     /// is the initial distance of each node.
@@ -452,20 +452,20 @@
       create_maps();
       for (NodeIt it(*_gr); it != INVALID; ++it) {
-	_pred->set(it, INVALID);
-	_dist->set(it, value);
+        _pred->set(it, INVALID);
+        _dist->set(it, value);
       }
       _process.clear();
       if (OperationTraits::less(value, OperationTraits::infinity())) {
-	for (NodeIt it(*_gr); it != INVALID; ++it) {
-	  _process.push_back(it);
-	  _mask->set(it, true);
-	}
+        for (NodeIt it(*_gr); it != INVALID; ++it) {
+          _process.push_back(it);
+          _mask->set(it, true);
+        }
       } else {
-	for (NodeIt it(*_gr); it != INVALID; ++it) {
-	  _mask->set(it, false);
-	}
-      }
-    }
-    
+        for (NodeIt it(*_gr); it != INVALID; ++it) {
+          _mask->set(it, false);
+        }
+      }
+    }
+
     /// \brief Adds a new source node.
     ///
@@ -475,6 +475,6 @@
       _dist->set(source, dst);
       if (!(*_mask)[source]) {
-	_process.push_back(source);
-	_mask->set(source, true);
+        _process.push_back(source);
+        _mask->set(source, true);
       }
     }
@@ -501,24 +501,24 @@
     bool processNextRound() {
       for (int i = 0; i < int(_process.size()); ++i) {
-	_mask->set(_process[i], false);
+        _mask->set(_process[i], false);
       }
       std::vector<Node> nextProcess;
       std::vector<Value> values(_process.size());
       for (int i = 0; i < int(_process.size()); ++i) {
-	values[i] = (*_dist)[_process[i]];
+        values[i] = (*_dist)[_process[i]];
       }
       for (int i = 0; i < int(_process.size()); ++i) {
-	for (OutArcIt it(*_gr, _process[i]); it != INVALID; ++it) {
-	  Node target = _gr->target(it);
-	  Value relaxed = OperationTraits::plus(values[i], (*_length)[it]);
-	  if (OperationTraits::less(relaxed, (*_dist)[target])) {
-	    _pred->set(target, it);
-	    _dist->set(target, relaxed);
-	    if (!(*_mask)[target]) {
-	      _mask->set(target, true);
-	      nextProcess.push_back(target);
-	    }
-	  }	  
-	}
+        for (OutArcIt it(*_gr, _process[i]); it != INVALID; ++it) {
+          Node target = _gr->target(it);
+          Value relaxed = OperationTraits::plus(values[i], (*_length)[it]);
+          if (OperationTraits::less(relaxed, (*_dist)[target])) {
+            _pred->set(target, it);
+            _dist->set(target, relaxed);
+            if (!(*_mask)[target]) {
+              _mask->set(target, true);
+              nextProcess.push_back(target);
+            }
+          }
+        }
       }
       _process.swap(nextProcess);
@@ -542,21 +542,21 @@
     bool processNextWeakRound() {
       for (int i = 0; i < int(_process.size()); ++i) {
-	_mask->set(_process[i], false);
+        _mask->set(_process[i], false);
       }
       std::vector<Node> nextProcess;
       for (int i = 0; i < int(_process.size()); ++i) {
-	for (OutArcIt it(*_gr, _process[i]); it != INVALID; ++it) {
-	  Node target = _gr->target(it);
-	  Value relaxed = 
-	    OperationTraits::plus((*_dist)[_process[i]], (*_length)[it]);
-	  if (OperationTraits::less(relaxed, (*_dist)[target])) {
-	    _pred->set(target, it);
-	    _dist->set(target, relaxed);
-	    if (!(*_mask)[target]) {
-	      _mask->set(target, true);
-	      nextProcess.push_back(target);
-	    }
-	  }	  
-	}
+        for (OutArcIt it(*_gr, _process[i]); it != INVALID; ++it) {
+          Node target = _gr->target(it);
+          Value relaxed =
+            OperationTraits::plus((*_dist)[_process[i]], (*_length)[it]);
+          if (OperationTraits::less(relaxed, (*_dist)[target])) {
+            _pred->set(target, it);
+            _dist->set(target, relaxed);
+            if (!(*_mask)[target]) {
+              _mask->set(target, true);
+              nextProcess.push_back(target);
+            }
+          }
+        }
       }
       _process.swap(nextProcess);
@@ -580,5 +580,5 @@
       int num = countNodes(*_gr) - 1;
       for (int i = 0; i < num; ++i) {
-	if (processNextWeakRound()) break;
+        if (processNextWeakRound()) break;
       }
     }
@@ -592,16 +592,16 @@
     /// if the digraph contains cycles with negative total length.
     ///
-    /// The algorithm computes 
+    /// The algorithm computes
     /// - the shortest path tree (forest),
     /// - the distance of each node from the root(s).
-    /// 
+    ///
     /// \return \c false if there is a negative cycle in the digraph.
     ///
     /// \pre init() must be called and at least one root node should be
-    /// added with addSource() before using this function. 
+    /// added with addSource() before using this function.
     bool checkedStart() {
       int num = countNodes(*_gr);
       for (int i = 0; i < num; ++i) {
-	if (processNextWeakRound()) return true;
+        if (processNextWeakRound()) return true;
       }
       return _process.empty();
@@ -627,13 +627,13 @@
     ///
     /// \pre init() must be called and at least one root node should be
-    /// added with addSource() before using this function. 
+    /// added with addSource() before using this function.
     void limitedStart(int num) {
       for (int i = 0; i < num; ++i) {
-	if (processNextRound()) break;
-      }
-    }
-    
+        if (processNextRound()) break;
+      }
+    }
+
     /// \brief Runs the algorithm from the given root node.
-    ///    
+    ///
     /// This method runs the Bellman-Ford algorithm from the given root
     /// node \c s in order to compute the shortest path to each node.
@@ -654,8 +654,8 @@
       start();
     }
-    
+
     /// \brief Runs the algorithm from the given root node with arc
     /// number limit.
-    ///    
+    ///
     /// This method runs the Bellman-Ford algorithm from the given root
     /// node \c s in order to compute the shortest path distance for each
@@ -683,5 +683,5 @@
       limitedStart(num);
     }
-    
+
     ///@}
 
@@ -698,5 +698,5 @@
       ///
       /// Constructor for getting the active nodes of the given BellmanFord
-      /// instance. 
+      /// instance.
       ActiveIt(const BellmanFord& algorithm) : _algorithm(&algorithm)
       {
@@ -712,5 +712,5 @@
       ///
       /// Conversion to \c Node.
-      operator Node() const { 
+      operator Node() const {
         return _index >= 0 ? _algorithm->_process[_index] : INVALID;
       }
@@ -721,31 +721,31 @@
       ActiveIt& operator++() {
         --_index;
-        return *this; 
-      }
-
-      bool operator==(const ActiveIt& it) const { 
-        return static_cast<Node>(*this) == static_cast<Node>(it); 
-      }
-      bool operator!=(const ActiveIt& it) const { 
-        return static_cast<Node>(*this) != static_cast<Node>(it); 
-      }
-      bool operator<(const ActiveIt& it) const { 
-        return static_cast<Node>(*this) < static_cast<Node>(it); 
-      }
-      
+        return *this;
+      }
+
+      bool operator==(const ActiveIt& it) const {
+        return static_cast<Node>(*this) == static_cast<Node>(it);
+      }
+      bool operator!=(const ActiveIt& it) const {
+        return static_cast<Node>(*this) != static_cast<Node>(it);
+      }
+      bool operator<(const ActiveIt& it) const {
+        return static_cast<Node>(*this) < static_cast<Node>(it);
+      }
+
     private:
       const BellmanFord* _algorithm;
       int _index;
     };
-    
+
     /// \name Query Functions
     /// The result of the Bellman-Ford algorithm can be obtained using these
     /// functions.\n
     /// Either \ref run() or \ref init() should be called before using them.
-    
+
     ///@{
 
     /// \brief The shortest path to the given node.
-    ///    
+    ///
     /// Gives back the shortest path to the given node from the root(s).
     ///
@@ -758,5 +758,5 @@
       return Path(*_gr, *_pred, t);
     }
-	  
+
     /// \brief The distance of the given node from the root(s).
     ///
@@ -798,8 +798,8 @@
     /// \pre Either \ref run() or \ref init() must be called before
     /// using this function.
-    Node predNode(Node v) const { 
-      return (*_pred)[v] == INVALID ? INVALID : _gr->source((*_pred)[v]); 
-    }
-    
+    Node predNode(Node v) const {
+      return (*_pred)[v] == INVALID ? INVALID : _gr->source((*_pred)[v]);
+    }
+
     /// \brief Returns a const reference to the node map that stores the
     /// distances of the nodes.
@@ -811,5 +811,5 @@
     /// using this function.
     const DistMap &distMap() const { return *_dist;}
- 
+
     /// \brief Returns a const reference to the node map that stores the
     /// predecessor arcs.
@@ -821,5 +821,5 @@
     /// using this function.
     const PredMap &predMap() const { return *_pred; }
- 
+
     /// \brief Checks if a node is reached from the root(s).
     ///
@@ -833,5 +833,5 @@
 
     /// \brief Gives back a negative cycle.
-    ///    
+    ///
     /// This function gives back a directed cycle with negative total
     /// length if the algorithm has already found one.
@@ -860,8 +860,8 @@
       return cycle;
     }
-    
+
     ///@}
   };
- 
+
   /// \brief Default traits class of bellmanFord() function.
   ///
@@ -871,5 +871,5 @@
   template <typename GR, typename LEN>
   struct BellmanFordWizardDefaultTraits {
-    /// The type of the digraph the algorithm runs on. 
+    /// The type of the digraph the algorithm runs on.
     typedef GR Digraph;
 
@@ -893,5 +893,5 @@
     /// \brief The type of the map that stores the last
     /// arcs of the shortest paths.
-    /// 
+    ///
     /// The type of the map that stores the last arcs of the shortest paths.
     /// It must conform to the \ref concepts::WriteMap "WriteMap" concept.
@@ -899,5 +899,5 @@
 
     /// \brief Instantiates a \c PredMap.
-    /// 
+    ///
     /// This function instantiates a \ref PredMap.
     /// \param g is the digraph to which we would like to define the
@@ -915,5 +915,5 @@
     /// \brief Instantiates a \c DistMap.
     ///
-    /// This function instantiates a \ref DistMap. 
+    /// This function instantiates a \ref DistMap.
     /// \param g is the digraph to which we would like to define the
     /// \ref DistMap.
@@ -928,5 +928,5 @@
     typedef lemon::Path<Digraph> Path;
   };
-  
+
   /// \brief Default traits class used by BellmanFordWizard.
   ///
@@ -935,5 +935,5 @@
   /// \tparam LEN The type of the length map.
   template <typename GR, typename LEN>
-  class BellmanFordWizardBase 
+  class BellmanFordWizardBase
     : public BellmanFordWizardDefaultTraits<GR, LEN> {
 
@@ -958,5 +958,5 @@
     public:
     /// Constructor.
-    
+
     /// This constructor does not require parameters, it initiates
     /// all of the attributes to default values \c 0.
@@ -965,17 +965,17 @@
 
     /// Constructor.
-    
+
     /// This constructor requires two parameters,
     /// others are initiated to \c 0.
     /// \param gr The digraph the algorithm runs on.
     /// \param len The length map.
-    BellmanFordWizardBase(const GR& gr, 
-			  const LEN& len) :
-      _graph(reinterpret_cast<void*>(const_cast<GR*>(&gr))), 
-      _length(reinterpret_cast<void*>(const_cast<LEN*>(&len))), 
+    BellmanFordWizardBase(const GR& gr,
+                          const LEN& len) :
+      _graph(reinterpret_cast<void*>(const_cast<GR*>(&gr))),
+      _length(reinterpret_cast<void*>(const_cast<LEN*>(&len))),
       _pred(0), _dist(0), _path(0), _di(0) {}
 
   };
-  
+
   /// \brief Auxiliary class for the function-type interface of the
   /// \ref BellmanFord "Bellman-Ford" algorithm.
@@ -1002,5 +1002,5 @@
     typedef typename Digraph::Arc Arc;
     typedef typename Digraph::OutArcIt ArcIt;
-    
+
     typedef typename TR::LengthMap LengthMap;
     typedef typename LengthMap::Value Value;
@@ -1019,5 +1019,5 @@
     /// \param gr The digraph the algorithm runs on.
     /// \param len The length map.
-    BellmanFordWizard(const Digraph& gr, const LengthMap& len) 
+    BellmanFordWizard(const Digraph& gr, const LengthMap& len)
       : TR(gr, len) {}
 
@@ -1028,10 +1028,10 @@
 
     /// \brief Runs the Bellman-Ford algorithm from the given source node.
-    ///    
+    ///
     /// This method runs the Bellman-Ford algorithm from the given source
     /// node in order to compute the shortest path to each node.
     void run(Node s) {
-      BellmanFord<Digraph,LengthMap,TR> 
-	bf(*reinterpret_cast<const Digraph*>(Base::_graph), 
+      BellmanFord<Digraph,LengthMap,TR>
+        bf(*reinterpret_cast<const Digraph*>(Base::_graph),
            *reinterpret_cast<const LengthMap*>(Base::_length));
       if (Base::_pred) bf.predMap(*reinterpret_cast<PredMap*>(Base::_pred));
@@ -1068,5 +1068,5 @@
       SetPredMapBase(const TR &b) : TR(b) {}
     };
-    
+
     /// \brief \ref named-templ-param "Named parameter" for setting
     /// the predecessor map.
@@ -1079,5 +1079,5 @@
       return BellmanFordWizard<SetPredMapBase<T> >(*this);
     }
-    
+
     template<class T>
     struct SetDistMapBase : public Base {
@@ -1086,5 +1086,5 @@
       SetDistMapBase(const TR &b) : TR(b) {}
     };
-    
+
     /// \brief \ref named-templ-param "Named parameter" for setting
     /// the distance map.
@@ -1127,7 +1127,7 @@
       return *this;
     }
-    
+
   };
-  
+
   /// \brief Function type interface for the \ref BellmanFord "Bellman-Ford"
   /// algorithm.
@@ -1137,6 +1137,6 @@
   /// algorithm.
   ///
-  /// This function also has several \ref named-templ-func-param 
-  /// "named parameters", they are declared as the members of class 
+  /// This function also has several \ref named-templ-func-param
+  /// "named parameters", they are declared as the members of class
   /// \ref BellmanFordWizard.
   /// The following examples show how to use these parameters.
@@ -1155,5 +1155,5 @@
   BellmanFordWizard<BellmanFordWizardBase<GR,LEN> >
   bellmanFord(const GR& digraph,
-	      const LEN& length)
+              const LEN& length)
   {
     return BellmanFordWizard<BellmanFordWizardBase<GR,LEN> >(digraph, length);
