Index: CMakeLists.txt
===================================================================
--- CMakeLists.txt	(revision 668)
+++ CMakeLists.txt	(revision 599)
@@ -15,6 +15,4 @@
 INCLUDE(FindGhostscript)
 FIND_PACKAGE(GLPK 4.33)
-FIND_PACKAGE(CPLEX)
-FIND_PACKAGE(COIN)
 
 ADD_DEFINITIONS(-DHAVE_CONFIG_H)
@@ -28,4 +26,10 @@
 # C4996: 'function': was declared deprecated
 ENDIF(MSVC)
+
+IF(GLPK_FOUND)
+  SET(HAVE_LP TRUE)
+  SET(HAVE_MIP TRUE)
+  SET(HAVE_GLPK TRUE)
+ENDIF(GLPK_FOUND)
 
 INCLUDE(CheckTypeSize)
Index: ake/FindCOIN.cmake
===================================================================
--- cmake/FindCOIN.cmake	(revision 668)
+++ 	(revision )
@@ -1,68 +1,0 @@
-SET(COIN_ROOT_DIR "" CACHE PATH "COIN root directory")
-
-FIND_PATH(COIN_INCLUDE_DIR coin/CoinUtilsConfig.h
-  PATHS ${COIN_ROOT_DIR}/include)
-
-FIND_LIBRARY(COIN_CBC_LIBRARY libCbc
-  PATHS ${COIN_ROOT_DIR}/lib)
-FIND_LIBRARY(COIN_CBC_SOLVER_LIBRARY libCbcSolver
-  PATHS ${COIN_ROOT_DIR}/lib)
-FIND_LIBRARY(COIN_CGL_LIBRARY libCgl
-  PATHS ${COIN_ROOT_DIR}/lib)
-FIND_LIBRARY(COIN_CLP_LIBRARY libClp
-  PATHS ${COIN_ROOT_DIR}/lib)
-FIND_LIBRARY(COIN_COIN_UTILS_LIBRARY libCoinUtils
-  PATHS ${COIN_ROOT_DIR}/lib)
-FIND_LIBRARY(COIN_OSI_LIBRARY libOsi
-  PATHS ${COIN_ROOT_DIR}/lib)
-FIND_LIBRARY(COIN_OSI_CBC_LIBRARY libOsiCbc
-  PATHS ${COIN_ROOT_DIR}/lib)
-FIND_LIBRARY(COIN_OSI_CLP_LIBRARY libOsiClp
-  PATHS ${COIN_ROOT_DIR}/lib)
-FIND_LIBRARY(COIN_OSI_VOL_LIBRARY libOsiVol
-  PATHS ${COIN_ROOT_DIR}/lib)
-FIND_LIBRARY(COIN_VOL_LIBRARY libVol
-  PATHS ${COIN_ROOT_DIR}/lib)
-
-INCLUDE(FindPackageHandleStandardArgs)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(COIN DEFAULT_MSG
-  COIN_INCLUDE_DIR
-  COIN_CBC_LIBRARY
-  COIN_CBC_SOLVER_LIBRARY
-  COIN_CGL_LIBRARY
-  COIN_CLP_LIBRARY
-  COIN_COIN_UTILS_LIBRARY
-  COIN_OSI_LIBRARY
-  COIN_OSI_CBC_LIBRARY
-  COIN_OSI_CLP_LIBRARY
-  COIN_OSI_VOL_LIBRARY
-  COIN_VOL_LIBRARY
-)
-
-IF(COIN_FOUND)
-  SET(COIN_INCLUDE_DIRS ${COIN_INCLUDE_DIR})
-  SET(COIN_LIBRARIES "${COIN_CBC_LIBRARY};${COIN_CBC_SOLVER_LIBRARY};${COIN_CGL_LIBRARY};${COIN_CLP_LIBRARY};${COIN_COIN_UTILS_LIBRARY};${COIN_OSI_LIBRARY};${COIN_OSI_CBC_LIBRARY};${COIN_OSI_CLP_LIBRARY};${COIN_OSI_VOL_LIBRARY};${COIN_VOL_LIBRARY}")
-  SET(COIN_CLP_LIBRARIES "${COIN_CLP_LIBRARY};${COIN_COIN_UTILS_LIBRARY}")
-  SET(COIN_CBC_LIBRARIES ${COIN_LIBRARIES})
-ENDIF(COIN_FOUND)
-
-MARK_AS_ADVANCED(
-  COIN_INCLUDE_DIR
-  COIN_CBC_LIBRARY
-  COIN_CBC_SOLVER_LIBRARY
-  COIN_CGL_LIBRARY
-  COIN_CLP_LIBRARY
-  COIN_COIN_UTILS_LIBRARY
-  COIN_OSI_LIBRARY
-  COIN_OSI_CBC_LIBRARY
-  COIN_OSI_CLP_LIBRARY
-  COIN_OSI_VOL_LIBRARY
-  COIN_VOL_LIBRARY
-)
-
-IF(COIN_FOUND)
-  SET(HAVE_LP TRUE)
-  SET(HAVE_MIP TRUE)
-  SET(HAVE_CLP TRUE)
-  SET(HAVE_CBC TRUE)
-ENDIF(COIN_FOUND)
Index: ake/FindCPLEX.cmake
===================================================================
--- cmake/FindCPLEX.cmake	(revision 667)
+++ 	(revision )
@@ -1,27 +1,0 @@
-FIND_PATH(CPLEX_INCLUDE_DIR
-  ilcplex/cplex.h
-  PATHS "C:/ILOG/CPLEX91/include")
-
-FIND_LIBRARY(CPLEX_LIBRARY
-  NAMES cplex91
-  PATHS "C:/ILOG/CPLEX91/lib/msvc7/stat_mda")
-
-INCLUDE(FindPackageHandleStandardArgs)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(CPLEX DEFAULT_MSG CPLEX_LIBRARY CPLEX_INCLUDE_DIR)
-
-FIND_PATH(CPLEX_BIN_DIR
-  cplex91.dll
-  PATHS "C:/ILOG/CPLEX91/bin/x86_win32")
-
-IF(CPLEX_FOUND)
-  SET(CPLEX_INCLUDE_DIRS ${CPLEX_INCLUDE_DIR})
-  SET(CPLEX_LIBRARIES ${CPLEX_LIBRARY})
-ENDIF(CPLEX_FOUND)
-
-MARK_AS_ADVANCED(CPLEX_LIBRARY CPLEX_INCLUDE_DIR CPLEX_BIN_DIR)
-
-IF(CPLEX_FOUND)
-  SET(HAVE_LP TRUE)
-  SET(HAVE_MIP TRUE)
-  SET(HAVE_CPLEX TRUE)
-ENDIF(CPLEX_FOUND)
Index: cmake/FindGLPK.cmake
===================================================================
--- cmake/FindGLPK.cmake	(revision 666)
+++ cmake/FindGLPK.cmake	(revision 496)
@@ -14,5 +14,4 @@
 
 IF(GLPK_FOUND)
-  SET(GLPK_INCLUDE_DIRS ${GLPK_INCLUDE_DIR})
   SET(GLPK_LIBRARIES ${GLPK_LIBRARY})
   SET(GLPK_BIN_DIR ${GLPK_ROOT_PATH}/bin)
@@ -20,8 +19,2 @@
 
 MARK_AS_ADVANCED(GLPK_LIBRARY GLPK_INCLUDE_DIR GLPK_BIN_DIR)
-
-IF(GLPK_FOUND)
-  SET(HAVE_LP TRUE)
-  SET(HAVE_MIP TRUE)
-  SET(HAVE_GLPK TRUE)
-ENDIF(GLPK_FOUND)
Index: lemon/CMakeLists.txt
===================================================================
--- lemon/CMakeLists.txt	(revision 668)
+++ lemon/CMakeLists.txt	(revision 596)
@@ -21,5 +21,5 @@
 IF(HAVE_GLPK)
   SET(LEMON_SOURCES ${LEMON_SOURCES} glpk.cc)
-  INCLUDE_DIRECTORIES(${GLPK_INCLUDE_DIRS})
+  INCLUDE_DIRECTORIES(${GLPK_INCLUDE_DIR})
   IF(WIN32)
     INSTALL(FILES ${GLPK_BIN_DIR}/glpk.dll DESTINATION bin)
@@ -28,19 +28,4 @@
   ENDIF(WIN32)
 ENDIF(HAVE_GLPK)
-
-IF(HAVE_CPLEX)
-  SET(LEMON_SOURCES ${LEMON_SOURCES} cplex.cc)
-  INCLUDE_DIRECTORIES(${CPLEX_INCLUDE_DIRS})
-ENDIF(HAVE_CPLEX)
-
-IF(HAVE_CLP)
-  SET(LEMON_SOURCES ${LEMON_SOURCES} clp.cc)
-  INCLUDE_DIRECTORIES(${COIN_INCLUDE_DIRS})
-ENDIF(HAVE_CLP)
-
-IF(HAVE_CBC)
-  SET(LEMON_SOURCES ${LEMON_SOURCES} cbc.cc)
-  INCLUDE_DIRECTORIES(${COIN_INCLUDE_DIRS})
-ENDIF(HAVE_CBC)
 
 ADD_LIBRARY(lemon ${LEMON_SOURCES})
Index: lemon/circulation.h
===================================================================
--- lemon/circulation.h	(revision 669)
+++ lemon/circulation.h	(revision 658)
@@ -22,5 +22,4 @@
 #include <lemon/tolerance.h>
 #include <lemon/elevator.h>
-#include <limits>
 
 ///\ingroup max_flow
@@ -121,7 +120,7 @@
 
      The exact formulation of this problem is the following.
-     Let \f$G=(V,A)\f$ be a digraph, \f$lower: A\rightarrow\mathbf{R}\f$
-     \f$upper: A\rightarrow\mathbf{R}\cup\{\infty\}\f$ denote the lower and
-     upper bounds on the arcs, for which \f$lower(uv) \leq upper(uv)\f$
+     Let \f$G=(V,A)\f$ be a digraph,
+     \f$lower, upper: A\rightarrow\mathbf{R}^+_0\f$ denote the lower and
+     upper bounds on the arcs, for which \f$0 \leq lower(uv) \leq upper(uv)\f$
      holds for all \f$uv\in A\f$, and \f$sup: V\rightarrow\mathbf{R}\f$
      denotes the signed supply values of the nodes.
@@ -129,5 +128,5 @@
      supply, if \f$sup(u)<0\f$, then \f$u\f$ is a demand node with
      \f$-sup(u)\f$ demand.
-     A feasible circulation is an \f$f: A\rightarrow\mathbf{R}\f$
+     A feasible circulation is an \f$f: A\rightarrow\mathbf{R}^+_0\f$
      solution of the following problem.
 
@@ -152,8 +151,4 @@
      the direction of the arcs and taking the negative of the supply values
      (e.g. using \ref ReverseDigraph and \ref NegMap adaptors).
-
-     This algorithm either calculates a feasible circulation, or provides
-     a \ref barrier() "barrier", which prooves that a feasible soultion
-     cannot exist.
 
      Note that this algorithm also provides a feasible solution for the
@@ -343,11 +338,4 @@
   private:
 
-    bool checkBoundMaps() {
-      for (ArcIt e(_g);e!=INVALID;++e) {
-        if (_tol.less((*_up)[e], (*_lo)[e])) return false;
-      }
-      return true;
-    }
-
     void createStructures() {
       _node_num = _el = countNodes(_g);
@@ -393,5 +381,5 @@
     /// Sets the upper bound (capacity) map.
     /// \return <tt>(*this)</tt>
-    Circulation& upperMap(const UpperMap& map) {
+    Circulation& upperMap(const LowerMap& map) {
       _up = &map;
       return *this;
@@ -480,7 +468,4 @@
     void init()
     {
-      LEMON_DEBUG(checkBoundMaps(),
-        "Upper bounds must be greater or equal to the lower bounds");
-
       createStructures();
 
@@ -512,7 +497,4 @@
     void greedyInit()
     {
-      LEMON_DEBUG(checkBoundMaps(),
-        "Upper bounds must be greater or equal to the lower bounds");
-
       createStructures();
 
@@ -522,9 +504,9 @@
 
       for (ArcIt e(_g);e!=INVALID;++e) {
-        if (!_tol.less(-(*_excess)[_g.target(e)], (*_up)[e])) {
+        if (!_tol.positive((*_excess)[_g.target(e)] + (*_up)[e])) {
           _flow->set(e, (*_up)[e]);
           (*_excess)[_g.target(e)] += (*_up)[e];
           (*_excess)[_g.source(e)] -= (*_up)[e];
-        } else if (_tol.less(-(*_excess)[_g.target(e)], (*_lo)[e])) {
+        } else if (_tol.positive((*_excess)[_g.target(e)] + (*_lo)[e])) {
           _flow->set(e, (*_lo)[e]);
           (*_excess)[_g.target(e)] += (*_lo)[e];
@@ -767,7 +749,4 @@
     {
       Flow delta=0;
-      Flow inf_cap = std::numeric_limits<Flow>::has_infinity ?
-        std::numeric_limits<Flow>::infinity() :
-        std::numeric_limits<Flow>::max();
       for(NodeIt n(_g);n!=INVALID;++n)
         if(barrier(n))
@@ -777,8 +756,5 @@
           Node s=_g.source(e);
           Node t=_g.target(e);
-          if(barrier(s)&&!barrier(t)) {
-            if (_tol.less(inf_cap - (*_up)[e], delta)) return false;
-            delta+=(*_up)[e];
-          }
+          if(barrier(s)&&!barrier(t)) delta+=(*_up)[e];
           else if(barrier(t)&&!barrier(s)) delta-=(*_lo)[e];
         }
Index: lemon/config.h.cmake
===================================================================
--- lemon/config.h.cmake	(revision 668)
+++ lemon/config.h.cmake	(revision 564)
@@ -3,5 +3,2 @@
 #cmakedefine HAVE_MIP 1
 #cmakedefine HAVE_GLPK 1
-#cmakedefine HAVE_CPLEX 1
-#cmakedefine HAVE_CLP 1
-#cmakedefine HAVE_CBC 1
Index: lemon/min_cost_arborescence.h
===================================================================
--- lemon/min_cost_arborescence.h	(revision 631)
+++ lemon/min_cost_arborescence.h	(revision 672)
@@ -37,5 +37,5 @@
   /// Default traits class for MinCostArborescence class.
   /// \param GR Digraph type.
-  /// \param CM Type of cost map.
+  /// \param CM Type of the cost map.
   template <class GR, class CM>
   struct MinCostArborescenceDefaultTraits{
@@ -47,5 +47,5 @@
     ///
     /// The type of the map that stores the arc costs.
-    /// It must meet the \ref concepts::ReadMap "ReadMap" concept.
+    /// It must conform to the \ref concepts::ReadMap "ReadMap" concept.
     typedef CM CostMap;
 
@@ -59,7 +59,8 @@
     ///
     /// The type of the map that stores which arcs are in the
-    /// arborescence.  It must meet the \ref concepts::WriteMap
-    /// "WriteMap" concept.  Initially it will be set to false on each
-    /// arc. After it will set all arborescence arcs once.
+    /// arborescence.  It must conform to the \ref concepts::WriteMap
+    /// "WriteMap" concept, and its value type must be \c bool
+    /// (or convertible). Initially it will be set to \c false on each
+    /// arc, then it will be set on each arborescence arc once.
     typedef typename Digraph::template ArcMap<bool> ArborescenceMap;
 
@@ -67,6 +68,6 @@
     ///
     /// This function instantiates a \c ArborescenceMap.
-    /// \param digraph is the graph, to which we would like to
-    /// calculate the \c ArborescenceMap.
+    /// \param digraph The digraph to which we would like to calculate
+    /// the \c ArborescenceMap.
     static ArborescenceMap *createArborescenceMap(const Digraph &digraph){
       return new ArborescenceMap(digraph);
@@ -75,5 +76,7 @@
     /// \brief The type of the \c PredMap
     ///
-    /// The type of the \c PredMap. It is a node map with an arc value type.
+    /// The type of the \c PredMap. It must confrom to the
+    /// \ref concepts::WriteMap "WriteMap" concept, and its value type
+    /// must be the \c Arc type of the digraph.
     typedef typename Digraph::template NodeMap<typename Digraph::Arc> PredMap;
 
@@ -93,20 +96,19 @@
   /// \brief Minimum Cost Arborescence algorithm class.
   ///
-  /// This class provides an efficient implementation of
+  /// This class provides an efficient implementation of the
   /// Minimum Cost Arborescence algorithm. The arborescence is a tree
   /// which is directed from a given source node of the digraph. One or
-  /// more sources should be given for the algorithm and it will calculate
-  /// the minimum cost subgraph which are union of arborescences with the
+  /// more sources should be given to the algorithm and it will calculate
+  /// the minimum cost subgraph that is the union of arborescences with the
   /// given sources and spans all the nodes which are reachable from the
   /// sources. The time complexity of the algorithm is O(n<sup>2</sup>+e).
   ///
-  /// The algorithm provides also an optimal dual solution, therefore
+  /// The algorithm also provides an optimal dual solution, therefore
   /// the optimality of the solution can be checked.
   ///
-  /// \param GR The digraph type the algorithm runs on. The default value
-  /// is \ref ListDigraph.
-  /// \param CM This read-only ArcMap determines the costs of the
+  /// \param GR The digraph type the algorithm runs on.
+  /// \param CM A read-only arc map storing the costs of the
   /// arcs. It is read once for each arc, so the map may involve in
-  /// relatively time consuming process to compute the arc cost if
+  /// relatively time consuming process to compute the arc costs if
   /// it is necessary. The default map type is \ref
   /// concepts::Digraph::ArcMap "Digraph::ArcMap<int>".
@@ -114,9 +116,7 @@
   /// by the algorithm. The default traits class is
   /// \ref MinCostArborescenceDefaultTraits
-  /// "MinCostArborescenceDefaultTraits<GR, CM>".  See \ref
-  /// MinCostArborescenceDefaultTraits for the documentation of a
-  /// MinCostArborescence traits class.
+  /// "MinCostArborescenceDefaultTraits<GR, CM>".
 #ifndef DOXYGEN
-  template <typename GR = ListDigraph,
+  template <typename GR,
             typename CM = typename GR::template ArcMap<int>,
             typename TR =
@@ -128,5 +128,6 @@
   public:
 
-    /// The traits.
+    /// \brief The \ref MinCostArborescenceDefaultTraits "traits class" 
+    /// of the algorithm. 
     typedef TR Traits;
     /// The type of the underlying digraph.
@@ -396,5 +397,5 @@
 
     template <class T>
-    struct DefArborescenceMapTraits : public Traits {
+    struct SetArborescenceMapTraits : public Traits {
       typedef T ArborescenceMap;
       static ArborescenceMap *createArborescenceMap(const Digraph &)
@@ -406,31 +407,38 @@
 
     /// \brief \ref named-templ-param "Named parameter" for
-    /// setting ArborescenceMap type
+    /// setting \c ArborescenceMap type
     ///
     /// \ref named-templ-param "Named parameter" for setting
-    /// ArborescenceMap type
+    /// \c ArborescenceMap type.
+    /// It must conform to the \ref concepts::WriteMap "WriteMap" concept,
+    /// and its value type must be \c bool (or convertible).
+    /// Initially it will be set to \c false on each arc,
+    /// then it will be set on each arborescence arc once.
     template <class T>
-    struct DefArborescenceMap
+    struct SetArborescenceMap
       : public MinCostArborescence<Digraph, CostMap,
-                                   DefArborescenceMapTraits<T> > {
+                                   SetArborescenceMapTraits<T> > {
     };
 
     template <class T>
-    struct DefPredMapTraits : public Traits {
+    struct SetPredMapTraits : public Traits {
       typedef T PredMap;
       static PredMap *createPredMap(const Digraph &)
       {
         LEMON_ASSERT(false, "PredMap is not initialized");
+        return 0; // ignore warnings
       }
     };
 
     /// \brief \ref named-templ-param "Named parameter" for
-    /// setting PredMap type
+    /// setting \c PredMap type
     ///
     /// \ref named-templ-param "Named parameter" for setting
-    /// PredMap type
+    /// \c PredMap type.
+    /// It must meet the \ref concepts::WriteMap "WriteMap" concept, 
+    /// and its value type must be the \c Arc type of the digraph.
     template <class T>
-    struct DefPredMap
-      : public MinCostArborescence<Digraph, CostMap, DefPredMapTraits<T> > {
+    struct SetPredMap
+      : public MinCostArborescence<Digraph, CostMap, SetPredMapTraits<T> > {
     };
 
@@ -465,7 +473,7 @@
     }
 
-    /// \brief Sets the arborescence map.
-    ///
-    /// Sets the arborescence map.
+    /// \brief Sets the predecessor map.
+    ///
+    /// Sets the predecessor map.
     /// \return <tt>(*this)</tt>
     MinCostArborescence& predMap(PredMap& m) {
@@ -477,157 +485,4 @@
       return *this;
     }
-
-    /// \name Query Functions
-    /// The result of the %MinCostArborescence algorithm can be obtained
-    /// using these functions.\n
-    /// Before the use of these functions,
-    /// either run() or start() must be called.
-
-    /// @{
-
-    /// \brief Returns a reference to the arborescence map.
-    ///
-    /// Returns a reference to the arborescence map.
-    const ArborescenceMap& arborescenceMap() const {
-      return *_arborescence;
-    }
-
-    /// \brief Returns true if the arc is in the arborescence.
-    ///
-    /// Returns true if the arc is in the arborescence.
-    /// \param arc The arc of the digraph.
-    /// \pre \ref run() must be called before using this function.
-    bool arborescence(Arc arc) const {
-      return (*_pred)[_digraph->target(arc)] == arc;
-    }
-
-    /// \brief Returns a reference to the pred map.
-    ///
-    /// Returns a reference to the pred map.
-    const PredMap& predMap() const {
-      return *_pred;
-    }
-
-    /// \brief Returns the predecessor arc of the given node.
-    ///
-    /// Returns the predecessor arc of the given node.
-    Arc pred(Node node) const {
-      return (*_pred)[node];
-    }
-
-    /// \brief Returns the cost of the arborescence.
-    ///
-    /// Returns the cost of the arborescence.
-    Value arborescenceValue() const {
-      Value sum = 0;
-      for (ArcIt it(*_digraph); it != INVALID; ++it) {
-        if (arborescence(it)) {
-          sum += (*_cost)[it];
-        }
-      }
-      return sum;
-    }
-
-    /// \brief Indicates that a node is reachable from the sources.
-    ///
-    /// Indicates that a node is reachable from the sources.
-    bool reached(Node node) const {
-      return (*_node_order)[node] != -3;
-    }
-
-    /// \brief Indicates that a node is processed.
-    ///
-    /// Indicates that a node is processed. The arborescence path exists
-    /// from the source to the given node.
-    bool processed(Node node) const {
-      return (*_node_order)[node] == -1;
-    }
-
-    /// \brief Returns the number of the dual variables in basis.
-    ///
-    /// Returns the number of the dual variables in basis.
-    int dualNum() const {
-      return _dual_variables.size();
-    }
-
-    /// \brief Returns the value of the dual solution.
-    ///
-    /// Returns the value of the dual solution. It should be
-    /// equal to the arborescence value.
-    Value dualValue() const {
-      Value sum = 0;
-      for (int i = 0; i < int(_dual_variables.size()); ++i) {
-        sum += _dual_variables[i].value;
-      }
-      return sum;
-    }
-
-    /// \brief Returns the number of the nodes in the dual variable.
-    ///
-    /// Returns the number of the nodes in the dual variable.
-    int dualSize(int k) const {
-      return _dual_variables[k].end - _dual_variables[k].begin;
-    }
-
-    /// \brief Returns the value of the dual variable.
-    ///
-    /// Returns the the value of the dual variable.
-    const Value& dualValue(int k) const {
-      return _dual_variables[k].value;
-    }
-
-    /// \brief Lemon iterator for get a dual variable.
-    ///
-    /// Lemon iterator for get a dual variable. This class provides
-    /// a common style lemon iterator which gives back a subset of
-    /// the nodes.
-    class DualIt {
-    public:
-
-      /// \brief Constructor.
-      ///
-      /// Constructor for get the nodeset of the variable.
-      DualIt(const MinCostArborescence& algorithm, int variable)
-        : _algorithm(&algorithm)
-      {
-        _index = _algorithm->_dual_variables[variable].begin;
-        _last = _algorithm->_dual_variables[variable].end;
-      }
-
-      /// \brief Conversion to node.
-      ///
-      /// Conversion to node.
-      operator Node() const {
-        return _algorithm->_dual_node_list[_index];
-      }
-
-      /// \brief Increment operator.
-      ///
-      /// Increment operator.
-      DualIt& operator++() {
-        ++_index;
-        return *this;
-      }
-
-      /// \brief Validity checking
-      ///
-      /// Checks whether the iterator is invalid.
-      bool operator==(Invalid) const {
-        return _index == _last;
-      }
-
-      /// \brief Validity checking
-      ///
-      /// Checks whether the iterator is valid.
-      bool operator!=(Invalid) const {
-        return _index != _last;
-      }
-
-    private:
-      const MinCostArborescence* _algorithm;
-      int _index, _last;
-    };
-
-    /// @}
 
     /// \name Execution Control
@@ -690,5 +545,5 @@
     /// \return The processed node.
     ///
-    /// \warning The queue must not be empty!
+    /// \warning The queue must not be empty.
     Node processNextNode() {
       Node node = queue.back();
@@ -713,5 +568,6 @@
     /// \brief Returns the number of the nodes to be processed.
     ///
-    /// Returns the number of the nodes to be processed.
+    /// Returns the number of the nodes to be processed in the priority
+    /// queue.
     int queueSize() const {
       return queue.size();
@@ -755,11 +611,167 @@
     /// mca.start();
     /// \endcode
-    void run(Node node) {
+    void run(Node s) {
       init();
-      addSource(node);
+      addSource(s);
       start();
     }
 
     ///@}
+
+    /// \name Query Functions
+    /// The result of the %MinCostArborescence algorithm can be obtained
+    /// using these functions.\n
+    /// Either run() or start() must be called before using them.
+
+    /// @{
+
+    /// \brief Returns the cost of the arborescence.
+    ///
+    /// Returns the cost of the arborescence.
+    Value arborescenceCost() const {
+      Value sum = 0;
+      for (ArcIt it(*_digraph); it != INVALID; ++it) {
+        if (arborescence(it)) {
+          sum += (*_cost)[it];
+        }
+      }
+      return sum;
+    }
+
+    /// \brief Returns \c true if the arc is in the arborescence.
+    ///
+    /// Returns \c true if the given arc is in the arborescence.
+    /// \param arc An arc of the digraph.
+    /// \pre \ref run() must be called before using this function.
+    bool arborescence(Arc arc) const {
+      return (*_pred)[_digraph->target(arc)] == arc;
+    }
+
+    /// \brief Returns a const reference to the arborescence map.
+    ///
+    /// Returns a const reference to the arborescence map.
+    /// \pre \ref run() must be called before using this function.
+    const ArborescenceMap& arborescenceMap() const {
+      return *_arborescence;
+    }
+
+    /// \brief Returns the predecessor arc of the given node.
+    ///
+    /// Returns the predecessor arc of the given node.
+    /// \pre \ref run() must be called before using this function.
+    Arc pred(Node node) const {
+      return (*_pred)[node];
+    }
+
+    /// \brief Returns a const reference to the pred map.
+    ///
+    /// Returns a const reference to the pred map.
+    /// \pre \ref run() must be called before using this function.
+    const PredMap& predMap() const {
+      return *_pred;
+    }
+
+    /// \brief Indicates that a node is reachable from the sources.
+    ///
+    /// Indicates that a node is reachable from the sources.
+    bool reached(Node node) const {
+      return (*_node_order)[node] != -3;
+    }
+
+    /// \brief Indicates that a node is processed.
+    ///
+    /// Indicates that a node is processed. The arborescence path exists
+    /// from the source to the given node.
+    bool processed(Node node) const {
+      return (*_node_order)[node] == -1;
+    }
+
+    /// \brief Returns the number of the dual variables in basis.
+    ///
+    /// Returns the number of the dual variables in basis.
+    int dualNum() const {
+      return _dual_variables.size();
+    }
+
+    /// \brief Returns the value of the dual solution.
+    ///
+    /// Returns the value of the dual solution. It should be
+    /// equal to the arborescence value.
+    Value dualValue() const {
+      Value sum = 0;
+      for (int i = 0; i < int(_dual_variables.size()); ++i) {
+        sum += _dual_variables[i].value;
+      }
+      return sum;
+    }
+
+    /// \brief Returns the number of the nodes in the dual variable.
+    ///
+    /// Returns the number of the nodes in the dual variable.
+    int dualSize(int k) const {
+      return _dual_variables[k].end - _dual_variables[k].begin;
+    }
+
+    /// \brief Returns the value of the dual variable.
+    ///
+    /// Returns the the value of the dual variable.
+    Value dualValue(int k) const {
+      return _dual_variables[k].value;
+    }
+
+    /// \brief LEMON iterator for getting a dual variable.
+    ///
+    /// This class provides a common style LEMON iterator for getting a
+    /// dual variable of \ref MinCostArborescence algorithm.
+    /// It iterates over a subset of the nodes.
+    class DualIt {
+    public:
+
+      /// \brief Constructor.
+      ///
+      /// Constructor for getting the nodeset of the dual variable
+      /// of \ref MinCostArborescence algorithm.
+      DualIt(const MinCostArborescence& algorithm, int variable)
+        : _algorithm(&algorithm)
+      {
+        _index = _algorithm->_dual_variables[variable].begin;
+        _last = _algorithm->_dual_variables[variable].end;
+      }
+
+      /// \brief Conversion to \c Node.
+      ///
+      /// Conversion to \c Node.
+      operator Node() const {
+        return _algorithm->_dual_node_list[_index];
+      }
+
+      /// \brief Increment operator.
+      ///
+      /// Increment operator.
+      DualIt& operator++() {
+        ++_index;
+        return *this;
+      }
+
+      /// \brief Validity checking
+      ///
+      /// Checks whether the iterator is invalid.
+      bool operator==(Invalid) const {
+        return _index == _last;
+      }
+
+      /// \brief Validity checking
+      ///
+      /// Checks whether the iterator is valid.
+      bool operator!=(Invalid) const {
+        return _index != _last;
+      }
+
+    private:
+      const MinCostArborescence* _algorithm;
+      int _index, _last;
+    };
+
+    /// @}
 
   };
@@ -770,9 +782,10 @@
   ///
   /// Function type interface for MinCostArborescence algorithm.
-  /// \param digraph The Digraph that the algorithm runs on.
-  /// \param cost The CostMap of the arcs.
-  /// \param source The source of the arborescence.
-  /// \retval arborescence The bool ArcMap which stores the arborescence.
-  /// \return The cost of the arborescence.
+  /// \param digraph The digraph the algorithm runs on.
+  /// \param cost An arc map storing the costs.
+  /// \param source The source node of the arborescence.
+  /// \retval arborescence An arc map with \c bool (or convertible) value
+  /// type that stores the arborescence.
+  /// \return The total cost of the arborescence.
   ///
   /// \sa MinCostArborescence
@@ -783,9 +796,9 @@
                                               ArborescenceMap& arborescence) {
     typename MinCostArborescence<Digraph, CostMap>
-      ::template DefArborescenceMap<ArborescenceMap>
+      ::template SetArborescenceMap<ArborescenceMap>
       ::Create mca(digraph, cost);
     mca.arborescenceMap(arborescence);
     mca.run(source);
-    return mca.arborescenceValue();
+    return mca.arborescenceCost();
   }
 
Index: lemon/suurballe.h
===================================================================
--- lemon/suurballe.h	(revision 670)
+++ lemon/suurballe.h	(revision 631)
@@ -26,5 +26,4 @@
 
 #include <vector>
-#include <limits>
 #include <lemon/bin_heap.h>
 #include <lemon/path.h>
@@ -44,24 +43,20 @@
   /// from a given source node to a given target node in a digraph.
   ///
-  /// Note that this problem is a special case of the \ref min_cost_flow
-  /// "minimum cost flow problem". This implementation is actually an
-  /// efficient specialized version of the \ref CapacityScaling
-  /// "Successive Shortest Path" algorithm directly for this problem.
-  /// Therefore this class provides query functions for flow values and
-  /// node potentials (the dual solution) just like the minimum cost flow
-  /// algorithms.
+  /// In fact, this implementation is the specialization of the
+  /// \ref CapacityScaling "successive shortest path" algorithm.
   ///
   /// \tparam GR The digraph type the algorithm runs on.
-  /// \tparam LEN The type of the length map.
-  /// The default value is <tt>GR::ArcMap<int></tt>.
+  /// The default value is \c ListDigraph.
+  /// \tparam LEN The type of the length (cost) map.
+  /// The default value is <tt>Digraph::ArcMap<int></tt>.
   ///
   /// \warning Length values should be \e non-negative \e integers.
   ///
   /// \note For finding node-disjoint paths this algorithm can be used
-  /// along with the \ref SplitNodes adaptor.
+  /// with \ref SplitNodes.
 #ifdef DOXYGEN
   template <typename GR, typename LEN>
 #else
-  template < typename GR,
+  template < typename GR = ListDigraph,
              typename LEN = typename GR::template ArcMap<int> >
 #endif
@@ -81,26 +76,21 @@
     /// The type of the lengths.
     typedef typename LengthMap::Value Length;
-#ifdef DOXYGEN
-    /// The type of the flow map.
-    typedef GR::ArcMap<int> FlowMap;
-    /// The type of the potential map.
-    typedef GR::NodeMap<Length> PotentialMap;
-#else
     /// The type of the flow map.
     typedef typename Digraph::template ArcMap<int> FlowMap;
     /// The type of the potential map.
     typedef typename Digraph::template NodeMap<Length> PotentialMap;
-#endif
-
     /// The type of the path structures.
-    typedef SimplePath<GR> Path;
+    typedef SimplePath<Digraph> Path;
 
   private:
 
-    // ResidualDijkstra is a special implementation of the
-    // Dijkstra algorithm for finding shortest paths in the
-    // residual network with respect to the reduced arc lengths
-    // and modifying the node potentials according to the
-    // distance of the nodes.
+    /// \brief Special implementation of the Dijkstra algorithm
+    /// for finding shortest paths in the residual network.
+    ///
+    /// \ref ResidualDijkstra is a special implementation of the
+    /// \ref Dijkstra algorithm for finding shortest paths in the
+    /// residual network of the digraph with respect to the reduced arc
+    /// lengths and modifying the node potentials according to the
+    /// distance of the nodes.
     class ResidualDijkstra
     {
@@ -131,5 +121,5 @@
 
       /// Constructor.
-      ResidualDijkstra( const Digraph &graph,
+      ResidualDijkstra( const Digraph &digraph,
                         const FlowMap &flow,
                         const LengthMap &length,
@@ -137,6 +127,6 @@
                         PredMap &pred,
                         Node s, Node t ) :
-        _graph(graph), _flow(flow), _length(length), _potential(potential),
-        _dist(graph), _pred(pred), _s(s), _t(t) {}
+        _graph(digraph), _flow(flow), _length(length), _potential(potential),
+        _dist(digraph), _pred(pred), _s(s), _t(t) {}
 
       /// \brief Run the algorithm. It returns \c true if a path is found
@@ -247,14 +237,14 @@
     /// Constructor.
     ///
-    /// \param graph The digraph the algorithm runs on.
+    /// \param digraph The digraph the algorithm runs on.
     /// \param length The length (cost) values of the arcs.
-    Suurballe( const Digraph &graph,
-               const LengthMap &length ) :
-      _graph(graph), _length(length), _flow(0), _local_flow(false),
-      _potential(0), _local_potential(false), _pred(graph)
-    {
-      LEMON_ASSERT(std::numeric_limits<Length>::is_integer,
-        "The length type of Suurballe must be integer");
-    }
+    /// \param s The source node.
+    /// \param t The target node.
+    Suurballe( const Digraph &digraph,
+               const LengthMap &length,
+               Node s, Node t ) :
+      _graph(digraph), _length(length), _flow(0), _local_flow(false),
+      _potential(0), _local_potential(false), _source(s), _target(t),
+      _pred(digraph) {}
 
     /// Destructor.
@@ -268,10 +258,7 @@
     ///
     /// This function sets the flow map.
-    /// If it is not used before calling \ref run() or \ref init(),
-    /// an instance will be allocated automatically. The destructor
-    /// deallocates this automatically allocated map, of course.
-    ///
-    /// The found flow contains only 0 and 1 values, since it is the
-    /// union of the found arc-disjoint paths.
+    ///
+    /// The found flow contains only 0 and 1 values. It is the union of
+    /// the found arc-disjoint paths.
     ///
     /// \return <tt>(*this)</tt>
@@ -288,10 +275,7 @@
     ///
     /// This function sets the potential map.
-    /// If it is not used before calling \ref run() or \ref init(),
-    /// an instance will be allocated automatically. The destructor
-    /// deallocates this automatically allocated map, of course.
-    ///
-    /// The node potentials provide the dual solution of the underlying
-    /// \ref min_cost_flow "minimum cost flow problem".
+    ///
+    /// The potentials provide the dual solution of the underlying
+    /// minimum cost flow problem.
     ///
     /// \return <tt>(*this)</tt>
@@ -318,6 +302,4 @@
     /// This function runs the algorithm.
     ///
-    /// \param s The source node.
-    /// \param t The target node.
     /// \param k The number of paths to be found.
     ///
@@ -326,14 +308,14 @@
     /// arc-disjoint paths found.
     ///
-    /// \note Apart from the return value, <tt>s.run(s, t, k)</tt> is
-    /// just a shortcut of the following code.
+    /// \note Apart from the return value, <tt>s.run(k)</tt> is just a
+    /// shortcut of the following code.
     /// \code
-    ///   s.init(s);
-    ///   s.findFlow(t, k);
+    ///   s.init();
+    ///   s.findFlow(k);
     ///   s.findPaths();
     /// \endcode
-    int run(const Node& s, const Node& t, int k = 2) {
-      init(s);
-      findFlow(t, k);
+    int run(int k = 2) {
+      init();
+      findFlow(k);
       findPaths();
       return _path_num;
@@ -343,9 +325,5 @@
     ///
     /// This function initializes the algorithm.
-    ///
-    /// \param s The source node.
-    void init(const Node& s) {
-      _source = s;
-
+    void init() {
       // Initialize maps
       if (!_flow) {
@@ -359,26 +337,23 @@
       for (ArcIt e(_graph); e != INVALID; ++e) (*_flow)[e] = 0;
       for (NodeIt n(_graph); n != INVALID; ++n) (*_potential)[n] = 0;
-    }
-
-    /// \brief Execute the algorithm to find an optimal flow.
+
+      _dijkstra = new ResidualDijkstra( _graph, *_flow, _length,
+                                        *_potential, _pred,
+                                        _source, _target );
+    }
+
+    /// \brief Execute the successive shortest path algorithm to find
+    /// an optimal flow.
     ///
     /// This function executes the successive shortest path algorithm to
-    /// find a minimum cost flow, which is the union of \c k (or less)
+    /// find a minimum cost flow, which is the union of \c k or less
     /// arc-disjoint paths.
     ///
-    /// \param t The target node.
-    /// \param k The number of paths to be found.
-    ///
     /// \return \c k if there are at least \c k arc-disjoint paths from
-    /// the source node to the given node \c t in the digraph.
-    /// Otherwise it returns the number of arc-disjoint paths found.
+    /// \c s to \c t in the digraph. Otherwise it returns the number of
+    /// arc-disjoint paths found.
     ///
     /// \pre \ref init() must be called before using this function.
-    int findFlow(const Node& t, int k = 2) {
-      _target = t;
-      _dijkstra =
-        new ResidualDijkstra( _graph, *_flow, _length, *_potential, _pred,
-                              _source, _target );
-
+    int findFlow(int k = 2) {
       // Find shortest paths
       _path_num = 0;
@@ -406,10 +381,11 @@
     /// \brief Compute the paths from the flow.
     ///
-    /// This function computes the paths from the found minimum cost flow,
-    /// which is the union of some arc-disjoint paths.
+    /// This function computes the paths from the flow.
     ///
     /// \pre \ref init() and \ref findFlow() must be called before using
     /// this function.
     void findPaths() {
+      // Create the residual flow map (the union of the paths not found
+      // so far)
       FlowMap res_flow(_graph);
       for(ArcIt a(_graph); a != INVALID; ++a) res_flow[a] = (*_flow)[a];
@@ -438,9 +414,55 @@
     /// @{
 
-    /// \brief Return the total length of the found paths.
-    ///
-    /// This function returns the total length of the found paths, i.e.
-    /// the total cost of the found flow.
-    /// The complexity of the function is O(e).
+    /// \brief Return a const reference to the arc map storing the
+    /// found flow.
+    ///
+    /// This function returns a const reference to the arc map storing
+    /// the flow that is the union of the found arc-disjoint paths.
+    ///
+    /// \pre \ref run() or \ref findFlow() must be called before using
+    /// this function.
+    const FlowMap& flowMap() const {
+      return *_flow;
+    }
+
+    /// \brief Return a const reference to the node map storing the
+    /// found potentials (the dual solution).
+    ///
+    /// This function returns a const reference to the node map storing
+    /// the found potentials that provide the dual solution of the
+    /// underlying minimum cost flow problem.
+    ///
+    /// \pre \ref run() or \ref findFlow() must be called before using
+    /// this function.
+    const PotentialMap& potentialMap() const {
+      return *_potential;
+    }
+
+    /// \brief Return the flow on the given arc.
+    ///
+    /// This function returns the flow on the given arc.
+    /// It is \c 1 if the arc is involved in one of the found paths,
+    /// otherwise it is \c 0.
+    ///
+    /// \pre \ref run() or \ref findFlow() must be called before using
+    /// this function.
+    int flow(const Arc& arc) const {
+      return (*_flow)[arc];
+    }
+
+    /// \brief Return the potential of the given node.
+    ///
+    /// This function returns the potential of the given node.
+    ///
+    /// \pre \ref run() or \ref findFlow() must be called before using
+    /// this function.
+    Length potential(const Node& node) const {
+      return (*_potential)[node];
+    }
+
+    /// \brief Return the total length (cost) of the found paths (flow).
+    ///
+    /// This function returns the total length (cost) of the found paths
+    /// (flow). The complexity of the function is O(e).
     ///
     /// \pre \ref run() or \ref findFlow() must be called before using
@@ -453,53 +475,4 @@
     }
 
-    /// \brief Return the flow value on the given arc.
-    ///
-    /// This function returns the flow value on the given arc.
-    /// It is \c 1 if the arc is involved in one of the found arc-disjoint
-    /// paths, otherwise it is \c 0.
-    ///
-    /// \pre \ref run() or \ref findFlow() must be called before using
-    /// this function.
-    int flow(const Arc& arc) const {
-      return (*_flow)[arc];
-    }
-
-    /// \brief Return a const reference to an arc map storing the
-    /// found flow.
-    ///
-    /// This function returns a const reference to an arc map storing
-    /// the flow that is the union of the found arc-disjoint paths.
-    ///
-    /// \pre \ref run() or \ref findFlow() must be called before using
-    /// this function.
-    const FlowMap& flowMap() const {
-      return *_flow;
-    }
-
-    /// \brief Return the potential of the given node.
-    ///
-    /// This function returns the potential of the given node.
-    /// The node potentials provide the dual solution of the
-    /// underlying \ref min_cost_flow "minimum cost flow problem".
-    ///
-    /// \pre \ref run() or \ref findFlow() must be called before using
-    /// this function.
-    Length potential(const Node& node) const {
-      return (*_potential)[node];
-    }
-
-    /// \brief Return a const reference to a node map storing the
-    /// found potentials (the dual solution).
-    ///
-    /// This function returns a const reference to a node map storing
-    /// the found potentials that provide the dual solution of the
-    /// underlying \ref min_cost_flow "minimum cost flow problem".
-    ///
-    /// \pre \ref run() or \ref findFlow() must be called before using
-    /// this function.
-    const PotentialMap& potentialMap() const {
-      return *_potential;
-    }
-
     /// \brief Return the number of the found paths.
     ///
@@ -516,5 +489,5 @@
     /// This function returns a const reference to the specified path.
     ///
-    /// \param i The function returns the <tt>i</tt>-th path.
+    /// \param i The function returns the \c i-th path.
     /// \c i must be between \c 0 and <tt>%pathNum()-1</tt>.
     ///
Index: test/CMakeLists.txt
===================================================================
--- test/CMakeLists.txt	(revision 668)
+++ test/CMakeLists.txt	(revision 658)
@@ -3,4 +3,8 @@
   ${PROJECT_BINARY_DIR}
 )
+
+IF(HAVE_GLPK)
+  INCLUDE_DIRECTORIES(${GLPK_INCLUDE_DIR})
+ENDIF(HAVE_GLPK)
 
 LINK_DIRECTORIES(${PROJECT_BINARY_DIR}/lemon)
@@ -39,15 +43,7 @@
 IF(HAVE_LP)
   ADD_EXECUTABLE(lp_test lp_test.cc)
-  SET(LP_TEST_LIBS lemon)
   IF(HAVE_GLPK)
-    SET(LP_TEST_LIBS ${LP_TEST_LIBS} ${GLPK_LIBRARIES})
+    TARGET_LINK_LIBRARIES(lp_test lemon ${GLPK_LIBRARIES})
   ENDIF(HAVE_GLPK)
-  IF(HAVE_CPLEX)
-    SET(LP_TEST_LIBS ${LP_TEST_LIBS} ${CPLEX_LIBRARIES})
-  ENDIF(HAVE_CPLEX)
-  IF(HAVE_CLP)
-    SET(LP_TEST_LIBS ${LP_TEST_LIBS} ${COIN_CLP_LIBRARIES})
-  ENDIF(HAVE_CLP)
-  TARGET_LINK_LIBRARIES(lp_test ${LP_TEST_LIBS})
   ADD_TEST(lp_test lp_test)
 
@@ -61,26 +57,11 @@
     )
   ENDIF(WIN32 AND HAVE_GLPK)
-  IF(WIN32 AND HAVE_CPLEX)
-    GET_TARGET_PROPERTY(TARGET_LOC lp_test LOCATION)
-    GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH)
-    ADD_CUSTOM_COMMAND(TARGET lp_test POST_BUILD
-      COMMAND cmake -E copy ${CPLEX_BIN_DIR}/cplex91.dll ${TARGET_PATH}
-    )
-  ENDIF(WIN32 AND HAVE_CPLEX)
 ENDIF(HAVE_LP)
 
 IF(HAVE_MIP)
   ADD_EXECUTABLE(mip_test mip_test.cc)
-  SET(MIP_TEST_LIBS lemon)
   IF(HAVE_GLPK)
-    SET(MIP_TEST_LIBS ${MIP_TEST_LIBS} ${GLPK_LIBRARIES})
+    TARGET_LINK_LIBRARIES(mip_test lemon ${GLPK_LIBRARIES})
   ENDIF(HAVE_GLPK)
-  IF(HAVE_CPLEX)
-    SET(MIP_TEST_LIBS ${MIP_TEST_LIBS} ${CPLEX_LIBRARIES})
-  ENDIF(HAVE_CPLEX)
-  IF(HAVE_CBC)
-    SET(MIP_TEST_LIBS ${MIP_TEST_LIBS} ${COIN_CBC_LIBRARIES})
-  ENDIF(HAVE_CBC)
-  TARGET_LINK_LIBRARIES(mip_test ${MIP_TEST_LIBS})
   ADD_TEST(mip_test mip_test)
 
@@ -94,11 +75,4 @@
     )
   ENDIF(WIN32 AND HAVE_GLPK)
-  IF(WIN32 AND HAVE_CPLEX)
-    GET_TARGET_PROPERTY(TARGET_LOC mip_test LOCATION)
-    GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH)
-    ADD_CUSTOM_COMMAND(TARGET mip_test POST_BUILD
-      COMMAND cmake -E copy ${CPLEX_BIN_DIR}/cplex91.dll ${TARGET_PATH}
-    )
-  ENDIF(WIN32 AND HAVE_CPLEX)
 ENDIF(HAVE_MIP)
 
Index: test/min_cost_arborescence_test.cc
===================================================================
--- test/min_cost_arborescence_test.cc	(revision 522)
+++ test/min_cost_arborescence_test.cc	(revision 672)
@@ -25,4 +25,5 @@
 #include <lemon/min_cost_arborescence.h>
 #include <lemon/lgf_reader.h>
+#include <lemon/concepts/digraph.h>
 
 #include "test_tools.h"
@@ -71,4 +72,63 @@
   "source 0\n";
 
+
+void checkMinCostArborescenceCompile()
+{
+  typedef double VType;
+  typedef concepts::Digraph Digraph;
+  typedef concepts::ReadMap<Digraph::Arc, VType> CostMap;
+  typedef Digraph::Node Node;
+  typedef Digraph::Arc Arc;
+  typedef concepts::WriteMap<Digraph::Arc, bool> ArbMap;
+  typedef concepts::ReadWriteMap<Digraph::Node, Digraph::Arc> PredMap;
+
+  typedef MinCostArborescence<Digraph, CostMap>::
+            SetArborescenceMap<ArbMap>::
+            SetPredMap<PredMap>::Create MinCostArbType;
+
+  Digraph g;
+  Node s, n;
+  Arc e;
+  VType c;
+  bool b;
+  int i;
+  CostMap cost;
+  ArbMap arb;
+  PredMap pred;
+
+  MinCostArbType mcarb_test(g, cost);
+  const MinCostArbType& const_mcarb_test = mcarb_test;
+
+  mcarb_test
+    .arborescenceMap(arb)
+    .predMap(pred)
+    .run(s);
+
+  mcarb_test.init();
+  mcarb_test.addSource(s);
+  mcarb_test.start();
+  n = mcarb_test.processNextNode();
+  b = const_mcarb_test.emptyQueue();
+  i = const_mcarb_test.queueSize();
+  
+  c = const_mcarb_test.arborescenceCost();
+  b = const_mcarb_test.arborescence(e);
+  e = const_mcarb_test.pred(n);
+  const MinCostArbType::ArborescenceMap &am =
+    const_mcarb_test.arborescenceMap();
+  const MinCostArbType::PredMap &pm =
+    const_mcarb_test.predMap();
+  b = const_mcarb_test.reached(n);
+  b = const_mcarb_test.processed(n);
+  
+  i = const_mcarb_test.dualNum();
+  c = const_mcarb_test.dualValue();
+  i = const_mcarb_test.dualSize(i);
+  c = const_mcarb_test.dualValue(i);
+  
+  ignore_unused_variable_warning(am);
+  ignore_unused_variable_warning(pm);
+}
+
 int main() {
   typedef SmartDigraph Digraph;
@@ -111,17 +171,17 @@
       }
       if (mca.arborescence(it)) {
-        check(sum == cost[it], "INVALID DUAL");
+        check(sum == cost[it], "Invalid dual solution");
       }
-      check(sum <= cost[it], "INVALID DUAL");
+      check(sum <= cost[it], "Invalid dual solution");
     }
   }
 
 
-  check(mca.dualValue() == mca.arborescenceValue(), "INVALID DUAL");
-
-  check(mca.reached(source), "INVALID ARBORESCENCE");
+  check(mca.dualValue() == mca.arborescenceCost(), "Invalid dual solution");
+
+  check(mca.reached(source), "Invalid arborescence");
   for (ArcIt a(digraph); a != INVALID; ++a) {
     check(!mca.reached(digraph.source(a)) ||
-          mca.reached(digraph.target(a)), "INVALID ARBORESCENCE");
+          mca.reached(digraph.target(a)), "Invalid arborescence");
   }
 
@@ -131,15 +191,15 @@
     for (InArcIt a(digraph, n); a != INVALID; ++a) {
       if (mca.arborescence(a)) {
-        check(mca.pred(n) == a, "INVALID ARBORESCENCE");
+        check(mca.pred(n) == a, "Invalid arborescence");
         ++cnt;
       }
     }
-    check((n == source ? cnt == 0 : cnt == 1), "INVALID ARBORESCENCE");
+    check((n == source ? cnt == 0 : cnt == 1), "Invalid arborescence");
   }
 
   Digraph::ArcMap<bool> arborescence(digraph);
-  check(mca.arborescenceValue() ==
+  check(mca.arborescenceCost() ==
         minCostArborescence(digraph, cost, source, arborescence),
-        "WRONG FUNCTION");
+        "Wrong result of the function interface");
 
   return 0;
Index: test/suurballe_test.cc
===================================================================
--- test/suurballe_test.cc	(revision 670)
+++ test/suurballe_test.cc	(revision 463)
@@ -23,5 +23,4 @@
 #include <lemon/path.h>
 #include <lemon/suurballe.h>
-#include <lemon/concepts/digraph.h>
 
 #include "test_tools.h"
@@ -31,94 +30,44 @@
 char test_lgf[] =
   "@nodes\n"
-  "label\n"
-  "1\n"
-  "2\n"
-  "3\n"
-  "4\n"
-  "5\n"
-  "6\n"
-  "7\n"
-  "8\n"
-  "9\n"
-  "10\n"
-  "11\n"
-  "12\n"
+  "label supply1 supply2 supply3\n"
+  "1     0        20      27\n"
+  "2     0       -4        0\n"
+  "3     0        0        0\n"
+  "4     0        0        0\n"
+  "5     0        9        0\n"
+  "6     0       -6        0\n"
+  "7     0        0        0\n"
+  "8     0        0        0\n"
+  "9     0        3        0\n"
+  "10    0       -2        0\n"
+  "11    0        0        0\n"
+  "12    0       -20     -27\n"
   "@arcs\n"
-  "      length\n"
-  " 1  2  70\n"
-  " 1  3 150\n"
-  " 1  4  80\n"
-  " 2  8  80\n"
-  " 3  5 140\n"
-  " 4  6  60\n"
-  " 4  7  80\n"
-  " 4  8 110\n"
-  " 5  7  60\n"
-  " 5 11 120\n"
-  " 6  3   0\n"
-  " 6  9 140\n"
-  " 6 10  90\n"
-  " 7  1  30\n"
-  " 8 12  60\n"
-  " 9 12  50\n"
-  "10 12  70\n"
-  "10  2 100\n"
-  "10  7  60\n"
-  "11 10  20\n"
-  "12 11  30\n"
+  "      cost capacity lower1 lower2\n"
+  " 1  2  70  11       0      8\n"
+  " 1  3 150   3       0      1\n"
+  " 1  4  80  15       0      2\n"
+  " 2  8  80  12       0      0\n"
+  " 3  5 140   5       0      3\n"
+  " 4  6  60  10       0      1\n"
+  " 4  7  80   2       0      0\n"
+  " 4  8 110   3       0      0\n"
+  " 5  7  60  14       0      0\n"
+  " 5 11 120  12       0      0\n"
+  " 6  3   0   3       0      0\n"
+  " 6  9 140   4       0      0\n"
+  " 6 10  90   8       0      0\n"
+  " 7  1  30   5       0      0\n"
+  " 8 12  60  16       0      4\n"
+  " 9 12  50   6       0      0\n"
+  "10 12  70  13       0      5\n"
+  "10  2 100   7       0      0\n"
+  "10  7  60  10       0      0\n"
+  "11 10  20  14       0      6\n"
+  "12 11  30  10       0      0\n"
   "@attributes\n"
   "source  1\n"
   "target 12\n"
   "@end\n";
-
-// Check the interface of Suurballe
-void checkSuurballeCompile()
-{
-  typedef int VType;
-  typedef concepts::Digraph Digraph;
-
-  typedef Digraph::Node Node;
-  typedef Digraph::Arc Arc;
-  typedef concepts::ReadMap<Arc, VType> LengthMap;
-  
-  typedef Suurballe<Digraph, LengthMap> SuurballeType;
-
-  Digraph g;
-  Node n;
-  Arc e;
-  LengthMap len;
-  SuurballeType::FlowMap flow(g);
-  SuurballeType::PotentialMap pi(g);
-
-  SuurballeType suurb_test(g, len);
-  const SuurballeType& const_suurb_test = suurb_test;
-
-  suurb_test
-    .flowMap(flow)
-    .potentialMap(pi);
-
-  int k;
-  k = suurb_test.run(n, n);
-  k = suurb_test.run(n, n, k);
-  suurb_test.init(n);
-  k = suurb_test.findFlow(n);
-  k = suurb_test.findFlow(n, k);
-  suurb_test.findPaths();
-  
-  int f;
-  VType c;
-  c = const_suurb_test.totalLength();
-  f = const_suurb_test.flow(e);
-  const SuurballeType::FlowMap& fm =
-    const_suurb_test.flowMap();
-  c = const_suurb_test.potential(n);
-  const SuurballeType::PotentialMap& pm =
-    const_suurb_test.potentialMap();
-  k = const_suurb_test.pathNum();
-  Path<Digraph> p = const_suurb_test.path(k);
-  
-  ignore_unused_variable_warning(fm);
-  ignore_unused_variable_warning(pm);
-}
 
 // Check the feasibility of the flow
@@ -170,4 +119,5 @@
                 typename Digraph::Node s, typename Digraph::Node t)
 {
+  // Check the "Complementary Slackness" optimality condition
   TEMPLATE_DIGRAPH_TYPEDEFS(Digraph);
   Node n = s;
@@ -187,18 +137,18 @@
   ListDigraph digraph;
   ListDigraph::ArcMap<int> length(digraph);
-  Node s, t;
+  Node source, target;
 
   std::istringstream input(test_lgf);
   DigraphReader<ListDigraph>(digraph, input).
-    arcMap("length", length).
-    node("source", s).
-    node("target", t).
+    arcMap("cost", length).
+    node("source", source).
+    node("target", target).
     run();
 
   // Find 2 paths
   {
-    Suurballe<ListDigraph> suurballe(digraph, length);
-    check(suurballe.run(s, t) == 2, "Wrong number of paths");
-    check(checkFlow(digraph, suurballe.flowMap(), s, t, 2),
+    Suurballe<ListDigraph> suurballe(digraph, length, source, target);
+    check(suurballe.run(2) == 2, "Wrong number of paths");
+    check(checkFlow(digraph, suurballe.flowMap(), source, target, 2),
           "The flow is not feasible");
     check(suurballe.totalLength() == 510, "The flow is not optimal");
@@ -207,12 +157,13 @@
           "Wrong potentials");
     for (int i = 0; i < suurballe.pathNum(); ++i)
-      check(checkPath(digraph, suurballe.path(i), s, t), "Wrong path");
+      check(checkPath(digraph, suurballe.path(i), source, target),
+            "Wrong path");
   }
 
   // Find 3 paths
   {
-    Suurballe<ListDigraph> suurballe(digraph, length);
-    check(suurballe.run(s, t, 3) == 3, "Wrong number of paths");
-    check(checkFlow(digraph, suurballe.flowMap(), s, t, 3),
+    Suurballe<ListDigraph> suurballe(digraph, length, source, target);
+    check(suurballe.run(3) == 3, "Wrong number of paths");
+    check(checkFlow(digraph, suurballe.flowMap(), source, target, 3),
           "The flow is not feasible");
     check(suurballe.totalLength() == 1040, "The flow is not optimal");
@@ -221,12 +172,13 @@
           "Wrong potentials");
     for (int i = 0; i < suurballe.pathNum(); ++i)
-      check(checkPath(digraph, suurballe.path(i), s, t), "Wrong path");
+      check(checkPath(digraph, suurballe.path(i), source, target),
+            "Wrong path");
   }
 
   // Find 5 paths (only 3 can be found)
   {
-    Suurballe<ListDigraph> suurballe(digraph, length);
-    check(suurballe.run(s, t, 5) == 3, "Wrong number of paths");
-    check(checkFlow(digraph, suurballe.flowMap(), s, t, 3),
+    Suurballe<ListDigraph> suurballe(digraph, length, source, target);
+    check(suurballe.run(5) == 3, "Wrong number of paths");
+    check(checkFlow(digraph, suurballe.flowMap(), source, target, 3),
           "The flow is not feasible");
     check(suurballe.totalLength() == 1040, "The flow is not optimal");
@@ -235,5 +187,6 @@
           "Wrong potentials");
     for (int i = 0; i < suurballe.pathNum(); ++i)
-      check(checkPath(digraph, suurballe.path(i), s, t), "Wrong path");
+      check(checkPath(digraph, suurballe.path(i), source, target),
+            "Wrong path");
   }
 
Index: tools/lgf-gen.cc
===================================================================
--- tools/lgf-gen.cc	(revision 670)
+++ tools/lgf-gen.cc	(revision 663)
@@ -481,6 +481,6 @@
       g.erase(*ei);
       ConstMap<Arc,int> cegy(1);
-      Suurballe<ListGraph,ConstMap<Arc,int> > sur(g,cegy);
-      int k=sur.run(a,b,2);
+      Suurballe<ListGraph,ConstMap<Arc,int> > sur(g,cegy,a,b);
+      int k=sur.run(2);
       if(k<2 || sur.totalLength()>d)
         g.addEdge(a,b);
@@ -512,6 +512,7 @@
       if(e==INVALID) {
         ConstMap<Arc,int> cegy(1);
-        Suurballe<ListGraph,ConstMap<Arc,int> > sur(g,cegy);
-        int k=sur.run(pi->a,pi->b,2);
+        Suurballe<ListGraph,ConstMap<Arc,int> >
+          sur(g,cegy,pi->a,pi->b);
+        int k=sur.run(2);
         if(k<2 || sur.totalLength()>d)
           {
