Index: lemon/Makefile.am
===================================================================
--- lemon/Makefile.am	(revision 409)
+++ lemon/Makefile.am	(revision 414)
@@ -21,5 +21,4 @@
         lemon/bfs.h \
         lemon/bin_heap.h \
-        lemon/circulation.h \
         lemon/color.h \
 	lemon/concept_check.h \
@@ -37,5 +36,4 @@
 	lemon/hypercube_graph.h \
 	lemon/kruskal.h \
-	lemon/hao_orlin.h \
 	lemon/lgf_reader.h \
 	lemon/lgf_writer.h \
@@ -61,8 +59,10 @@
 	lemon/bits/default_map.h \
         lemon/bits/enable_if.h \
+	lemon/bits/graph_adaptor_extender.h \
 	lemon/bits/graph_extender.h \
 	lemon/bits/map_extender.h \
 	lemon/bits/path_dump.h \
 	lemon/bits/traits.h \
+	lemon/bits/variant.h \
 	lemon/bits/vector_map.h
 
Index: lemon/bits/graph_adaptor_extender.h
===================================================================
--- lemon/bits/graph_adaptor_extender.h	(revision 414)
+++ lemon/bits/graph_adaptor_extender.h	(revision 414)
@@ -0,0 +1,444 @@
+/* -*- C++ -*-
+ *
+ * This file is a part of LEMON, a generic C++ optimization library
+ *
+ * Copyright (C) 2003-2008
+ * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
+ * (Egervary Research Group on Combinatorial Optimization, EGRES).
+ *
+ * Permission to use, modify and distribute this software is granted
+ * provided that this copyright notice appears in all copies. For
+ * precise terms see the accompanying LICENSE file.
+ *
+ * This software is provided "AS IS" with no warranty of any kind,
+ * express or implied, and with no claim as to its suitability for any
+ * purpose.
+ *
+ */
+
+#ifndef LEMON_BITS_GRAPH_ADAPTOR_EXTENDER_H
+#define LEMON_BITS_GRAPH_ADAPTOR_EXTENDER_H
+
+#include <lemon/core.h>
+#include <lemon/error.h>
+
+#include <lemon/bits/default_map.h>
+
+
+///\ingroup digraphbits
+///\file
+///\brief Extenders for the digraph adaptor types
+namespace lemon {
+
+  /// \ingroup digraphbits
+  ///
+  /// \brief Extender for the DigraphAdaptors
+  template <typename _Digraph>
+  class DigraphAdaptorExtender : public _Digraph {
+  public:
+
+    typedef _Digraph Parent;
+    typedef _Digraph Digraph;
+    typedef DigraphAdaptorExtender Adaptor;
+
+    // Base extensions
+
+    typedef typename Parent::Node Node;
+    typedef typename Parent::Arc Arc;
+
+    int maxId(Node) const {
+      return Parent::maxNodeId();
+    }
+
+    int maxId(Arc) const {
+      return Parent::maxArcId();
+    }
+
+    Node fromId(int id, Node) const {
+      return Parent::nodeFromId(id);
+    }
+
+    Arc fromId(int id, Arc) const {
+      return Parent::arcFromId(id);
+    }
+
+    Node oppositeNode(const Node &n, const Arc &e) const {
+      if (n == Parent::source(e))
+	return Parent::target(e);
+      else if(n==Parent::target(e))
+	return Parent::source(e);
+      else
+	return INVALID;
+    }
+
+    class NodeIt : public Node { 
+      const Adaptor* _adaptor;
+    public:
+
+      NodeIt() {}
+
+      NodeIt(Invalid i) : Node(i) { }
+
+      explicit NodeIt(const Adaptor& adaptor) : _adaptor(&adaptor) {
+	_adaptor->first(static_cast<Node&>(*this));
+      }
+
+      NodeIt(const Adaptor& adaptor, const Node& node) 
+	: Node(node), _adaptor(&adaptor) {}
+
+      NodeIt& operator++() { 
+	_adaptor->next(*this);
+	return *this; 
+      }
+
+    };
+
+
+    class ArcIt : public Arc { 
+      const Adaptor* _adaptor;
+    public:
+
+      ArcIt() { }
+
+      ArcIt(Invalid i) : Arc(i) { }
+
+      explicit ArcIt(const Adaptor& adaptor) : _adaptor(&adaptor) {
+	_adaptor->first(static_cast<Arc&>(*this));
+      }
+
+      ArcIt(const Adaptor& adaptor, const Arc& e) : 
+	Arc(e), _adaptor(&adaptor) { }
+
+      ArcIt& operator++() { 
+	_adaptor->next(*this);
+	return *this; 
+      }
+
+    };
+
+
+    class OutArcIt : public Arc { 
+      const Adaptor* _adaptor;
+    public:
+
+      OutArcIt() { }
+
+      OutArcIt(Invalid i) : Arc(i) { }
+
+      OutArcIt(const Adaptor& adaptor, const Node& node) 
+	: _adaptor(&adaptor) {
+	_adaptor->firstOut(*this, node);
+      }
+
+      OutArcIt(const Adaptor& adaptor, const Arc& arc) 
+	: Arc(arc), _adaptor(&adaptor) {}
+
+      OutArcIt& operator++() { 
+	_adaptor->nextOut(*this);
+	return *this; 
+      }
+
+    };
+
+
+    class InArcIt : public Arc { 
+      const Adaptor* _adaptor;
+    public:
+
+      InArcIt() { }
+
+      InArcIt(Invalid i) : Arc(i) { }
+
+      InArcIt(const Adaptor& adaptor, const Node& node) 
+	: _adaptor(&adaptor) {
+	_adaptor->firstIn(*this, node);
+      }
+
+      InArcIt(const Adaptor& adaptor, const Arc& arc) : 
+	Arc(arc), _adaptor(&adaptor) {}
+
+      InArcIt& operator++() { 
+	_adaptor->nextIn(*this);
+	return *this; 
+      }
+
+    };
+
+    /// \brief Base node of the iterator
+    ///
+    /// Returns the base node (ie. the source in this case) of the iterator
+    Node baseNode(const OutArcIt &e) const {
+      return Parent::source(e);
+    }
+    /// \brief Running node of the iterator
+    ///
+    /// Returns the running node (ie. the target in this case) of the
+    /// iterator
+    Node runningNode(const OutArcIt &e) const {
+      return Parent::target(e);
+    }
+
+    /// \brief Base node of the iterator
+    ///
+    /// Returns the base node (ie. the target in this case) of the iterator
+    Node baseNode(const InArcIt &e) const {
+      return Parent::target(e);
+    }
+    /// \brief Running node of the iterator
+    ///
+    /// Returns the running node (ie. the source in this case) of the
+    /// iterator
+    Node runningNode(const InArcIt &e) const {
+      return Parent::source(e);
+    }
+
+  };
+
+
+  /// \ingroup digraphbits
+  ///
+  /// \brief Extender for the GraphAdaptors
+  template <typename _Graph> 
+  class GraphAdaptorExtender : public _Graph {
+  public:
+    
+    typedef _Graph Parent;
+    typedef _Graph Graph;
+    typedef GraphAdaptorExtender Adaptor;
+
+    typedef typename Parent::Node Node;
+    typedef typename Parent::Arc Arc;
+    typedef typename Parent::Edge Edge;
+
+    // Graph extension    
+
+    int maxId(Node) const {
+      return Parent::maxNodeId();
+    }
+
+    int maxId(Arc) const {
+      return Parent::maxArcId();
+    }
+
+    int maxId(Edge) const {
+      return Parent::maxEdgeId();
+    }
+
+    Node fromId(int id, Node) const {
+      return Parent::nodeFromId(id);
+    }
+
+    Arc fromId(int id, Arc) const {
+      return Parent::arcFromId(id);
+    }
+
+    Edge fromId(int id, Edge) const {
+      return Parent::edgeFromId(id);
+    }
+
+    Node oppositeNode(const Node &n, const Edge &e) const {
+      if( n == Parent::u(e))
+	return Parent::v(e);
+      else if( n == Parent::v(e))
+	return Parent::u(e);
+      else
+	return INVALID;
+    }
+
+    Arc oppositeArc(const Arc &a) const {
+      return Parent::direct(a, !Parent::direction(a));
+    }
+
+    using Parent::direct;
+    Arc direct(const Edge &e, const Node &s) const {
+      return Parent::direct(e, Parent::u(e) == s);
+    }
+
+
+    class NodeIt : public Node { 
+      const Adaptor* _adaptor;
+    public:
+
+      NodeIt() {}
+
+      NodeIt(Invalid i) : Node(i) { }
+
+      explicit NodeIt(const Adaptor& adaptor) : _adaptor(&adaptor) {
+	_adaptor->first(static_cast<Node&>(*this));
+      }
+
+      NodeIt(const Adaptor& adaptor, const Node& node) 
+	: Node(node), _adaptor(&adaptor) {}
+
+      NodeIt& operator++() { 
+	_adaptor->next(*this);
+	return *this; 
+      }
+
+    };
+
+
+    class ArcIt : public Arc { 
+      const Adaptor* _adaptor;
+    public:
+
+      ArcIt() { }
+
+      ArcIt(Invalid i) : Arc(i) { }
+
+      explicit ArcIt(const Adaptor& adaptor) : _adaptor(&adaptor) {
+	_adaptor->first(static_cast<Arc&>(*this));
+      }
+
+      ArcIt(const Adaptor& adaptor, const Arc& e) : 
+	Arc(e), _adaptor(&adaptor) { }
+
+      ArcIt& operator++() { 
+	_adaptor->next(*this);
+	return *this; 
+      }
+
+    };
+
+
+    class OutArcIt : public Arc { 
+      const Adaptor* _adaptor;
+    public:
+
+      OutArcIt() { }
+
+      OutArcIt(Invalid i) : Arc(i) { }
+
+      OutArcIt(const Adaptor& adaptor, const Node& node) 
+	: _adaptor(&adaptor) {
+	_adaptor->firstOut(*this, node);
+      }
+
+      OutArcIt(const Adaptor& adaptor, const Arc& arc) 
+	: Arc(arc), _adaptor(&adaptor) {}
+
+      OutArcIt& operator++() { 
+	_adaptor->nextOut(*this);
+	return *this; 
+      }
+
+    };
+
+
+    class InArcIt : public Arc { 
+      const Adaptor* _adaptor;
+    public:
+
+      InArcIt() { }
+
+      InArcIt(Invalid i) : Arc(i) { }
+
+      InArcIt(const Adaptor& adaptor, const Node& node) 
+	: _adaptor(&adaptor) {
+	_adaptor->firstIn(*this, node);
+      }
+
+      InArcIt(const Adaptor& adaptor, const Arc& arc) : 
+	Arc(arc), _adaptor(&adaptor) {}
+
+      InArcIt& operator++() { 
+	_adaptor->nextIn(*this);
+	return *this; 
+      }
+
+    };
+
+    class EdgeIt : public Parent::Edge { 
+      const Adaptor* _adaptor;
+    public:
+
+      EdgeIt() { }
+
+      EdgeIt(Invalid i) : Edge(i) { }
+
+      explicit EdgeIt(const Adaptor& adaptor) : _adaptor(&adaptor) {
+	_adaptor->first(static_cast<Edge&>(*this));
+      }
+
+      EdgeIt(const Adaptor& adaptor, const Edge& e) : 
+	Edge(e), _adaptor(&adaptor) { }
+
+      EdgeIt& operator++() { 
+	_adaptor->next(*this);
+	return *this; 
+      }
+
+    };
+
+    class IncEdgeIt : public Edge { 
+      friend class GraphAdaptorExtender;
+      const Adaptor* _adaptor;
+      bool direction;
+    public:
+
+      IncEdgeIt() { }
+
+      IncEdgeIt(Invalid i) : Edge(i), direction(false) { }
+
+      IncEdgeIt(const Adaptor& adaptor, const Node &n) : _adaptor(&adaptor) {
+	_adaptor->firstInc(static_cast<Edge&>(*this), direction, n);
+      }
+
+      IncEdgeIt(const Adaptor& adaptor, const Edge &e, const Node &n)
+	: _adaptor(&adaptor), Edge(e) {
+	direction = (_adaptor->u(e) == n);
+      }
+
+      IncEdgeIt& operator++() {
+	_adaptor->nextInc(*this, direction);
+	return *this; 
+      }
+    };
+
+    /// \brief Base node of the iterator
+    ///
+    /// Returns the base node (ie. the source in this case) of the iterator
+    Node baseNode(const OutArcIt &a) const {
+      return Parent::source(a);
+    }
+    /// \brief Running node of the iterator
+    ///
+    /// Returns the running node (ie. the target in this case) of the
+    /// iterator
+    Node runningNode(const OutArcIt &a) const {
+      return Parent::target(a);
+    }
+
+    /// \brief Base node of the iterator
+    ///
+    /// Returns the base node (ie. the target in this case) of the iterator
+    Node baseNode(const InArcIt &a) const {
+      return Parent::target(a);
+    }
+    /// \brief Running node of the iterator
+    ///
+    /// Returns the running node (ie. the source in this case) of the
+    /// iterator
+    Node runningNode(const InArcIt &a) const {
+      return Parent::source(a);
+    }
+
+    /// Base node of the iterator
+    ///
+    /// Returns the base node of the iterator
+    Node baseNode(const IncEdgeIt &e) const {
+      return e.direction ? Parent::u(e) : Parent::v(e);
+    }
+    /// Running node of the iterator
+    ///
+    /// Returns the running node of the iterator
+    Node runningNode(const IncEdgeIt &e) const {
+      return e.direction ? Parent::v(e) : Parent::u(e);
+    }
+
+  };
+
+}
+
+
+#endif
Index: lemon/bits/variant.h
===================================================================
--- lemon/bits/variant.h	(revision 414)
+++ lemon/bits/variant.h	(revision 414)
@@ -0,0 +1,494 @@
+/* -*- C++ -*-
+ *
+ * This file is a part of LEMON, a generic C++ optimization library
+ *
+ * Copyright (C) 2003-2008
+ * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
+ * (Egervary Research Group on Combinatorial Optimization, EGRES).
+ *
+ * Permission to use, modify and distribute this software is granted
+ * provided that this copyright notice appears in all copies. For
+ * precise terms see the accompanying LICENSE file.
+ *
+ * This software is provided "AS IS" with no warranty of any kind,
+ * express or implied, and with no claim as to its suitability for any
+ * purpose.
+ *
+ */
+
+#ifndef LEMON_BITS_VARIANT_H
+#define LEMON_BITS_VARIANT_H
+
+#include <lemon/assert.h>
+
+/// \file
+/// \brief Variant types
+
+namespace lemon {
+
+  namespace _variant_bits {
+  
+    template <int left, int right>
+    struct CTMax {
+      static const int value = left < right ? right : left;
+    };
+
+  }
+
+
+  /// \brief Simple Variant type for two types
+  ///
+  /// Simple Variant type for two types. The Variant type is a type
+  /// safe union. The C++ has strong limitations for using unions, by
+  /// example we can not store type with non default constructor or
+  /// destructor in an union. This class always knowns the current
+  /// state of the variant and it cares for the proper construction
+  /// and destruction.
+  template <typename _First, typename _Second>
+  class BiVariant {
+  public:
+
+    /// \brief The \c First type.
+    typedef _First First;
+    /// \brief The \c Second type.
+    typedef _Second Second;
+
+    /// \brief Constructor
+    ///
+    /// This constructor initalizes to the default value of the \c First
+    /// type.
+    BiVariant() {
+      flag = true;
+      new(reinterpret_cast<First*>(data)) First();
+    }
+
+    /// \brief Constructor
+    ///
+    /// This constructor initalizes to the given value of the \c First
+    /// type.
+    BiVariant(const First& f) {
+      flag = true;
+      new(reinterpret_cast<First*>(data)) First(f);
+    }
+
+    /// \brief Constructor
+    ///
+    /// This constructor initalizes to the given value of the \c
+    /// Second type.
+    BiVariant(const Second& s) {
+      flag = false;
+      new(reinterpret_cast<Second*>(data)) Second(s);
+    }
+
+    /// \brief Copy constructor
+    ///
+    /// Copy constructor
+    BiVariant(const BiVariant& bivariant) {
+      flag = bivariant.flag;
+      if (flag) {
+        new(reinterpret_cast<First*>(data)) First(bivariant.first());      
+      } else {
+        new(reinterpret_cast<Second*>(data)) Second(bivariant.second());      
+      }
+    }
+
+    /// \brief Destrcutor
+    ///
+    /// Destructor
+    ~BiVariant() {
+      destroy();
+    }
+
+    /// \brief Set to the default value of the \c First type.
+    ///
+    /// This function sets the variant to the default value of the \c
+    /// First type.
+    BiVariant& setFirst() {
+      destroy();
+      flag = true;
+      new(reinterpret_cast<First*>(data)) First();   
+      return *this;
+    }
+
+    /// \brief Set to the given value of the \c First type.
+    ///
+    /// This function sets the variant to the given value of the \c
+    /// First type.
+    BiVariant& setFirst(const First& f) {
+      destroy();
+      flag = true;
+      new(reinterpret_cast<First*>(data)) First(f);   
+      return *this;
+    }
+
+    /// \brief Set to the default value of the \c Second type.
+    ///
+    /// This function sets the variant to the default value of the \c
+    /// Second type.
+    BiVariant& setSecond() {
+      destroy();
+      flag = false;
+      new(reinterpret_cast<Second*>(data)) Second();   
+      return *this;
+    }
+
+    /// \brief Set to the given value of the \c Second type.
+    ///
+    /// This function sets the variant to the given value of the \c
+    /// Second type.
+    BiVariant& setSecond(const Second& s) {
+      destroy();
+      flag = false;
+      new(reinterpret_cast<Second*>(data)) Second(s);   
+      return *this;
+    }
+
+    /// \brief Operator form of the \c setFirst()
+    BiVariant& operator=(const First& f) {
+      return setFirst(f);
+    }
+
+    /// \brief Operator form of the \c setSecond()
+    BiVariant& operator=(const Second& s) {
+      return setSecond(s);
+    }
+
+    /// \brief Assign operator
+    BiVariant& operator=(const BiVariant& bivariant) {
+      if (this == &bivariant) return *this;
+      destroy();
+      flag = bivariant.flag;
+      if (flag) {
+        new(reinterpret_cast<First*>(data)) First(bivariant.first());      
+      } else {
+        new(reinterpret_cast<Second*>(data)) Second(bivariant.second());      
+      }
+      return *this;
+    }
+
+    /// \brief Reference to the value
+    ///
+    /// Reference to the value of the \c First type.
+    /// \pre The BiVariant should store value of \c First type.
+    First& first() {
+      LEMON_DEBUG(flag, "Variant wrong state");
+      return *reinterpret_cast<First*>(data); 
+    }
+
+    /// \brief Const reference to the value
+    ///
+    /// Const reference to the value of the \c First type.
+    /// \pre The BiVariant should store value of \c First type.
+    const First& first() const { 
+      LEMON_DEBUG(flag, "Variant wrong state");
+      return *reinterpret_cast<const First*>(data); 
+    }
+
+    /// \brief Operator form of the \c first()
+    operator First&() { return first(); }
+    /// \brief Operator form of the const \c first()
+    operator const First&() const { return first(); }
+
+    /// \brief Reference to the value
+    ///
+    /// Reference to the value of the \c Second type.
+    /// \pre The BiVariant should store value of \c Second type.
+    Second& second() { 
+      LEMON_DEBUG(!flag, "Variant wrong state");
+      return *reinterpret_cast<Second*>(data); 
+    }
+
+    /// \brief Const reference to the value
+    ///
+    /// Const reference to the value of the \c Second type.
+    /// \pre The BiVariant should store value of \c Second type.
+    const Second& second() const { 
+      LEMON_DEBUG(!flag, "Variant wrong state");
+      return *reinterpret_cast<const Second*>(data); 
+    }
+
+    /// \brief Operator form of the \c second()
+    operator Second&() { return second(); }
+    /// \brief Operator form of the const \c second()
+    operator const Second&() const { return second(); }
+
+    /// \brief %True when the variant is in the first state
+    ///
+    /// %True when the variant stores value of the \c First type.
+    bool firstState() const { return flag; }
+
+    /// \brief %True when the variant is in the second state
+    ///
+    /// %True when the variant stores value of the \c Second type.
+    bool secondState() const { return !flag; }
+
+  private:
+
+    void destroy() {
+      if (flag) {
+        reinterpret_cast<First*>(data)->~First();
+      } else {
+        reinterpret_cast<Second*>(data)->~Second();
+      }
+    }
+    
+    char data[_variant_bits::CTMax<sizeof(First), sizeof(Second)>::value];
+    bool flag;
+  };
+
+  namespace _variant_bits {
+    
+    template <int _idx, typename _TypeMap>
+    struct Memory {
+
+      typedef typename _TypeMap::template Map<_idx>::Type Current;
+
+      static void destroy(int index, char* place) {
+        if (index == _idx) {
+          reinterpret_cast<Current*>(place)->~Current();
+        } else {
+          Memory<_idx - 1, _TypeMap>::destroy(index, place);
+        }
+      }
+
+      static void copy(int index, char* to, const char* from) {
+        if (index == _idx) {
+          new (reinterpret_cast<Current*>(to))
+            Current(reinterpret_cast<const Current*>(from));
+        } else {
+          Memory<_idx - 1, _TypeMap>::copy(index, to, from);
+        }
+      }
+
+    };
+
+    template <typename _TypeMap>
+    struct Memory<-1, _TypeMap> {
+
+      static void destroy(int, char*) {
+        LEMON_DEBUG(false, "Variant wrong index.");
+      }
+
+      static void copy(int, char*, const char*) {
+        LEMON_DEBUG(false, "Variant wrong index.");
+      }
+    };
+
+    template <int _idx, typename _TypeMap>
+    struct Size {
+      static const int value = 
+      CTMax<sizeof(typename _TypeMap::template Map<_idx>::Type), 
+            Size<_idx - 1, _TypeMap>::value>::value;
+    };
+
+    template <typename _TypeMap>
+    struct Size<0, _TypeMap> {
+      static const int value = 
+      sizeof(typename _TypeMap::template Map<0>::Type);
+    };
+
+  }
+
+  /// \brief Variant type
+  ///
+  /// Simple Variant type. The Variant type is a type safe union. The
+  /// C++ has strong limitations for using unions, for example we
+  /// cannot store type with non default constructor or destructor in
+  /// a union. This class always knowns the current state of the
+  /// variant and it cares for the proper construction and
+  /// destruction.
+  ///
+  /// \param _num The number of the types which can be stored in the
+  /// variant type.
+  /// \param _TypeMap This class describes the types of the Variant. The
+  /// _TypeMap::Map<index>::Type should be a valid type for each index 
+  /// in the range {0, 1, ..., _num - 1}. The \c VariantTypeMap is helper
+  /// class to define such type mappings up to 10 types.
+  ///
+  /// And the usage of the class:
+  ///\code
+  /// typedef Variant<3, VariantTypeMap<int, std::string, double> > MyVariant;
+  /// MyVariant var;
+  /// var.set<0>(12);
+  /// std::cout << var.get<0>() << std::endl;
+  /// var.set<1>("alpha");
+  /// std::cout << var.get<1>() << std::endl;
+  /// var.set<2>(0.75);
+  /// std::cout << var.get<2>() << std::endl;
+  ///\endcode
+  ///
+  /// The result of course:
+  ///\code
+  /// 12
+  /// alpha
+  /// 0.75
+  ///\endcode
+  template <int _num, typename _TypeMap>
+  class Variant {
+  public:
+
+    static const int num = _num;
+
+    typedef _TypeMap TypeMap;
+
+    /// \brief Constructor
+    ///
+    /// This constructor initalizes to the default value of the \c type
+    /// with 0 index.
+    Variant() {
+      flag = 0;
+      new(reinterpret_cast<typename TypeMap::template Map<0>::Type*>(data)) 
+        typename TypeMap::template Map<0>::Type();
+    }
+
+
+    /// \brief Copy constructor
+    ///
+    /// Copy constructor
+    Variant(const Variant& variant) {
+      flag = variant.flag;
+      _variant_bits::Memory<num - 1, TypeMap>::copy(flag, data, variant.data);
+    }
+
+    /// \brief Assign operator
+    ///
+    /// Assign operator
+    Variant& operator=(const Variant& variant) {
+      if (this == &variant) return *this;
+      _variant_bits::Memory<num - 1, TypeMap>::
+        destroy(flag, data);
+      flag = variant.flag;
+      _variant_bits::Memory<num - 1, TypeMap>::
+        copy(flag, data, variant.data);
+      return *this;
+    }
+
+    /// \brief Destrcutor
+    ///
+    /// Destructor
+    ~Variant() {
+      _variant_bits::Memory<num - 1, TypeMap>::destroy(flag, data);
+    }
+
+    /// \brief Set to the default value of the type with \c _idx index.
+    ///
+    /// This function sets the variant to the default value of the
+    /// type with \c _idx index.
+    template <int _idx>
+    Variant& set() {
+      _variant_bits::Memory<num - 1, TypeMap>::destroy(flag, data);
+      flag = _idx;
+      new(reinterpret_cast<typename TypeMap::template Map<_idx>::Type*>(data)) 
+        typename TypeMap::template Map<_idx>::Type();
+      return *this;
+    }
+
+    /// \brief Set to the given value of the type with \c _idx index.
+    ///
+    /// This function sets the variant to the given value of the type
+    /// with \c _idx index.
+    template <int _idx>
+    Variant& set(const typename _TypeMap::template Map<_idx>::Type& init) {
+      _variant_bits::Memory<num - 1, TypeMap>::destroy(flag, data);
+      flag = _idx;
+      new(reinterpret_cast<typename TypeMap::template Map<_idx>::Type*>(data)) 
+        typename TypeMap::template Map<_idx>::Type(init);
+      return *this;
+    }
+
+    /// \brief Gets the current value of the type with \c _idx index.
+    ///
+    /// Gets the current value of the type with \c _idx index.
+    template <int _idx>
+    const typename TypeMap::template Map<_idx>::Type& get() const {
+      LEMON_DEBUG(_idx == flag, "Variant wrong index");
+      return *reinterpret_cast<const typename TypeMap::
+        template Map<_idx>::Type*>(data); 
+    }
+
+    /// \brief Gets the current value of the type with \c _idx index.
+    ///
+    /// Gets the current value of the type with \c _idx index.
+    template <int _idx>
+    typename _TypeMap::template Map<_idx>::Type& get() {
+      LEMON_DEBUG(_idx == flag, "Variant wrong index");
+      return *reinterpret_cast<typename TypeMap::template Map<_idx>::Type*>
+        (data); 
+    }
+
+    /// \brief Returns the current state of the variant.
+    ///
+    /// Returns the current state of the variant.
+    int state() const {
+      return flag;
+    }
+
+  private:
+    
+    char data[_variant_bits::Size<num - 1, TypeMap>::value];
+    int flag;
+  };
+
+  namespace _variant_bits {
+
+    template <int _index, typename _List>
+    struct Get {
+      typedef typename Get<_index - 1, typename _List::Next>::Type Type;
+    };
+
+    template <typename _List>
+    struct Get<0, _List> {
+      typedef typename _List::Type Type;
+    };
+
+    struct List {};
+    
+    template <typename _Type, typename _List>
+    struct Insert {
+      typedef _List Next;
+      typedef _Type Type;
+    };
+
+    template <int _idx, typename _T0, typename _T1, typename _T2, 
+              typename _T3, typename _T5, typename _T4, typename _T6,
+              typename _T7, typename _T8, typename _T9>
+    struct Mapper {
+      typedef List L10;
+      typedef Insert<_T9, L10> L9;
+      typedef Insert<_T8, L9> L8;
+      typedef Insert<_T7, L8> L7;
+      typedef Insert<_T6, L7> L6;
+      typedef Insert<_T5, L6> L5;
+      typedef Insert<_T4, L5> L4;
+      typedef Insert<_T3, L4> L3;
+      typedef Insert<_T2, L3> L2;
+      typedef Insert<_T1, L2> L1;
+      typedef Insert<_T0, L1> L0;
+      typedef typename Get<_idx, L0>::Type Type;
+    };
+    
+  }
+
+  /// \brief Helper class for Variant
+  ///
+  /// Helper class to define type mappings for Variant. This class
+  /// converts the template parameters to be mappable by integer.
+  /// \see Variant
+  template <
+    typename _T0, 
+    typename _T1 = void, typename _T2 = void, typename _T3 = void,
+    typename _T5 = void, typename _T4 = void, typename _T6 = void,
+    typename _T7 = void, typename _T8 = void, typename _T9 = void>
+  struct VariantTypeMap {
+    template <int _idx>
+    struct Map {
+      typedef typename _variant_bits::
+      Mapper<_idx, _T0, _T1, _T2, _T3, _T4, _T5, _T6, _T7, _T8, _T9>::Type
+      Type;
+    };
+  };
+  
+}
+
+
+#endif
Index: lemon/circulation.h
===================================================================
--- lemon/circulation.h	(revision 402)
+++ 	(revision )
@@ -1,755 +1,0 @@
-/* -*- mode: C++; indent-tabs-mode: nil; -*-
- *
- * This file is a part of LEMON, a generic C++ optimization library.
- *
- * Copyright (C) 2003-2008
- * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
- * (Egervary Research Group on Combinatorial Optimization, EGRES).
- *
- * Permission to use, modify and distribute this software is granted
- * provided that this copyright notice appears in all copies. For
- * precise terms see the accompanying LICENSE file.
- *
- * This software is provided "AS IS" with no warranty of any kind,
- * express or implied, and with no claim as to its suitability for any
- * purpose.
- *
- */
-
-#ifndef LEMON_CIRCULATION_H
-#define LEMON_CIRCULATION_H
-
-#include <lemon/tolerance.h>
-#include <lemon/elevator.h>
-
-///\ingroup max_flow
-///\file
-///\brief Push-relabel algorithm for finding a feasible circulation.
-///
-namespace lemon {
-
-  /// \brief Default traits class of Circulation class.
-  ///
-  /// Default traits class of Circulation class.
-  /// \tparam _Diraph Digraph type.
-  /// \tparam _LCapMap Lower bound capacity map type.
-  /// \tparam _UCapMap Upper bound capacity map type.
-  /// \tparam _DeltaMap Delta map type.
-  template <typename _Diraph, typename _LCapMap,
-            typename _UCapMap, typename _DeltaMap>
-  struct CirculationDefaultTraits {
-
-    /// \brief The type of the digraph the algorithm runs on.
-    typedef _Diraph Digraph;
-
-    /// \brief The type of the map that stores the circulation lower
-    /// bound.
-    ///
-    /// The type of the map that stores the circulation lower bound.
-    /// It must meet the \ref concepts::ReadMap "ReadMap" concept.
-    typedef _LCapMap LCapMap;
-
-    /// \brief The type of the map that stores the circulation upper
-    /// bound.
-    ///
-    /// The type of the map that stores the circulation upper bound.
-    /// It must meet the \ref concepts::ReadMap "ReadMap" concept.
-    typedef _UCapMap UCapMap;
-
-    /// \brief The type of the map that stores the lower bound for
-    /// the supply of the nodes.
-    ///
-    /// The type of the map that stores the lower bound for the supply
-    /// of the nodes. It must meet the \ref concepts::ReadMap "ReadMap"
-    /// concept.
-    typedef _DeltaMap DeltaMap;
-
-    /// \brief The type of the flow values.
-    typedef typename DeltaMap::Value Value;
-
-    /// \brief The type of the map that stores the flow values.
-    ///
-    /// 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;
-
-    /// \brief Instantiates a FlowMap.
-    ///
-    /// This function instantiates a \ref FlowMap.
-    /// \param digraph The digraph, to which we would like to define
-    /// the flow map.
-    static FlowMap* createFlowMap(const Digraph& digraph) {
-      return new FlowMap(digraph);
-    }
-
-    /// \brief The elevator type used by the algorithm.
-    ///
-    /// The elevator type used by the algorithm.
-    ///
-    /// \sa Elevator
-    /// \sa LinkedElevator
-    typedef lemon::Elevator<Digraph, typename Digraph::Node> Elevator;
-
-    /// \brief Instantiates an Elevator.
-    ///
-    /// This function instantiates an \ref Elevator.
-    /// \param digraph The digraph, to which we would like to define
-    /// the elevator.
-    /// \param max_level The maximum level of the elevator.
-    static Elevator* createElevator(const Digraph& digraph, int max_level) {
-      return new Elevator(digraph, max_level);
-    }
-
-    /// \brief The tolerance used by the algorithm
-    ///
-    /// The tolerance used by the algorithm to handle inexact computation.
-    typedef lemon::Tolerance<Value> Tolerance;
-
-  };
-
-  /**
-     \brief Push-relabel algorithm for the network circulation problem.
-
-     \ingroup max_flow
-     This class implements a push-relabel algorithm for the network
-     circulation problem.
-     It is to find a feasible circulation when lower and upper bounds
-     are given for the flow values on the arcs and lower bounds
-     are given for the supply values of the nodes.
-
-     The exact formulation of this problem is the following.
-     Let \f$G=(V,A)\f$ be a digraph,
-     \f$lower, upper: A\rightarrow\mathbf{R}^+_0\f$,
-     \f$delta: V\rightarrow\mathbf{R}\f$. Find a feasible circulation
-     \f$f: A\rightarrow\mathbf{R}^+_0\f$ so that
-     \f[ \sum_{a\in\delta_{out}(v)} f(a) - \sum_{a\in\delta_{in}(v)} f(a)
-     \geq delta(v) \quad \forall v\in V, \f]
-     \f[ lower(a)\leq f(a) \leq upper(a) \quad \forall a\in A. \f]
-     \note \f$delta(v)\f$ specifies a lower bound for the supply of node
-     \f$v\f$. It can be either positive or negative, however note that
-     \f$\sum_{v\in V}delta(v)\f$ should be zero or negative in order to
-     have a feasible solution.
-
-     \note A special case of this problem is when
-     \f$\sum_{v\in V}delta(v) = 0\f$. Then the supply of each node \f$v\f$
-     will be \e equal \e to \f$delta(v)\f$, if a circulation can be found.
-     Thus a feasible solution for the
-     \ref min_cost_flow "minimum cost flow" problem can be calculated
-     in this way.
-
-     \tparam _Digraph The type of the digraph the algorithm runs on.
-     \tparam _LCapMap The type of the lower bound capacity map. The default
-     map type is \ref concepts::Digraph::ArcMap "_Digraph::ArcMap<int>".
-     \tparam _UCapMap The type of the upper bound capacity map. The default
-     map type is \c _LCapMap.
-     \tparam _DeltaMap The type of the map that stores the lower bound
-     for the supply of the nodes. The default map type is
-     \c _Digraph::ArcMap<_UCapMap::Value>.
-  */
-#ifdef DOXYGEN
-template< typename _Digraph,
-          typename _LCapMap,
-          typename _UCapMap,
-          typename _DeltaMap,
-          typename _Traits >
-#else
-template< typename _Digraph,
-          typename _LCapMap = typename _Digraph::template ArcMap<int>,
-          typename _UCapMap = _LCapMap,
-          typename _DeltaMap = typename _Digraph::
-                               template NodeMap<typename _UCapMap::Value>,
-          typename _Traits=CirculationDefaultTraits<_Digraph, _LCapMap,
-                                                    _UCapMap, _DeltaMap> >
-#endif
-  class Circulation {
-  public:
-
-    ///The \ref CirculationDefaultTraits "traits class" of the algorithm.
-    typedef _Traits Traits;
-    ///The type of the digraph the algorithm runs on.
-    typedef typename Traits::Digraph Digraph;
-    ///The type of the flow values.
-    typedef typename Traits::Value Value;
-
-    /// The type of the lower bound capacity map.
-    typedef typename Traits::LCapMap LCapMap;
-    /// The type of the upper bound capacity map.
-    typedef typename Traits::UCapMap UCapMap;
-    /// \brief The type of the map that stores the lower bound for
-    /// the supply of the nodes.
-    typedef typename Traits::DeltaMap DeltaMap;
-    ///The type of the flow map.
-    typedef typename Traits::FlowMap FlowMap;
-
-    ///The type of the elevator.
-    typedef typename Traits::Elevator Elevator;
-    ///The type of the tolerance.
-    typedef typename Traits::Tolerance Tolerance;
-
-  private:
-
-    TEMPLATE_DIGRAPH_TYPEDEFS(Digraph);
-
-    const Digraph &_g;
-    int _node_num;
-
-    const LCapMap *_lo;
-    const UCapMap *_up;
-    const DeltaMap *_delta;
-
-    FlowMap *_flow;
-    bool _local_flow;
-
-    Elevator* _level;
-    bool _local_level;
-
-    typedef typename Digraph::template NodeMap<Value> ExcessMap;
-    ExcessMap* _excess;
-
-    Tolerance _tol;
-    int _el;
-
-  public:
-
-    typedef Circulation Create;
-
-    ///\name Named Template Parameters
-
-    ///@{
-
-    template <typename _FlowMap>
-    struct SetFlowMapTraits : public Traits {
-      typedef _FlowMap FlowMap;
-      static FlowMap *createFlowMap(const Digraph&) {
-        LEMON_ASSERT(false, "FlowMap is not initialized");
-        return 0; // ignore warnings
-      }
-    };
-
-    /// \brief \ref named-templ-param "Named parameter" for setting
-    /// FlowMap type
-    ///
-    /// \ref named-templ-param "Named parameter" for setting FlowMap
-    /// type.
-    template <typename _FlowMap>
-    struct SetFlowMap
-      : public Circulation<Digraph, LCapMap, UCapMap, DeltaMap,
-                           SetFlowMapTraits<_FlowMap> > {
-      typedef Circulation<Digraph, LCapMap, UCapMap, DeltaMap,
-                          SetFlowMapTraits<_FlowMap> > Create;
-    };
-
-    template <typename _Elevator>
-    struct SetElevatorTraits : public Traits {
-      typedef _Elevator Elevator;
-      static Elevator *createElevator(const Digraph&, int) {
-        LEMON_ASSERT(false, "Elevator is not initialized");
-        return 0; // ignore warnings
-      }
-    };
-
-    /// \brief \ref named-templ-param "Named parameter" for setting
-    /// Elevator type
-    ///
-    /// \ref named-templ-param "Named parameter" for setting Elevator
-    /// type. If this named parameter is used, then an external
-    /// elevator object must be passed to the algorithm using the
-    /// \ref elevator(Elevator&) "elevator()" function before calling
-    /// \ref run() or \ref init().
-    /// \sa SetStandardElevator
-    template <typename _Elevator>
-    struct SetElevator
-      : public Circulation<Digraph, LCapMap, UCapMap, DeltaMap,
-                           SetElevatorTraits<_Elevator> > {
-      typedef Circulation<Digraph, LCapMap, UCapMap, DeltaMap,
-                          SetElevatorTraits<_Elevator> > Create;
-    };
-
-    template <typename _Elevator>
-    struct SetStandardElevatorTraits : public Traits {
-      typedef _Elevator Elevator;
-      static Elevator *createElevator(const Digraph& digraph, int max_level) {
-        return new Elevator(digraph, max_level);
-      }
-    };
-
-    /// \brief \ref named-templ-param "Named parameter" for setting
-    /// Elevator type with automatic allocation
-    ///
-    /// \ref named-templ-param "Named parameter" for setting Elevator
-    /// type with automatic allocation.
-    /// The Elevator should have standard constructor interface to be
-    /// 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
-    /// algorithm with the \ref elevator(Elevator&) "elevator()" function
-    /// before calling \ref run() or \ref init().
-    /// \sa SetElevator
-    template <typename _Elevator>
-    struct SetStandardElevator
-      : public Circulation<Digraph, LCapMap, UCapMap, DeltaMap,
-                       SetStandardElevatorTraits<_Elevator> > {
-      typedef Circulation<Digraph, LCapMap, UCapMap, DeltaMap,
-                      SetStandardElevatorTraits<_Elevator> > Create;
-    };
-
-    /// @}
-
-  protected:
-
-    Circulation() {}
-
-  public:
-
-    /// The constructor of the class.
-
-    /// The constructor of the class.
-    /// \param g The digraph the algorithm runs on.
-    /// \param lo The lower bound capacity of the arcs.
-    /// \param up The upper bound capacity of the arcs.
-    /// \param delta The lower bound for the supply of the nodes.
-    Circulation(const Digraph &g,const LCapMap &lo,
-                const UCapMap &up,const DeltaMap &delta)
-      : _g(g), _node_num(),
-        _lo(&lo),_up(&up),_delta(&delta),_flow(0),_local_flow(false),
-        _level(0), _local_level(false), _excess(0), _el() {}
-
-    /// Destructor.
-    ~Circulation() {
-      destroyStructures();
-    }
-
-
-  private:
-
-    void createStructures() {
-      _node_num = _el = countNodes(_g);
-
-      if (!_flow) {
-        _flow = Traits::createFlowMap(_g);
-        _local_flow = true;
-      }
-      if (!_level) {
-        _level = Traits::createElevator(_g, _node_num);
-        _local_level = true;
-      }
-      if (!_excess) {
-        _excess = new ExcessMap(_g);
-      }
-    }
-
-    void destroyStructures() {
-      if (_local_flow) {
-        delete _flow;
-      }
-      if (_local_level) {
-        delete _level;
-      }
-      if (_excess) {
-        delete _excess;
-      }
-    }
-
-  public:
-
-    /// Sets the lower bound capacity map.
-
-    /// Sets the lower bound capacity map.
-    /// \return <tt>(*this)</tt>
-    Circulation& lowerCapMap(const LCapMap& map) {
-      _lo = &map;
-      return *this;
-    }
-
-    /// Sets the upper bound capacity map.
-
-    /// Sets the upper bound capacity map.
-    /// \return <tt>(*this)</tt>
-    Circulation& upperCapMap(const LCapMap& map) {
-      _up = &map;
-      return *this;
-    }
-
-    /// Sets the lower bound map for the supply of the nodes.
-
-    /// Sets the lower bound map for the supply of the nodes.
-    /// \return <tt>(*this)</tt>
-    Circulation& deltaMap(const DeltaMap& map) {
-      _delta = &map;
-      return *this;
-    }
-
-    /// \brief Sets the flow map.
-    ///
-    /// Sets the flow map.
-    /// If you don't use this function before calling \ref run() or
-    /// \ref init(), an instance will be allocated automatically.
-    /// The destructor deallocates this automatically allocated map,
-    /// of course.
-    /// \return <tt>(*this)</tt>
-    Circulation& flowMap(FlowMap& map) {
-      if (_local_flow) {
-        delete _flow;
-        _local_flow = false;
-      }
-      _flow = &map;
-      return *this;
-    }
-
-    /// \brief Sets the elevator used by algorithm.
-    ///
-    /// Sets the elevator used by algorithm.
-    /// If you don't use this function before calling \ref run() or
-    /// \ref init(), an instance will be allocated automatically.
-    /// The destructor deallocates this automatically allocated elevator,
-    /// of course.
-    /// \return <tt>(*this)</tt>
-    Circulation& elevator(Elevator& elevator) {
-      if (_local_level) {
-        delete _level;
-        _local_level = false;
-      }
-      _level = &elevator;
-      return *this;
-    }
-
-    /// \brief Returns a const reference to the elevator.
-    ///
-    /// Returns a const reference to the elevator.
-    ///
-    /// \pre Either \ref run() or \ref init() must be called before
-    /// using this function.
-    const Elevator& elevator() {
-      return *_level;
-    }
-
-    /// \brief Sets the tolerance used by algorithm.
-    ///
-    /// Sets the tolerance used by algorithm.
-    Circulation& tolerance(const Tolerance& tolerance) const {
-      _tol = tolerance;
-      return *this;
-    }
-
-    /// \brief Returns a const reference to the tolerance.
-    ///
-    /// Returns a const reference to the tolerance.
-    const Tolerance& tolerance() const {
-      return tolerance;
-    }
-
-    /// \name Execution Control
-    /// The simplest way to execute the algorithm is to call \ref run().\n
-    /// If you need more control on the initial solution or the execution,
-    /// first you have to call one of the \ref init() functions, then
-    /// the \ref start() function.
-
-    ///@{
-
-    /// Initializes the internal data structures.
-
-    /// Initializes the internal data structures and sets all flow values
-    /// to the lower bound.
-    void init()
-    {
-      createStructures();
-
-      for(NodeIt n(_g);n!=INVALID;++n) {
-        _excess->set(n, (*_delta)[n]);
-      }
-
-      for (ArcIt e(_g);e!=INVALID;++e) {
-        _flow->set(e, (*_lo)[e]);
-        _excess->set(_g.target(e), (*_excess)[_g.target(e)] + (*_flow)[e]);
-        _excess->set(_g.source(e), (*_excess)[_g.source(e)] - (*_flow)[e]);
-      }
-
-      // global relabeling tested, but in general case it provides
-      // worse performance for random digraphs
-      _level->initStart();
-      for(NodeIt n(_g);n!=INVALID;++n)
-        _level->initAddItem(n);
-      _level->initFinish();
-      for(NodeIt n(_g);n!=INVALID;++n)
-        if(_tol.positive((*_excess)[n]))
-          _level->activate(n);
-    }
-
-    /// Initializes the internal data structures using a greedy approach.
-
-    /// Initializes the internal data structures using a greedy approach
-    /// to construct the initial solution.
-    void greedyInit()
-    {
-      createStructures();
-
-      for(NodeIt n(_g);n!=INVALID;++n) {
-        _excess->set(n, (*_delta)[n]);
-      }
-
-      for (ArcIt e(_g);e!=INVALID;++e) {
-        if (!_tol.positive((*_excess)[_g.target(e)] + (*_up)[e])) {
-          _flow->set(e, (*_up)[e]);
-          _excess->set(_g.target(e), (*_excess)[_g.target(e)] + (*_up)[e]);
-          _excess->set(_g.source(e), (*_excess)[_g.source(e)] - (*_up)[e]);
-        } else if (_tol.positive((*_excess)[_g.target(e)] + (*_lo)[e])) {
-          _flow->set(e, (*_lo)[e]);
-          _excess->set(_g.target(e), (*_excess)[_g.target(e)] + (*_lo)[e]);
-          _excess->set(_g.source(e), (*_excess)[_g.source(e)] - (*_lo)[e]);
-        } else {
-          Value fc = -(*_excess)[_g.target(e)];
-          _flow->set(e, fc);
-          _excess->set(_g.target(e), 0);
-          _excess->set(_g.source(e), (*_excess)[_g.source(e)] - fc);
-        }
-      }
-
-      _level->initStart();
-      for(NodeIt n(_g);n!=INVALID;++n)
-        _level->initAddItem(n);
-      _level->initFinish();
-      for(NodeIt n(_g);n!=INVALID;++n)
-        if(_tol.positive((*_excess)[n]))
-          _level->activate(n);
-    }
-
-    ///Executes the algorithm
-
-    ///This function executes the algorithm.
-    ///
-    ///\return \c true if a feasible circulation is found.
-    ///
-    ///\sa barrier()
-    ///\sa barrierMap()
-    bool start()
-    {
-
-      Node act;
-      Node bact=INVALID;
-      Node last_activated=INVALID;
-      while((act=_level->highestActive())!=INVALID) {
-        int actlevel=(*_level)[act];
-        int mlevel=_node_num;
-        Value exc=(*_excess)[act];
-
-        for(OutArcIt e(_g,act);e!=INVALID; ++e) {
-          Node v = _g.target(e);
-          Value fc=(*_up)[e]-(*_flow)[e];
-          if(!_tol.positive(fc)) continue;
-          if((*_level)[v]<actlevel) {
-            if(!_tol.less(fc, exc)) {
-              _flow->set(e, (*_flow)[e] + exc);
-              _excess->set(v, (*_excess)[v] + exc);
-              if(!_level->active(v) && _tol.positive((*_excess)[v]))
-                _level->activate(v);
-              _excess->set(act,0);
-              _level->deactivate(act);
-              goto next_l;
-            }
-            else {
-              _flow->set(e, (*_up)[e]);
-              _excess->set(v, (*_excess)[v] + fc);
-              if(!_level->active(v) && _tol.positive((*_excess)[v]))
-                _level->activate(v);
-              exc-=fc;
-            }
-          }
-          else if((*_level)[v]<mlevel) mlevel=(*_level)[v];
-        }
-        for(InArcIt e(_g,act);e!=INVALID; ++e) {
-          Node v = _g.source(e);
-          Value fc=(*_flow)[e]-(*_lo)[e];
-          if(!_tol.positive(fc)) continue;
-          if((*_level)[v]<actlevel) {
-            if(!_tol.less(fc, exc)) {
-              _flow->set(e, (*_flow)[e] - exc);
-              _excess->set(v, (*_excess)[v] + exc);
-              if(!_level->active(v) && _tol.positive((*_excess)[v]))
-                _level->activate(v);
-              _excess->set(act,0);
-              _level->deactivate(act);
-              goto next_l;
-            }
-            else {
-              _flow->set(e, (*_lo)[e]);
-              _excess->set(v, (*_excess)[v] + fc);
-              if(!_level->active(v) && _tol.positive((*_excess)[v]))
-                _level->activate(v);
-              exc-=fc;
-            }
-          }
-          else if((*_level)[v]<mlevel) mlevel=(*_level)[v];
-        }
-
-        _excess->set(act, exc);
-        if(!_tol.positive(exc)) _level->deactivate(act);
-        else if(mlevel==_node_num) {
-          _level->liftHighestActiveToTop();
-          _el = _node_num;
-          return false;
-        }
-        else {
-          _level->liftHighestActive(mlevel+1);
-          if(_level->onLevel(actlevel)==0) {
-            _el = actlevel;
-            return false;
-          }
-        }
-      next_l:
-        ;
-      }
-      return true;
-    }
-
-    /// Runs the algorithm.
-
-    /// This function runs the algorithm.
-    ///
-    /// \return \c true if a feasible circulation is found.
-    ///
-    /// \note Apart from the return value, c.run() is just a shortcut of
-    /// the following code.
-    /// \code
-    ///   c.greedyInit();
-    ///   c.start();
-    /// \endcode
-    bool run() {
-      greedyInit();
-      return start();
-    }
-
-    /// @}
-
-    /// \name Query Functions
-    /// The results of the circulation algorithm can be obtained using
-    /// these functions.\n
-    /// Either \ref run() or \ref start() should be called before
-    /// using them.
-
-    ///@{
-
-    /// \brief Returns the flow on the given arc.
-    ///
-    /// Returns the flow on the given arc.
-    ///
-    /// \pre Either \ref run() or \ref init() must be called before
-    /// using this function.
-    Value flow(const Arc& arc) const {
-      return (*_flow)[arc];
-    }
-
-    /// \brief Returns a const reference to the flow map.
-    ///
-    /// Returns a const reference to the arc map storing the found flow.
-    ///
-    /// \pre Either \ref run() or \ref init() must be called before
-    /// using this function.
-    const FlowMap& flowMap() {
-      return *_flow;
-    }
-
-    /**
-       \brief Returns \c true if the given node is in a barrier.
-
-       Barrier is a set \e B of nodes for which
-
-       \f[ \sum_{a\in\delta_{out}(B)} upper(a) -
-           \sum_{a\in\delta_{in}(B)} lower(a) < \sum_{v\in B}delta(v) \f]
-
-       holds. The existence of a set with this property prooves that a
-       feasible circualtion cannot exist.
-
-       This function returns \c true if the given node is in the found
-       barrier. If a feasible circulation is found, the function
-       gives back \c false for every node.
-
-       \pre Either \ref run() or \ref init() must be called before
-       using this function.
-
-       \sa barrierMap()
-       \sa checkBarrier()
-    */
-    bool barrier(const Node& node)
-    {
-      return (*_level)[node] >= _el;
-    }
-
-    /// \brief Gives back a barrier.
-    ///
-    /// This function sets \c bar to the characteristic vector of the
-    /// found barrier. \c bar should be a \ref concepts::WriteMap "writable"
-    /// node map with \c bool (or convertible) value type.
-    ///
-    /// If a feasible circulation is found, the function gives back an
-    /// empty set, so \c bar[v] will be \c false for all nodes \c v.
-    ///
-    /// \note This function calls \ref barrier() for each node,
-    /// so it runs in \f$O(n)\f$ time.
-    ///
-    /// \pre Either \ref run() or \ref init() must be called before
-    /// using this function.
-    ///
-    /// \sa barrier()
-    /// \sa checkBarrier()
-    template<class BarrierMap>
-    void barrierMap(BarrierMap &bar)
-    {
-      for(NodeIt n(_g);n!=INVALID;++n)
-        bar.set(n, (*_level)[n] >= _el);
-    }
-
-    /// @}
-
-    /// \name Checker Functions
-    /// The feasibility of the results can be checked using
-    /// these functions.\n
-    /// Either \ref run() or \ref start() should be called before
-    /// using them.
-
-    ///@{
-
-    ///Check if the found flow is a feasible circulation
-
-    ///Check if the found flow is a feasible circulation,
-    ///
-    bool checkFlow() {
-      for(ArcIt e(_g);e!=INVALID;++e)
-        if((*_flow)[e]<(*_lo)[e]||(*_flow)[e]>(*_up)[e]) return false;
-      for(NodeIt n(_g);n!=INVALID;++n)
-        {
-          Value dif=-(*_delta)[n];
-          for(InArcIt e(_g,n);e!=INVALID;++e) dif-=(*_flow)[e];
-          for(OutArcIt e(_g,n);e!=INVALID;++e) dif+=(*_flow)[e];
-          if(_tol.negative(dif)) return false;
-        }
-      return true;
-    }
-
-    ///Check whether or not the last execution provides a barrier
-
-    ///Check whether or not the last execution provides a barrier.
-    ///\sa barrier()
-    ///\sa barrierMap()
-    bool checkBarrier()
-    {
-      Value delta=0;
-      for(NodeIt n(_g);n!=INVALID;++n)
-        if(barrier(n))
-          delta-=(*_delta)[n];
-      for(ArcIt e(_g);e!=INVALID;++e)
-        {
-          Node s=_g.source(e);
-          Node t=_g.target(e);
-          if(barrier(s)&&!barrier(t)) delta+=(*_up)[e];
-          else if(barrier(t)&&!barrier(s)) delta-=(*_lo)[e];
-        }
-      return _tol.negative(delta);
-    }
-
-    /// @}
-
-  };
-
-}
-
-#endif
Index: lemon/digraph_adaptor.h
===================================================================
--- lemon/digraph_adaptor.h	(revision 414)
+++ lemon/digraph_adaptor.h	(revision 414)
@@ -0,0 +1,2530 @@
+/* -*- C++ -*-
+ *
+ * This file is a part of LEMON, a generic C++ optimization library
+ *
+ * Copyright (C) 2003-2008
+ * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
+ * (Egervary Research Group on Combinatorial Optimization, EGRES).
+ *
+ * Permission to use, modify and distribute this software is granted
+ * provided that this copyright notice appears in all copies. For
+ * precise terms see the accompanying LICENSE file.
+ *
+ * This software is provided "AS IS" with no warranty of any kind,
+ * express or implied, and with no claim as to its suitability for any
+ * purpose.
+ *
+ */
+
+#ifndef LEMON_DIGRAPH_ADAPTOR_H
+#define LEMON_DIGRAPH_ADAPTOR_H
+
+///\ingroup graph_adaptors
+///\file
+///\brief Several digraph adaptors.
+///
+///This file contains several useful digraph adaptor functions.
+
+#include <lemon/core.h>
+#include <lemon/maps.h>
+#include <lemon/bits/variant.h>
+
+#include <lemon/bits/base_extender.h>
+#include <lemon/bits/graph_adaptor_extender.h>
+#include <lemon/bits/graph_extender.h>
+#include <lemon/tolerance.h>
+
+#include <algorithm>
+
+namespace lemon {
+
+  ///\brief Base type for the Digraph Adaptors
+  ///
+  ///Base type for the Digraph Adaptors
+  ///
+  ///This is the base type for most of LEMON digraph adaptors. This
+  ///class implements a trivial digraph adaptor i.e. it only wraps the
+  ///functions and types of the digraph. The purpose of this class is
+  ///to make easier implementing digraph adaptors. E.g. if an adaptor
+  ///is considered which differs from the wrapped digraph only in some
+  ///of its functions or types, then it can be derived from
+  ///DigraphAdaptor, and only the differences should be implemented.
+  template<typename _Digraph>
+  class DigraphAdaptorBase {
+  public:
+    typedef _Digraph Digraph;
+    typedef DigraphAdaptorBase Adaptor;
+    typedef Digraph ParentDigraph;
+
+  protected:
+    Digraph* _digraph;
+    DigraphAdaptorBase() : _digraph(0) { }
+    void setDigraph(Digraph& digraph) { _digraph = &digraph; }
+
+  public:
+    DigraphAdaptorBase(Digraph& digraph) : _digraph(&digraph) { }
+
+    typedef typename Digraph::Node Node;
+    typedef typename Digraph::Arc Arc;
+   
+    void first(Node& i) const { _digraph->first(i); }
+    void first(Arc& i) const { _digraph->first(i); }
+    void firstIn(Arc& i, const Node& n) const { _digraph->firstIn(i, n); }
+    void firstOut(Arc& i, const Node& n ) const { _digraph->firstOut(i, n); }
+
+    void next(Node& i) const { _digraph->next(i); }
+    void next(Arc& i) const { _digraph->next(i); }
+    void nextIn(Arc& i) const { _digraph->nextIn(i); }
+    void nextOut(Arc& i) const { _digraph->nextOut(i); }
+
+    Node source(const Arc& a) const { return _digraph->source(a); }
+    Node target(const Arc& a) const { return _digraph->target(a); }
+
+    typedef NodeNumTagIndicator<Digraph> NodeNumTag;
+    int nodeNum() const { return _digraph->nodeNum(); }
+    
+    typedef EdgeNumTagIndicator<Digraph> EdgeNumTag;
+    int arcNum() const { return _digraph->arcNum(); }
+
+    typedef FindEdgeTagIndicator<Digraph> FindEdgeTag;
+    Arc findArc(const Node& u, const Node& v, const Arc& prev = INVALID) {
+      return _digraph->findArc(u, v, prev);
+    }
+  
+    Node addNode() { return _digraph->addNode(); }
+    Arc addArc(const Node& u, const Node& v) { return _digraph->addArc(u, v); }
+
+    void erase(const Node& n) const { _digraph->erase(n); }
+    void erase(const Arc& a) const { _digraph->erase(a); }
+  
+    void clear() const { _digraph->clear(); }
+    
+    int id(const Node& n) const { return _digraph->id(n); }
+    int id(const Arc& a) const { return _digraph->id(a); }
+
+    Node nodeFromId(int ix) const { return _digraph->nodeFromId(ix); }
+    Arc arcFromId(int ix) const { return _digraph->arcFromId(ix); }
+
+    int maxNodeId() const { return _digraph->maxNodeId(); }
+    int maxArcId() const { return _digraph->maxArcId(); }
+
+    typedef typename ItemSetTraits<Digraph, Node>::ItemNotifier NodeNotifier;
+    NodeNotifier& notifier(Node) const { return _digraph->notifier(Node()); } 
+
+    typedef typename ItemSetTraits<Digraph, Arc>::ItemNotifier ArcNotifier;
+    ArcNotifier& notifier(Arc) const { return _digraph->notifier(Arc()); } 
+    
+    template <typename _Value>
+    class NodeMap : public Digraph::template NodeMap<_Value> {
+    public:
+
+      typedef typename Digraph::template NodeMap<_Value> Parent;
+
+      explicit NodeMap(const Adaptor& adaptor) 
+	: Parent(*adaptor._digraph) {}
+
+      NodeMap(const Adaptor& adaptor, const _Value& value)
+	: Parent(*adaptor._digraph, value) { }
+
+    private:
+      NodeMap& operator=(const NodeMap& cmap) {
+        return operator=<NodeMap>(cmap);
+      }
+
+      template <typename CMap>
+      NodeMap& operator=(const CMap& cmap) {
+        Parent::operator=(cmap);
+        return *this;
+      }
+      
+    };
+
+    template <typename _Value>
+    class ArcMap : public Digraph::template ArcMap<_Value> {
+    public:
+      
+      typedef typename Digraph::template ArcMap<_Value> Parent;
+      
+      explicit ArcMap(const Adaptor& adaptor) 
+	: Parent(*adaptor._digraph) {}
+
+      ArcMap(const Adaptor& adaptor, const _Value& value)
+	: Parent(*adaptor._digraph, value) {}
+
+    private:
+      ArcMap& operator=(const ArcMap& cmap) {
+        return operator=<ArcMap>(cmap);
+      }
+
+      template <typename CMap>
+      ArcMap& operator=(const CMap& cmap) {
+        Parent::operator=(cmap);
+        return *this;
+      }
+
+    };
+
+  };
+
+  ///\ingroup graph_adaptors
+  ///
+  ///\brief Trivial Digraph Adaptor
+  /// 
+  /// This class is an adaptor which does not change the adapted
+  /// digraph.  It can be used only to test the digraph adaptors.
+  template <typename _Digraph>
+  class DigraphAdaptor :
+    public DigraphAdaptorExtender<DigraphAdaptorBase<_Digraph> > { 
+  public:
+    typedef _Digraph Digraph;
+    typedef DigraphAdaptorExtender<DigraphAdaptorBase<_Digraph> > Parent;
+  protected:
+    DigraphAdaptor() : Parent() { }
+
+  public:
+    explicit DigraphAdaptor(Digraph& digraph) { setDigraph(digraph); }
+  };
+
+  /// \brief Just gives back a digraph adaptor
+  ///
+  /// Just gives back a digraph adaptor which 
+  /// should be provide original digraph
+  template<typename Digraph>
+  DigraphAdaptor<const Digraph>
+  digraphAdaptor(const Digraph& digraph) {
+    return DigraphAdaptor<const Digraph>(digraph);
+  }
+
+
+  template <typename _Digraph>
+  class RevDigraphAdaptorBase : public DigraphAdaptorBase<_Digraph> {
+  public:
+    typedef _Digraph Digraph;
+    typedef DigraphAdaptorBase<_Digraph> Parent;
+  protected:
+    RevDigraphAdaptorBase() : Parent() { }
+  public:
+    typedef typename Parent::Node Node;
+    typedef typename Parent::Arc Arc;
+
+    void firstIn(Arc& a, const Node& n) const { Parent::firstOut(a, n); }
+    void firstOut(Arc& a, const Node& n ) const { Parent::firstIn(a, n); }
+
+    void nextIn(Arc& a) const { Parent::nextOut(a); }
+    void nextOut(Arc& a) const { Parent::nextIn(a); }
+
+    Node source(const Arc& a) const { return Parent::target(a); }
+    Node target(const Arc& a) const { return Parent::source(a); }
+
+    typedef FindEdgeTagIndicator<Digraph> FindEdgeTag;
+    Arc findArc(const Node& u, const Node& v, 
+		const Arc& prev = INVALID) {
+      return Parent::findArc(v, u, prev);
+    }
+
+  };
+    
+
+  ///\ingroup graph_adaptors
+  ///
+  ///\brief A digraph adaptor which reverses the orientation of the arcs.
+  ///
+  /// If \c g is defined as
+  ///\code
+  /// ListDigraph g;
+  ///\endcode
+  /// then
+  ///\code
+  /// RevDigraphAdaptor<ListDigraph> ga(g);
+  ///\endcode
+  /// implements the digraph obtained from \c g by 
+  /// reversing the orientation of its arcs.
+  ///
+  /// A good example of using RevDigraphAdaptor is to decide that the
+  /// directed graph is wheter strongly connected or not. If from one
+  /// node each node is reachable and from each node is reachable this
+  /// node then and just then the digraph is strongly
+  /// connected. Instead of this condition we use a little bit
+  /// different. From one node each node ahould be reachable in the
+  /// digraph and in the reversed digraph. Now this condition can be
+  /// checked with the Dfs algorithm class and the RevDigraphAdaptor
+  /// algorithm class.
+  ///
+  /// And look at the code:
+  ///
+  ///\code
+  /// bool stronglyConnected(const Digraph& digraph) {
+  ///   if (NodeIt(digraph) == INVALID) return true;
+  ///   Dfs<Digraph> dfs(digraph);
+  ///   dfs.run(NodeIt(digraph));
+  ///   for (NodeIt it(digraph); it != INVALID; ++it) {
+  ///     if (!dfs.reached(it)) {
+  ///       return false;
+  ///     }
+  ///   }
+  ///   typedef RevDigraphAdaptor<const Digraph> RDigraph;
+  ///   RDigraph rdigraph(digraph);
+  ///   DfsVisit<RDigraph> rdfs(rdigraph);
+  ///   rdfs.run(NodeIt(digraph));
+  ///   for (NodeIt it(digraph); it != INVALID; ++it) {
+  ///     if (!rdfs.reached(it)) {
+  ///       return false;
+  ///     }
+  ///   }
+  ///   return true;
+  /// }
+  ///\endcode
+  template<typename _Digraph>
+  class RevDigraphAdaptor : 
+    public DigraphAdaptorExtender<RevDigraphAdaptorBase<_Digraph> > {
+  public:
+    typedef _Digraph Digraph;
+    typedef DigraphAdaptorExtender<
+      RevDigraphAdaptorBase<_Digraph> > Parent;
+  protected:
+    RevDigraphAdaptor() { }
+  public:
+    explicit RevDigraphAdaptor(Digraph& digraph) { 
+      Parent::setDigraph(digraph); 
+    }
+  };
+
+  /// \brief Just gives back a reverse digraph adaptor
+  ///
+  /// Just gives back a reverse digraph adaptor
+  template<typename Digraph>
+  RevDigraphAdaptor<const Digraph>
+  revDigraphAdaptor(const Digraph& digraph) {
+    return RevDigraphAdaptor<const Digraph>(digraph);
+  }
+
+  template <typename _Digraph, typename _NodeFilterMap, 
+	    typename _ArcFilterMap, bool checked = true>
+  class SubDigraphAdaptorBase : public DigraphAdaptorBase<_Digraph> {
+  public:
+    typedef _Digraph Digraph;
+    typedef _NodeFilterMap NodeFilterMap;
+    typedef _ArcFilterMap ArcFilterMap;
+
+    typedef SubDigraphAdaptorBase Adaptor;
+    typedef DigraphAdaptorBase<_Digraph> Parent;
+  protected:
+    NodeFilterMap* _node_filter;
+    ArcFilterMap* _arc_filter;
+    SubDigraphAdaptorBase() 
+      : Parent(), _node_filter(0), _arc_filter(0) { }
+
+    void setNodeFilterMap(NodeFilterMap& node_filter) {
+      _node_filter = &node_filter;
+    }
+    void setArcFilterMap(ArcFilterMap& arc_filter) {
+      _arc_filter = &arc_filter;
+    }
+
+  public:
+
+    typedef typename Parent::Node Node;
+    typedef typename Parent::Arc Arc;
+
+    void first(Node& i) const { 
+      Parent::first(i); 
+      while (i != INVALID && !(*_node_filter)[i]) Parent::next(i); 
+    }
+
+    void first(Arc& i) const { 
+      Parent::first(i); 
+      while (i != INVALID && (!(*_arc_filter)[i] 
+	     || !(*_node_filter)[Parent::source(i)]
+	     || !(*_node_filter)[Parent::target(i)])) Parent::next(i); 
+    }
+
+    void firstIn(Arc& i, const Node& n) const { 
+      Parent::firstIn(i, n); 
+      while (i != INVALID && (!(*_arc_filter)[i] 
+	     || !(*_node_filter)[Parent::source(i)])) Parent::nextIn(i); 
+    }
+
+    void firstOut(Arc& i, const Node& n) const { 
+      Parent::firstOut(i, n); 
+      while (i != INVALID && (!(*_arc_filter)[i] 
+	     || !(*_node_filter)[Parent::target(i)])) Parent::nextOut(i); 
+    }
+
+    void next(Node& i) const { 
+      Parent::next(i); 
+      while (i != INVALID && !(*_node_filter)[i]) Parent::next(i); 
+    }
+
+    void next(Arc& i) const { 
+      Parent::next(i); 
+      while (i != INVALID && (!(*_arc_filter)[i] 
+	     || !(*_node_filter)[Parent::source(i)]
+	     || !(*_node_filter)[Parent::target(i)])) Parent::next(i); 
+    }
+
+    void nextIn(Arc& i) const { 
+      Parent::nextIn(i); 
+      while (i != INVALID && (!(*_arc_filter)[i] 
+	     || !(*_node_filter)[Parent::source(i)])) Parent::nextIn(i); 
+    }
+
+    void nextOut(Arc& i) const { 
+      Parent::nextOut(i); 
+      while (i != INVALID && (!(*_arc_filter)[i] 
+	     || !(*_node_filter)[Parent::target(i)])) Parent::nextOut(i); 
+    }
+
+    ///\e
+
+    /// This function hides \c n in the digraph, i.e. the iteration 
+    /// jumps over it. This is done by simply setting the value of \c n  
+    /// to be false in the corresponding node-map.
+    void hide(const Node& n) const { _node_filter->set(n, false); }
+
+    ///\e
+
+    /// This function hides \c a in the digraph, i.e. the iteration 
+    /// jumps over it. This is done by simply setting the value of \c a
+    /// to be false in the corresponding arc-map.
+    void hide(const Arc& a) const { _arc_filter->set(a, false); }
+
+    ///\e
+
+    /// The value of \c n is set to be true in the node-map which stores 
+    /// hide information. If \c n was hidden previuosly, then it is shown 
+    /// again
+     void unHide(const Node& n) const { _node_filter->set(n, true); }
+
+    ///\e
+
+    /// The value of \c a is set to be true in the arc-map which stores 
+    /// hide information. If \c a was hidden previuosly, then it is shown 
+    /// again
+    void unHide(const Arc& a) const { _arc_filter->set(a, true); }
+
+    /// Returns true if \c n is hidden.
+    
+    ///\e
+    ///
+    bool hidden(const Node& n) const { return !(*_node_filter)[n]; }
+
+    /// Returns true if \c a is hidden.
+    
+    ///\e
+    ///
+    bool hidden(const Arc& a) const { return !(*_arc_filter)[a]; }
+
+    typedef False NodeNumTag;
+    typedef False EdgeNumTag;
+
+    typedef FindEdgeTagIndicator<Digraph> FindEdgeTag;
+    Arc findArc(const Node& source, const Node& target, 
+		const Arc& prev = INVALID) {
+      if (!(*_node_filter)[source] || !(*_node_filter)[target]) {
+        return INVALID;
+      }
+      Arc arc = Parent::findArc(source, target, prev);
+      while (arc != INVALID && !(*_arc_filter)[arc]) {
+        arc = Parent::findArc(source, target, arc);
+      }
+      return arc;
+    }
+
+    template <typename _Value>
+    class NodeMap : public SubMapExtender<Adaptor, 
+        typename Parent::template NodeMap<_Value> > {
+    public:
+      typedef _Value Value;
+      typedef SubMapExtender<Adaptor, typename Parent::
+                             template NodeMap<Value> > MapParent;
+    
+      NodeMap(const Adaptor& adaptor) 
+	: MapParent(adaptor) {}
+      NodeMap(const Adaptor& adaptor, const Value& value) 
+	: MapParent(adaptor, value) {}
+    
+    private:
+      NodeMap& operator=(const NodeMap& cmap) {
+	return operator=<NodeMap>(cmap);
+      }
+    
+      template <typename CMap>
+      NodeMap& operator=(const CMap& cmap) {
+        MapParent::operator=(cmap);
+	return *this;
+      }
+    };
+
+    template <typename _Value>
+    class ArcMap : public SubMapExtender<Adaptor, 
+	typename Parent::template ArcMap<_Value> > {
+    public:
+      typedef _Value Value;
+      typedef SubMapExtender<Adaptor, typename Parent::
+                             template ArcMap<Value> > MapParent;
+    
+      ArcMap(const Adaptor& adaptor) 
+	: MapParent(adaptor) {}
+      ArcMap(const Adaptor& adaptor, const Value& value) 
+	: MapParent(adaptor, value) {}
+    
+    private:
+      ArcMap& operator=(const ArcMap& cmap) {
+	return operator=<ArcMap>(cmap);
+      }
+    
+      template <typename CMap>
+      ArcMap& operator=(const CMap& cmap) {
+        MapParent::operator=(cmap);
+	return *this;
+      }
+    };
+
+  };
+
+  template <typename _Digraph, typename _NodeFilterMap, typename _ArcFilterMap>
+  class SubDigraphAdaptorBase<_Digraph, _NodeFilterMap, _ArcFilterMap, false> 
+    : public DigraphAdaptorBase<_Digraph> {
+  public:
+    typedef _Digraph Digraph;
+    typedef _NodeFilterMap NodeFilterMap;
+    typedef _ArcFilterMap ArcFilterMap;
+
+    typedef SubDigraphAdaptorBase Adaptor;
+    typedef DigraphAdaptorBase<Digraph> Parent;
+  protected:
+    NodeFilterMap* _node_filter;
+    ArcFilterMap* _arc_filter;
+    SubDigraphAdaptorBase() 
+      : Parent(), _node_filter(0), _arc_filter(0) { }
+
+    void setNodeFilterMap(NodeFilterMap& node_filter) {
+      _node_filter = &node_filter;
+    }
+    void setArcFilterMap(ArcFilterMap& arc_filter) {
+      _arc_filter = &arc_filter;
+    }
+
+  public:
+
+    typedef typename Parent::Node Node;
+    typedef typename Parent::Arc Arc;
+
+    void first(Node& i) const { 
+      Parent::first(i); 
+      while (i!=INVALID && !(*_node_filter)[i]) Parent::next(i); 
+    }
+
+    void first(Arc& i) const { 
+      Parent::first(i); 
+      while (i!=INVALID && !(*_arc_filter)[i]) Parent::next(i); 
+    }
+
+    void firstIn(Arc& i, const Node& n) const { 
+      Parent::firstIn(i, n); 
+      while (i!=INVALID && !(*_arc_filter)[i]) Parent::nextIn(i); 
+    }
+
+    void firstOut(Arc& i, const Node& n) const { 
+      Parent::firstOut(i, n); 
+      while (i!=INVALID && !(*_arc_filter)[i]) Parent::nextOut(i); 
+    }
+
+    void next(Node& i) const { 
+      Parent::next(i); 
+      while (i!=INVALID && !(*_node_filter)[i]) Parent::next(i); 
+    }
+    void next(Arc& i) const { 
+      Parent::next(i); 
+      while (i!=INVALID && !(*_arc_filter)[i]) Parent::next(i); 
+    }
+    void nextIn(Arc& i) const { 
+      Parent::nextIn(i); 
+      while (i!=INVALID && !(*_arc_filter)[i]) Parent::nextIn(i); 
+    }
+
+    void nextOut(Arc& i) const { 
+      Parent::nextOut(i); 
+      while (i!=INVALID && !(*_arc_filter)[i]) Parent::nextOut(i); 
+    }
+
+    ///\e
+
+    /// This function hides \c n in the digraph, i.e. the iteration 
+    /// jumps over it. This is done by simply setting the value of \c n  
+    /// to be false in the corresponding node-map.
+    void hide(const Node& n) const { _node_filter->set(n, false); }
+
+    ///\e
+
+    /// This function hides \c e in the digraph, i.e. the iteration 
+    /// jumps over it. This is done by simply setting the value of \c e  
+    /// to be false in the corresponding arc-map.
+    void hide(const Arc& e) const { _arc_filter->set(e, false); }
+
+    ///\e
+
+    /// The value of \c n is set to be true in the node-map which stores 
+    /// hide information. If \c n was hidden previuosly, then it is shown 
+    /// again
+     void unHide(const Node& n) const { _node_filter->set(n, true); }
+
+    ///\e
+
+    /// The value of \c e is set to be true in the arc-map which stores 
+    /// hide information. If \c e was hidden previuosly, then it is shown 
+    /// again
+    void unHide(const Arc& e) const { _arc_filter->set(e, true); }
+
+    /// Returns true if \c n is hidden.
+    
+    ///\e
+    ///
+    bool hidden(const Node& n) const { return !(*_node_filter)[n]; }
+
+    /// Returns true if \c n is hidden.
+    
+    ///\e
+    ///
+    bool hidden(const Arc& e) const { return !(*_arc_filter)[e]; }
+
+    typedef False NodeNumTag;
+    typedef False EdgeNumTag;
+
+    typedef FindEdgeTagIndicator<Digraph> FindEdgeTag;
+    Arc findArc(const Node& source, const Node& target, 
+		  const Arc& prev = INVALID) {
+      if (!(*_node_filter)[source] || !(*_node_filter)[target]) {
+        return INVALID;
+      }
+      Arc arc = Parent::findArc(source, target, prev);
+      while (arc != INVALID && !(*_arc_filter)[arc]) {
+        arc = Parent::findArc(source, target, arc);
+      }
+      return arc;
+    }
+
+    template <typename _Value>
+    class NodeMap : public SubMapExtender<Adaptor, 
+        typename Parent::template NodeMap<_Value> > {
+    public:
+      typedef _Value Value;
+      typedef SubMapExtender<Adaptor, typename Parent::
+                             template NodeMap<Value> > MapParent;
+    
+      NodeMap(const Adaptor& adaptor) 
+	: MapParent(adaptor) {}
+      NodeMap(const Adaptor& adaptor, const Value& value) 
+	: MapParent(adaptor, value) {}
+    
+    private:
+      NodeMap& operator=(const NodeMap& cmap) {
+	return operator=<NodeMap>(cmap);
+      }
+    
+      template <typename CMap>
+      NodeMap& operator=(const CMap& cmap) {
+        MapParent::operator=(cmap);
+	return *this;
+      }
+    };
+
+    template <typename _Value>
+    class ArcMap : public SubMapExtender<Adaptor, 
+	typename Parent::template ArcMap<_Value> > {
+    public:
+      typedef _Value Value;
+      typedef SubMapExtender<Adaptor, typename Parent::
+                             template ArcMap<Value> > MapParent;
+    
+      ArcMap(const Adaptor& adaptor) 
+	: MapParent(adaptor) {}
+      ArcMap(const Adaptor& adaptor, const Value& value) 
+	: MapParent(adaptor, value) {}
+    
+    private:
+      ArcMap& operator=(const ArcMap& cmap) {
+	return operator=<ArcMap>(cmap);
+      }
+    
+      template <typename CMap>
+      ArcMap& operator=(const CMap& cmap) {
+        MapParent::operator=(cmap);
+	return *this;
+      }
+    };
+
+  };
+
+  /// \ingroup graph_adaptors
+  ///
+  /// \brief A digraph adaptor for hiding nodes and arcs from a digraph.
+  /// 
+  /// SubDigraphAdaptor shows the digraph with filtered node-set and 
+  /// arc-set. If the \c checked parameter is true then it filters the arcset
+  /// to do not get invalid arcs without source or target.
+  /// Let \f$ G=(V, A) \f$ be a directed digraph
+  /// and suppose that the digraph instance \c g of type ListDigraph
+  /// implements \f$ G \f$.
+  /// Let moreover \f$ b_V \f$ and \f$ b_A \f$ be bool-valued functions resp.
+  /// on the node-set and arc-set.
+  /// SubDigraphAdaptor<...>::NodeIt iterates 
+  /// on the node-set \f$ \{v\in V : b_V(v)=true\} \f$ and 
+  /// SubDigraphAdaptor<...>::ArcIt iterates 
+  /// on the arc-set \f$ \{e\in A : b_A(e)=true\} \f$. Similarly, 
+  /// SubDigraphAdaptor<...>::OutArcIt and
+  /// SubDigraphAdaptor<...>::InArcIt iterates 
+  /// only on arcs leaving and entering a specific node which have true value.
+  /// 
+  /// If the \c checked template parameter is false then we have to
+  /// note that the node-iterator cares only the filter on the
+  /// node-set, and the arc-iterator cares only the filter on the
+  /// arc-set.  This way the arc-map should filter all arcs which's
+  /// source or target is filtered by the node-filter.
+  ///\code
+  /// typedef ListDigraph Digraph;
+  /// DIGRAPH_TYPEDEFS(Digraph);
+  /// Digraph g;
+  /// Node u=g.addNode(); //node of id 0
+  /// Node v=g.addNode(); //node of id 1
+  /// Arc a=g.addArc(u, v); //arc of id 0
+  /// Arc f=g.addArc(v, u); //arc of id 1
+  /// BoolNodeMap nm(g, true);
+  /// nm.set(u, false);
+  /// BoolArcMap am(g, true);
+  /// am.set(a, false);
+  /// typedef SubDigraphAdaptor<Digraph, BoolNodeMap, BoolArcMap> SubGA;
+  /// SubGA ga(g, nm, am);
+  /// for (SubGA::NodeIt n(ga); n!=INVALID; ++n)
+  ///   std::cout << g.id(n) << std::endl;
+  /// std::cout << ":-)" << std::endl;
+  /// for (SubGA::ArcIt a(ga); a!=INVALID; ++a) 
+  ///   std::cout << g.id(a) << std::endl;
+  ///\endcode
+  /// The output of the above code is the following.
+  ///\code
+  /// 1
+  /// :-)
+  /// 1
+  ///\endcode
+  /// Note that \c n is of type \c SubGA::NodeIt, but it can be converted to
+  /// \c Digraph::Node that is why \c g.id(n) can be applied.
+  /// 
+  /// For other examples see also the documentation of
+  /// NodeSubDigraphAdaptor and ArcSubDigraphAdaptor.
+  template<typename _Digraph, 
+	   typename _NodeFilterMap = typename _Digraph::template NodeMap<bool>, 
+	   typename _ArcFilterMap = typename _Digraph::template ArcMap<bool>, 
+	   bool checked = true>
+  class SubDigraphAdaptor : 
+    public DigraphAdaptorExtender<
+    SubDigraphAdaptorBase<_Digraph, _NodeFilterMap, _ArcFilterMap, checked> > {
+  public:
+    typedef _Digraph Digraph;
+    typedef _NodeFilterMap NodeFilterMap;
+    typedef _ArcFilterMap ArcFilterMap;
+
+    typedef DigraphAdaptorExtender<
+      SubDigraphAdaptorBase<Digraph, NodeFilterMap, ArcFilterMap, checked> >
+    Parent;
+
+  protected:
+    SubDigraphAdaptor() { }
+  public:
+
+    SubDigraphAdaptor(Digraph& digraph, NodeFilterMap& node_filter, 
+		      ArcFilterMap& arc_filter) { 
+      setDigraph(digraph);
+      setNodeFilterMap(node_filter);
+      setArcFilterMap(arc_filter);
+    }
+
+  };
+
+  /// \brief Just gives back a sub digraph adaptor
+  ///
+  /// Just gives back a sub digraph adaptor
+  template<typename Digraph, typename NodeFilterMap, typename ArcFilterMap>
+  SubDigraphAdaptor<const Digraph, NodeFilterMap, ArcFilterMap>
+  subDigraphAdaptor(const Digraph& digraph, 
+		    NodeFilterMap& nfm, ArcFilterMap& afm) {
+    return SubDigraphAdaptor<const Digraph, NodeFilterMap, ArcFilterMap>
+      (digraph, nfm, afm);
+  }
+
+  template<typename Digraph, typename NodeFilterMap, typename ArcFilterMap>
+  SubDigraphAdaptor<const Digraph, const NodeFilterMap, ArcFilterMap>
+  subDigraphAdaptor(const Digraph& digraph, 
+                   NodeFilterMap& nfm, ArcFilterMap& afm) {
+    return SubDigraphAdaptor<const Digraph, const NodeFilterMap, ArcFilterMap>
+      (digraph, nfm, afm);
+  }
+
+  template<typename Digraph, typename NodeFilterMap, typename ArcFilterMap>
+  SubDigraphAdaptor<const Digraph, NodeFilterMap, const ArcFilterMap>
+  subDigraphAdaptor(const Digraph& digraph, 
+                   NodeFilterMap& nfm, ArcFilterMap& afm) {
+    return SubDigraphAdaptor<const Digraph, NodeFilterMap, const ArcFilterMap>
+      (digraph, nfm, afm);
+  }
+
+  template<typename Digraph, typename NodeFilterMap, typename ArcFilterMap>
+  SubDigraphAdaptor<const Digraph, const NodeFilterMap, const ArcFilterMap>
+  subDigraphAdaptor(const Digraph& digraph, 
+                   NodeFilterMap& nfm, ArcFilterMap& afm) {
+    return SubDigraphAdaptor<const Digraph, const NodeFilterMap, 
+      const ArcFilterMap>(digraph, nfm, afm);
+  }
+
+
+
+  ///\ingroup graph_adaptors
+  ///
+  ///\brief An adaptor for hiding nodes from a digraph.
+  ///
+  ///An adaptor for hiding nodes from a digraph.  This adaptor
+  ///specializes SubDigraphAdaptor in the way that only the node-set
+  ///can be filtered. In usual case the checked parameter is true, we
+  ///get the induced subgraph. But if the checked parameter is false
+  ///then we can filter only isolated nodes.
+  template<typename _Digraph, 
+	   typename _NodeFilterMap = typename _Digraph::template NodeMap<bool>, 
+	   bool checked = true>
+  class NodeSubDigraphAdaptor : 
+    public SubDigraphAdaptor<_Digraph, _NodeFilterMap, 
+			     ConstMap<typename _Digraph::Arc, bool>, checked> {
+  public:
+
+    typedef _Digraph Digraph;
+    typedef _NodeFilterMap NodeFilterMap;
+
+    typedef SubDigraphAdaptor<Digraph, NodeFilterMap, 
+			      ConstMap<typename Digraph::Arc, bool>, checked> 
+    Parent;
+
+  protected:
+    ConstMap<typename Digraph::Arc, bool> const_true_map;
+
+    NodeSubDigraphAdaptor() : const_true_map(true) {
+      Parent::setArcFilterMap(const_true_map);
+    }
+
+  public:
+
+    NodeSubDigraphAdaptor(Digraph& _digraph, NodeFilterMap& node_filter) : 
+      Parent(), const_true_map(true) { 
+      Parent::setDigraph(_digraph);
+      Parent::setNodeFilterMap(node_filter);
+      Parent::setArcFilterMap(const_true_map);
+    }
+
+  };
+
+
+  /// \brief Just gives back a \c NodeSubDigraphAdaptor
+  ///
+  /// Just gives back a \c NodeSubDigraphAdaptor
+  template<typename Digraph, typename NodeFilterMap>
+  NodeSubDigraphAdaptor<const Digraph, NodeFilterMap>
+  nodeSubDigraphAdaptor(const Digraph& digraph, NodeFilterMap& nfm) {
+    return NodeSubDigraphAdaptor<const Digraph, NodeFilterMap>(digraph, nfm);
+  }
+
+  template<typename Digraph, typename NodeFilterMap>
+  NodeSubDigraphAdaptor<const Digraph, const NodeFilterMap>
+  nodeSubDigraphAdaptor(const Digraph& digraph, const NodeFilterMap& nfm) {
+    return NodeSubDigraphAdaptor<const Digraph, const NodeFilterMap>
+      (digraph, nfm);
+  }
+
+  ///\ingroup graph_adaptors
+  ///
+  ///\brief An adaptor for hiding arcs from a digraph.
+  ///
+  ///An adaptor for hiding arcs from a digraph. This adaptor
+  ///specializes SubDigraphAdaptor in the way that only the arc-set
+  ///can be filtered. The usefulness of this adaptor is demonstrated
+  ///in the problem of searching a maximum number of arc-disjoint
+  ///shortest paths between two nodes \c s and \c t. Shortest here
+  ///means being shortest w.r.t.  non-negative arc-lengths. Note that
+  ///the comprehension of the presented solution need's some
+  ///elementary knowlarc from combinatorial optimization.
+  ///
+  ///If a single shortest path is to be searched between \c s and \c
+  ///t, then this can be done easily by applying the Dijkstra
+  ///algorithm. What happens, if a maximum number of arc-disjoint
+  ///shortest paths is to be computed. It can be proved that an arc
+  ///can be in a shortest path if and only if it is tight with respect
+  ///to the potential function computed by Dijkstra.  Moreover, any
+  ///path containing only such arcs is a shortest one.  Thus we have
+  ///to compute a maximum number of arc-disjoint paths between \c s
+  ///and \c t in the digraph which has arc-set all the tight arcs. The
+  ///computation will be demonstrated on the following digraph, which
+  ///is read from the dimacs file \c sub_digraph_adaptor_demo.dim.
+  ///The full source code is available in \ref
+  ///sub_digraph_adaptor_demo.cc.  If you are interested in more demo
+  ///programs, you can use \ref dim_to_dot.cc to generate .dot files
+  ///from dimacs files.  The .dot file of the following figure was
+  ///generated by the demo program \ref dim_to_dot.cc.
+  ///
+  ///\dot
+  ///didigraph lemon_dot_example {
+  ///node [ shape=ellipse, fontname=Helvetica, fontsize=10 ];
+  ///n0 [ label="0 (s)" ];
+  ///n1 [ label="1" ];
+  ///n2 [ label="2" ];
+  ///n3 [ label="3" ];
+  ///n4 [ label="4" ];
+  ///n5 [ label="5" ];
+  ///n6 [ label="6 (t)" ];
+  ///arc [ shape=ellipse, fontname=Helvetica, fontsize=10 ];
+  ///n5 ->  n6 [ label="9, length:4" ];
+  ///n4 ->  n6 [ label="8, length:2" ];
+  ///n3 ->  n5 [ label="7, length:1" ];
+  ///n2 ->  n5 [ label="6, length:3" ];
+  ///n2 ->  n6 [ label="5, length:5" ];
+  ///n2 ->  n4 [ label="4, length:2" ];
+  ///n1 ->  n4 [ label="3, length:3" ];
+  ///n0 ->  n3 [ label="2, length:1" ];
+  ///n0 ->  n2 [ label="1, length:2" ];
+  ///n0 ->  n1 [ label="0, length:3" ];
+  ///}
+  ///\enddot
+  ///
+  ///\code
+  ///Digraph g;
+  ///Node s, t;
+  ///LengthMap length(g);
+  ///
+  ///readDimacs(std::cin, g, length, s, t);
+  ///
+  ///cout << "arcs with lengths (of form id, source--length->target): " << endl;
+  ///for(ArcIt e(g); e!=INVALID; ++e) 
+  ///  cout << g.id(e) << ", " << g.id(g.source(e)) << "--" 
+  ///       << length[e] << "->" << g.id(g.target(e)) << endl;
+  ///
+  ///cout << "s: " << g.id(s) << " t: " << g.id(t) << endl;
+  ///\endcode
+  ///Next, the potential function is computed with Dijkstra.
+  ///\code
+  ///typedef Dijkstra<Digraph, LengthMap> Dijkstra;
+  ///Dijkstra dijkstra(g, length);
+  ///dijkstra.run(s);
+  ///\endcode
+  ///Next, we consrtruct a map which filters the arc-set to the tight arcs.
+  ///\code
+  ///typedef TightArcFilterMap<Digraph, const Dijkstra::DistMap, LengthMap> 
+  ///  TightArcFilter;
+  ///TightArcFilter tight_arc_filter(g, dijkstra.distMap(), length);
+  ///
+  ///typedef ArcSubDigraphAdaptor<Digraph, TightArcFilter> SubGA;
+  ///SubGA ga(g, tight_arc_filter);
+  ///\endcode
+  ///Then, the maximum nimber of arc-disjoint \c s-\c t paths are computed 
+  ///with a max flow algorithm Preflow.
+  ///\code
+  ///ConstMap<Arc, int> const_1_map(1);
+  ///Digraph::ArcMap<int> flow(g, 0);
+  ///
+  ///Preflow<SubGA, ConstMap<Arc, int>, Digraph::ArcMap<int> > 
+  ///  preflow(ga, const_1_map, s, t);
+  ///preflow.run();
+  ///\endcode
+  ///Last, the output is:
+  ///\code  
+  ///cout << "maximum number of arc-disjoint shortest path: " 
+  ///     << preflow.flowValue() << endl;
+  ///cout << "arcs of the maximum number of arc-disjoint shortest s-t paths: " 
+  ///     << endl;
+  ///for(ArcIt e(g); e!=INVALID; ++e) 
+  ///  if (preflow.flow(e))
+  ///    cout << " " << g.id(g.source(e)) << "--"
+  ///         << length[e] << "->" << g.id(g.target(e)) << endl;
+  ///\endcode
+  ///The program has the following (expected :-)) output:
+  ///\code
+  ///arcs with lengths (of form id, source--length->target):
+  /// 9, 5--4->6
+  /// 8, 4--2->6
+  /// 7, 3--1->5
+  /// 6, 2--3->5
+  /// 5, 2--5->6
+  /// 4, 2--2->4
+  /// 3, 1--3->4
+  /// 2, 0--1->3
+  /// 1, 0--2->2
+  /// 0, 0--3->1
+  ///s: 0 t: 6
+  ///maximum number of arc-disjoint shortest path: 2
+  ///arcs of the maximum number of arc-disjoint shortest s-t paths:
+  /// 9, 5--4->6
+  /// 8, 4--2->6
+  /// 7, 3--1->5
+  /// 4, 2--2->4
+  /// 2, 0--1->3
+  /// 1, 0--2->2
+  ///\endcode
+  template<typename _Digraph, typename _ArcFilterMap>
+  class ArcSubDigraphAdaptor : 
+    public SubDigraphAdaptor<_Digraph, ConstMap<typename _Digraph::Node, bool>, 
+			     _ArcFilterMap, false> {
+  public:
+    typedef _Digraph Digraph;
+    typedef _ArcFilterMap ArcFilterMap;
+
+    typedef SubDigraphAdaptor<Digraph, ConstMap<typename Digraph::Node, bool>, 
+			      ArcFilterMap, false> Parent;
+  protected:
+    ConstMap<typename Digraph::Node, bool> const_true_map;
+
+    ArcSubDigraphAdaptor() : const_true_map(true) {
+      Parent::setNodeFilterMap(const_true_map);
+    }
+
+  public:
+
+    ArcSubDigraphAdaptor(Digraph& digraph, ArcFilterMap& arc_filter) 
+      : Parent(), const_true_map(true) { 
+      Parent::setDigraph(digraph);
+      Parent::setNodeFilterMap(const_true_map);
+      Parent::setArcFilterMap(arc_filter);
+    }
+
+  };
+
+  /// \brief Just gives back an arc sub digraph adaptor
+  ///
+  /// Just gives back an arc sub digraph adaptor
+  template<typename Digraph, typename ArcFilterMap>
+  ArcSubDigraphAdaptor<const Digraph, ArcFilterMap>
+  arcSubDigraphAdaptor(const Digraph& digraph, ArcFilterMap& afm) {
+    return ArcSubDigraphAdaptor<const Digraph, ArcFilterMap>(digraph, afm);
+  }
+
+  template<typename Digraph, typename ArcFilterMap>
+  ArcSubDigraphAdaptor<const Digraph, const ArcFilterMap>
+  arcSubDigraphAdaptor(const Digraph& digraph, const ArcFilterMap& afm) {
+    return ArcSubDigraphAdaptor<const Digraph, const ArcFilterMap>
+      (digraph, afm);
+  }
+
+  template <typename _Digraph>
+  class UndirDigraphAdaptorBase { 
+  public:
+    typedef _Digraph Digraph;
+    typedef UndirDigraphAdaptorBase Adaptor;
+
+    typedef True UndirectedTag;
+
+    typedef typename Digraph::Arc Edge;
+    typedef typename Digraph::Node Node;
+
+    class Arc : public Edge {
+      friend class UndirDigraphAdaptorBase;
+    protected:
+      bool _forward;
+
+      Arc(const Edge& edge, bool forward) :
+        Edge(edge), _forward(forward) {}
+
+    public:
+      Arc() {}
+
+      Arc(Invalid) : Edge(INVALID), _forward(true) {}
+
+      bool operator==(const Arc &other) const {
+	return _forward == other._forward && 
+	  static_cast<const Edge&>(*this) == static_cast<const Edge&>(other);
+      }
+      bool operator!=(const Arc &other) const {
+	return _forward != other._forward || 
+	  static_cast<const Edge&>(*this) != static_cast<const Edge&>(other);
+      }
+      bool operator<(const Arc &other) const {
+	return _forward < other._forward ||
+	  (_forward == other._forward &&
+	   static_cast<const Edge&>(*this) < static_cast<const Edge&>(other));
+      }
+    };
+
+
+
+    void first(Node& n) const {
+      _digraph->first(n);
+    }
+
+    void next(Node& n) const {
+      _digraph->next(n);
+    }
+
+    void first(Arc& a) const {
+      _digraph->first(a);
+      a._forward = true;
+    }
+
+    void next(Arc& a) const {
+      if (a._forward) {
+	a._forward = false;
+      } else {
+	_digraph->next(a);
+	a._forward = true;
+      }
+    }
+
+    void first(Edge& e) const {
+      _digraph->first(e);
+    }
+
+    void next(Edge& e) const {
+      _digraph->next(e);
+    }
+
+    void firstOut(Arc& a, const Node& n) const {
+      _digraph->firstIn(a, n);
+      if( static_cast<const Edge&>(a) != INVALID ) {
+	a._forward = false;
+      } else {
+	_digraph->firstOut(a, n);
+	a._forward = true;
+      }
+    }
+    void nextOut(Arc &a) const {
+      if (!a._forward) {
+	Node n = _digraph->target(a);
+	_digraph->nextIn(a);
+	if (static_cast<const Edge&>(a) == INVALID ) {
+	  _digraph->firstOut(a, n);
+	  a._forward = true;
+	}
+      }
+      else {
+	_digraph->nextOut(a);
+      }
+    }
+
+    void firstIn(Arc &a, const Node &n) const {
+      _digraph->firstOut(a, n);
+      if (static_cast<const Edge&>(a) != INVALID ) {
+	a._forward = false;
+      } else {
+	_digraph->firstIn(a, n);
+	a._forward = true;
+      }
+    }
+    void nextIn(Arc &a) const {
+      if (!a._forward) {
+	Node n = _digraph->source(a);
+	_digraph->nextOut(a);
+	if( static_cast<const Edge&>(a) == INVALID ) {
+	  _digraph->firstIn(a, n);
+	  a._forward = true;
+	}
+      }
+      else {
+	_digraph->nextIn(a);
+      }
+    }
+
+    void firstInc(Edge &e, bool &d, const Node &n) const {
+      d = true;
+      _digraph->firstOut(e, n);
+      if (e != INVALID) return;
+      d = false;
+      _digraph->firstIn(e, n);
+    }
+
+    void nextInc(Edge &e, bool &d) const {
+      if (d) {
+	Node s = _digraph->source(e);
+	_digraph->nextOut(e);
+	if (e != INVALID) return;
+	d = false;
+	_digraph->firstIn(e, s);
+      } else {
+	_digraph->nextIn(e);
+      }
+    }
+
+    Node u(const Edge& e) const {
+      return _digraph->source(e);
+    }
+
+    Node v(const Edge& e) const {
+      return _digraph->target(e);
+    }
+
+    Node source(const Arc &a) const {
+      return a._forward ? _digraph->source(a) : _digraph->target(a);
+    }
+
+    Node target(const Arc &a) const {
+      return a._forward ? _digraph->target(a) : _digraph->source(a);
+    }
+
+    static Arc direct(const Edge &e, bool d) {
+      return Arc(e, d);
+    }
+    Arc direct(const Edge &e, const Node& n) const {
+      return Arc(e, _digraph->source(e) == n);
+    }
+
+    static bool direction(const Arc &a) { return a._forward; }
+
+    Node nodeFromId(int ix) const { return _digraph->nodeFromId(ix); }
+    Arc arcFromId(int ix) const {
+      return direct(_digraph->arcFromId(ix >> 1), bool(ix & 1));
+    }
+    Edge edgeFromId(int ix) const { return _digraph->arcFromId(ix); }
+
+    int id(const Node &n) const { return _digraph->id(n); }
+    int id(const Arc &a) const {
+      return  (_digraph->id(a) << 1) | (a._forward ? 1 : 0);
+    }
+    int id(const Edge &e) const { return _digraph->id(e); }
+
+    int maxNodeId() const { return _digraph->maxNodeId(); }
+    int maxArcId() const { return (_digraph->maxArcId() << 1) | 1; }
+    int maxEdgeId() const { return _digraph->maxArcId(); }
+
+    Node addNode() { return _digraph->addNode(); }
+    Edge addEdge(const Node& u, const Node& v) { 
+      return _digraph->addArc(u, v); 
+    }
+
+    void erase(const Node& i) { _digraph->erase(i); }
+    void erase(const Edge& i) { _digraph->erase(i); }
+  
+    void clear() { _digraph->clear(); }
+
+    typedef NodeNumTagIndicator<Digraph> NodeNumTag;
+    int nodeNum() const { return 2 * _digraph->arcNum(); }
+    typedef EdgeNumTagIndicator<Digraph> EdgeNumTag;
+    int arcNum() const { return 2 * _digraph->arcNum(); }
+    int edgeNum() const { return _digraph->arcNum(); }
+
+    typedef FindEdgeTagIndicator<Digraph> FindEdgeTag;
+    Arc findArc(Node s, Node t, Arc p = INVALID) const {
+      if (p == INVALID) {
+	Edge arc = _digraph->findArc(s, t);
+	if (arc != INVALID) return direct(arc, true);
+	arc = _digraph->findArc(t, s);
+	if (arc != INVALID) return direct(arc, false);
+      } else if (direction(p)) {
+	Edge arc = _digraph->findArc(s, t, p);
+	if (arc != INVALID) return direct(arc, true);
+	arc = _digraph->findArc(t, s);
+	if (arc != INVALID) return direct(arc, false);	
+      } else {
+	Edge arc = _digraph->findArc(t, s, p);
+	if (arc != INVALID) return direct(arc, false);	      
+      }
+      return INVALID;
+    }
+
+    Edge findEdge(Node s, Node t, Edge p = INVALID) const {
+      if (s != t) {
+        if (p == INVALID) {
+          Edge arc = _digraph->findArc(s, t);
+          if (arc != INVALID) return arc;
+          arc = _digraph->findArc(t, s);
+          if (arc != INVALID) return arc;
+        } else if (_digraph->s(p) == s) {
+          Edge arc = _digraph->findArc(s, t, p);
+          if (arc != INVALID) return arc;
+          arc = _digraph->findArc(t, s);
+          if (arc != INVALID) return arc;	
+        } else {
+          Edge arc = _digraph->findArc(t, s, p);
+          if (arc != INVALID) return arc;	      
+        }
+      } else {
+        return _digraph->findArc(s, t, p);
+      }
+      return INVALID;
+    }
+
+  private:
+    
+    template <typename _Value>
+    class ArcMapBase {
+    private:
+      
+      typedef typename Digraph::template ArcMap<_Value> MapImpl;
+      
+    public:
+
+      typedef typename MapTraits<MapImpl>::ReferenceMapTag ReferenceMapTag;
+
+      typedef _Value Value;
+      typedef Arc Key;
+      
+      ArcMapBase(const Adaptor& adaptor) :
+	_forward(*adaptor._digraph), _backward(*adaptor._digraph) {}
+
+      ArcMapBase(const Adaptor& adaptor, const Value& v) 
+        : _forward(*adaptor._digraph, v), _backward(*adaptor._digraph, v) {}
+      
+      void set(const Arc& a, const Value& v) { 
+	if (direction(a)) {
+	  _forward.set(a, v); 
+        } else { 
+	  _backward.set(a, v);
+        } 
+      }
+
+      typename MapTraits<MapImpl>::ConstReturnValue 
+      operator[](const Arc& a) const { 
+	if (direction(a)) {
+	  return _forward[a]; 
+	} else { 
+	  return _backward[a]; 
+        }
+      }
+
+      typename MapTraits<MapImpl>::ReturnValue 
+      operator[](const Arc& a) { 
+	if (direction(a)) {
+	  return _forward[a]; 
+	} else { 
+	  return _backward[a]; 
+        }
+      }
+
+    protected:
+
+      MapImpl _forward, _backward; 
+
+    };
+
+  public:
+
+    template <typename _Value>
+    class NodeMap : public Digraph::template NodeMap<_Value> {
+    public:
+
+      typedef _Value Value;
+      typedef typename Digraph::template NodeMap<Value> Parent;
+
+      explicit NodeMap(const Adaptor& adaptor) 
+	: Parent(*adaptor._digraph) {}
+
+      NodeMap(const Adaptor& adaptor, const _Value& value)
+	: Parent(*adaptor._digraph, value) { }
+
+    private:
+      NodeMap& operator=(const NodeMap& cmap) {
+        return operator=<NodeMap>(cmap);
+      }
+
+      template <typename CMap>
+      NodeMap& operator=(const CMap& cmap) {
+        Parent::operator=(cmap);
+        return *this;
+      }
+      
+    };
+
+    template <typename _Value>
+    class ArcMap 
+      : public SubMapExtender<Adaptor, ArcMapBase<_Value> > 
+    {
+    public:
+      typedef _Value Value;
+      typedef SubMapExtender<Adaptor, ArcMapBase<Value> > Parent;
+    
+      ArcMap(const Adaptor& adaptor) 
+	: Parent(adaptor) {}
+
+      ArcMap(const Adaptor& adaptor, const Value& value) 
+	: Parent(adaptor, value) {}
+    
+    private:
+      ArcMap& operator=(const ArcMap& cmap) {
+	return operator=<ArcMap>(cmap);
+      }
+    
+      template <typename CMap>
+      ArcMap& operator=(const CMap& cmap) {
+        Parent::operator=(cmap);
+	return *this;
+      }
+    };
+        
+    template <typename _Value>
+    class EdgeMap : public Digraph::template ArcMap<_Value> {
+    public:
+      
+      typedef _Value Value;
+      typedef typename Digraph::template ArcMap<Value> Parent;
+      
+      explicit EdgeMap(const Adaptor& adaptor) 
+	: Parent(*adaptor._digraph) {}
+
+      EdgeMap(const Adaptor& adaptor, const Value& value)
+	: Parent(*adaptor._digraph, value) {}
+
+    private:
+      EdgeMap& operator=(const EdgeMap& cmap) {
+        return operator=<EdgeMap>(cmap);
+      }
+
+      template <typename CMap>
+      EdgeMap& operator=(const CMap& cmap) {
+        Parent::operator=(cmap);
+        return *this;
+      }
+
+    };
+
+    typedef typename ItemSetTraits<Digraph, Node>::ItemNotifier NodeNotifier;
+    NodeNotifier& notifier(Node) const { return _digraph->notifier(Node()); } 
+
+  protected:
+
+    UndirDigraphAdaptorBase() : _digraph(0) {}
+
+    Digraph* _digraph;
+
+    void setDigraph(Digraph& digraph) {
+      _digraph = &digraph;
+    }
+    
+  };
+
+  ///\ingroup graph_adaptors
+  ///
+  /// \brief An graph is made from a directed digraph by an adaptor
+  ///
+  /// This adaptor makes an undirected graph from a directed
+  /// digraph. All arc of the underlying will be showed in the adaptor
+  /// as an edge. Let's see an informal example about using
+  /// this adaptor:
+  ///
+  /// There is a network of the streets of a town. Of course there are
+  /// some one-way street in the town hence the network is a directed
+  /// one. There is a crazy driver who go oppositely in the one-way
+  /// street without moral sense. Of course he can pass this streets
+  /// slower than the regular way, in fact his speed is half of the
+  /// normal speed. How long should he drive to get from a source
+  /// point to the target? Let see the example code which calculate it:
+  ///
+  /// \todo BadCode, SimpleMap does no exists
+  ///\code
+  /// typedef UndirDigraphAdaptor<Digraph> Graph;
+  /// Graph graph(digraph);
+  ///
+  /// typedef SimpleMap<LengthMap> FLengthMap;
+  /// FLengthMap flength(length);
+  ///
+  /// typedef ScaleMap<LengthMap> RLengthMap;
+  /// RLengthMap rlength(length, 2.0);
+  ///
+  /// typedef Graph::CombinedArcMap<FLengthMap, RLengthMap > ULengthMap;
+  /// ULengthMap ulength(flength, rlength);
+  /// 
+  /// Dijkstra<Graph, ULengthMap> dijkstra(graph, ulength);
+  /// std::cout << "Driving time : " << dijkstra.run(src, trg) << std::endl;
+  ///\endcode
+  ///
+  /// The combined arc map makes the length map for the undirected
+  /// graph. It is created from a forward and reverse map. The forward
+  /// map is created from the original length map with a SimpleMap
+  /// adaptor which just makes a read-write map from the reference map
+  /// i.e. it forgets that it can be return reference to values. The
+  /// reverse map is just the scaled original map with the ScaleMap
+  /// adaptor. The combination solves that passing the reverse way
+  /// takes double time than the original. To get the driving time we
+  /// run the dijkstra algorithm on the graph.
+  template<typename _Digraph>
+  class UndirDigraphAdaptor 
+    : public GraphAdaptorExtender<UndirDigraphAdaptorBase<_Digraph> > {
+  public:
+    typedef _Digraph Digraph;
+    typedef GraphAdaptorExtender<UndirDigraphAdaptorBase<Digraph> > Parent;
+  protected:
+    UndirDigraphAdaptor() { }
+  public:
+
+    /// \brief Constructor
+    ///
+    /// Constructor
+    UndirDigraphAdaptor(_Digraph& _digraph) { 
+      setDigraph(_digraph);
+    }
+
+    /// \brief ArcMap combined from two original ArcMap
+    ///
+    /// This class adapts two original digraph ArcMap to
+    /// get an arc map on the adaptor.
+    template <typename _ForwardMap, typename _BackwardMap>
+    class CombinedArcMap {
+    public:
+      
+      typedef _ForwardMap ForwardMap;
+      typedef _BackwardMap BackwardMap;
+
+      typedef typename MapTraits<ForwardMap>::ReferenceMapTag ReferenceMapTag;
+
+      typedef typename ForwardMap::Value Value;
+      typedef typename Parent::Arc Key;
+
+      /// \brief Constructor      
+      ///
+      /// Constructor      
+      CombinedArcMap() : _forward(0), _backward(0) {}
+
+      /// \brief Constructor      
+      ///
+      /// Constructor      
+      CombinedArcMap(ForwardMap& forward, BackwardMap& backward) 
+        : _forward(&forward), _backward(&backward) {}
+      
+
+      /// \brief Sets the value associated with a key.
+      ///
+      /// Sets the value associated with a key.
+      void set(const Key& e, const Value& a) { 
+	if (Parent::direction(e)) {
+	  _forward->set(e, a); 
+        } else { 
+	  _backward->set(e, a);
+        } 
+      }
+
+      /// \brief Returns the value associated with a key.
+      ///
+      /// Returns the value associated with a key.
+      typename MapTraits<ForwardMap>::ConstReturnValue 
+      operator[](const Key& e) const { 
+	if (Parent::direction(e)) {
+	  return (*_forward)[e]; 
+	} else { 
+	  return (*_backward)[e]; 
+        }
+      }
+
+      /// \brief Returns the value associated with a key.
+      ///
+      /// Returns the value associated with a key.
+      typename MapTraits<ForwardMap>::ReturnValue 
+      operator[](const Key& e) { 
+	if (Parent::direction(e)) {
+	  return (*_forward)[e]; 
+	} else { 
+	  return (*_backward)[e]; 
+        }
+      }
+
+      /// \brief Sets the forward map
+      ///
+      /// Sets the forward map
+      void setForwardMap(ForwardMap& forward) {
+        _forward = &forward;
+      }
+
+      /// \brief Sets the backward map
+      ///
+      /// Sets the backward map
+      void setBackwardMap(BackwardMap& backward) {
+        _backward = &backward;
+      }
+
+    protected:
+
+      ForwardMap* _forward;
+      BackwardMap* _backward; 
+
+    };
+
+  };
+
+  /// \brief Just gives back an undir digraph adaptor
+  ///
+  /// Just gives back an undir digraph adaptor
+  template<typename Digraph>
+  UndirDigraphAdaptor<const Digraph>
+  undirDigraphAdaptor(const Digraph& digraph) {
+    return UndirDigraphAdaptor<const Digraph>(digraph);
+  }
+
+  template<typename _Digraph, 
+	   typename _CapacityMap = typename _Digraph::template ArcMap<int>, 
+	   typename _FlowMap = _CapacityMap, 
+           typename _Tolerance = Tolerance<typename _CapacityMap::Value> >
+  class ResForwardFilter {
+  public:
+
+    typedef _Digraph Digraph;
+    typedef _CapacityMap CapacityMap;
+    typedef _FlowMap FlowMap;
+    typedef _Tolerance Tolerance;
+
+    typedef typename Digraph::Arc Key;
+    typedef bool Value;
+
+  private:
+
+    const CapacityMap* _capacity;
+    const FlowMap* _flow;
+    Tolerance _tolerance;
+  public:
+
+    ResForwardFilter(const CapacityMap& capacity, const FlowMap& flow,
+                     const Tolerance& tolerance = Tolerance()) 
+      : _capacity(&capacity), _flow(&flow), _tolerance(tolerance) { }
+
+    ResForwardFilter(const Tolerance& tolerance = Tolerance()) 
+      : _capacity(0), _flow(0), _tolerance(tolerance)  { }
+
+    void setCapacity(const CapacityMap& capacity) { _capacity = &capacity; }
+    void setFlow(const FlowMap& flow) { _flow = &flow; }
+
+    bool operator[](const typename Digraph::Arc& a) const {
+      return _tolerance.positive((*_capacity)[a] - (*_flow)[a]);
+    }
+  };
+
+  template<typename _Digraph, 
+	   typename _CapacityMap = typename _Digraph::template ArcMap<int>, 
+	   typename _FlowMap = _CapacityMap, 
+           typename _Tolerance = Tolerance<typename _CapacityMap::Value> >
+  class ResBackwardFilter {
+  public:
+
+    typedef _Digraph Digraph;
+    typedef _CapacityMap CapacityMap;
+    typedef _FlowMap FlowMap;
+    typedef _Tolerance Tolerance;
+
+    typedef typename Digraph::Arc Key;
+    typedef bool Value;
+
+  private:
+
+    const CapacityMap* _capacity;
+    const FlowMap* _flow;
+    Tolerance _tolerance;
+
+  public:
+
+    ResBackwardFilter(const CapacityMap& capacity, const FlowMap& flow,
+                      const Tolerance& tolerance = Tolerance())
+      : _capacity(&capacity), _flow(&flow), _tolerance(tolerance) { }
+    ResBackwardFilter(const Tolerance& tolerance = Tolerance())
+      : _capacity(0), _flow(0), _tolerance(tolerance) { }
+
+    void setCapacity(const CapacityMap& capacity) { _capacity = &capacity; }
+    void setFlow(const FlowMap& flow) { _flow = &flow; }
+
+    bool operator[](const typename Digraph::Arc& a) const {
+      return _tolerance.positive((*_flow)[a]);
+    }
+  };
+
+  
+  ///\ingroup graph_adaptors
+  ///
+  ///\brief An adaptor for composing the residual graph for directed
+  ///flow and circulation problems.
+  ///
+  ///An adaptor for composing the residual graph for directed flow and
+  ///circulation problems.  Let \f$ G=(V, A) \f$ be a directed digraph
+  ///and let \f$ F \f$ be a number type. Let moreover \f$ f,c:A\to F
+  ///\f$, be functions on the arc-set.
+  ///
+  ///In the appications of ResDigraphAdaptor, \f$ f \f$ usually stands
+  ///for a flow and \f$ c \f$ for a capacity function.  Suppose that a
+  ///graph instance \c g of type \c ListDigraph implements \f$ G \f$.
+  ///
+  ///\code 
+  ///  ListDigraph g;
+  ///\endcode 
+  ///
+  ///Then ResDigraphAdaptor implements the digraph structure with
+  /// node-set \f$ V \f$ and arc-set \f$ A_{forward}\cup A_{backward}
+  /// \f$, where \f$ A_{forward}=\{uv : uv\in A, f(uv)<c(uv)\} \f$ and
+  /// \f$ A_{backward}=\{vu : uv\in A, f(uv)>0\} \f$, i.e. the so
+  /// called residual graph.  When we take the union \f$
+  /// A_{forward}\cup A_{backward} \f$, multilicities are counted,
+  /// i.e.  if an arc is in both \f$ A_{forward} \f$ and \f$
+  /// A_{backward} \f$, then in the adaptor it appears twice. The
+  /// following code shows how such an instance can be constructed.
+  ///
+  ///\code 
+  ///  typedef ListDigraph Digraph; 
+  ///  IntArcMap f(g), c(g);
+  ///  ResDigraphAdaptor<Digraph, int, IntArcMap, IntArcMap> ga(g); 
+  ///\endcode
+  template<typename _Digraph, 
+	   typename _CapacityMap = typename _Digraph::template ArcMap<int>, 
+	   typename _FlowMap = _CapacityMap,
+           typename _Tolerance = Tolerance<typename _CapacityMap::Value> >
+  class ResDigraphAdaptor : 
+    public ArcSubDigraphAdaptor< 
+    UndirDigraphAdaptor<const _Digraph>, 
+    typename UndirDigraphAdaptor<const _Digraph>::template CombinedArcMap<
+      ResForwardFilter<const _Digraph, _CapacityMap, _FlowMap>,  
+      ResBackwardFilter<const _Digraph, _CapacityMap, _FlowMap> > > {
+  public:
+
+    typedef _Digraph Digraph;
+    typedef _CapacityMap CapacityMap;
+    typedef _FlowMap FlowMap;
+    typedef _Tolerance Tolerance;
+
+    typedef typename CapacityMap::Value Value;
+    typedef ResDigraphAdaptor Adaptor;
+
+  protected:
+
+    typedef UndirDigraphAdaptor<const Digraph> UndirDigraph;
+
+    typedef ResForwardFilter<const Digraph, CapacityMap, FlowMap> 
+    ForwardFilter;
+
+    typedef ResBackwardFilter<const Digraph, CapacityMap, FlowMap> 
+    BackwardFilter;
+
+    typedef typename UndirDigraph::
+    template CombinedArcMap<ForwardFilter, BackwardFilter> ArcFilter;
+
+    typedef ArcSubDigraphAdaptor<UndirDigraph, ArcFilter> Parent;
+
+    const CapacityMap* _capacity;
+    FlowMap* _flow;
+
+    UndirDigraph _graph;
+    ForwardFilter _forward_filter;
+    BackwardFilter _backward_filter;
+    ArcFilter _arc_filter;
+
+    void setCapacityMap(const CapacityMap& capacity) {
+      _capacity = &capacity;
+      _forward_filter.setCapacity(capacity);
+      _backward_filter.setCapacity(capacity);
+    }
+
+    void setFlowMap(FlowMap& flow) {
+      _flow = &flow;
+      _forward_filter.setFlow(flow);
+      _backward_filter.setFlow(flow);
+    }
+
+  public:
+
+    /// \brief Constructor of the residual digraph.
+    ///
+    /// Constructor of the residual graph. The parameters are the digraph type,
+    /// the flow map, the capacity map and a tolerance object.
+    ResDigraphAdaptor(const Digraph& digraph, const CapacityMap& capacity, 
+                    FlowMap& flow, const Tolerance& tolerance = Tolerance()) 
+      : Parent(), _capacity(&capacity), _flow(&flow), _graph(digraph),
+        _forward_filter(capacity, flow, tolerance), 
+        _backward_filter(capacity, flow, tolerance),
+        _arc_filter(_forward_filter, _backward_filter)
+    {
+      Parent::setDigraph(_graph);
+      Parent::setArcFilterMap(_arc_filter);
+    }
+
+    typedef typename Parent::Arc Arc;
+
+    /// \brief Gives back the residual capacity of the arc.
+    ///
+    /// Gives back the residual capacity of the arc.
+    Value rescap(const Arc& arc) const {
+      if (UndirDigraph::direction(arc)) {
+        return (*_capacity)[arc] - (*_flow)[arc]; 
+      } else {
+        return (*_flow)[arc];
+      }
+    } 
+
+    /// \brief Augment on the given arc in the residual digraph.
+    ///
+    /// Augment on the given arc in the residual digraph. It increase
+    /// or decrease the flow on the original arc depend on the direction
+    /// of the residual arc.
+    void augment(const Arc& e, const Value& a) const {
+      if (UndirDigraph::direction(e)) {
+        _flow->set(e, (*_flow)[e] + a);
+      } else {  
+        _flow->set(e, (*_flow)[e] - a);
+      }
+    }
+
+    /// \brief Returns the direction of the arc.
+    ///
+    /// Returns true when the arc is same oriented as the original arc.
+    static bool forward(const Arc& e) {
+      return UndirDigraph::direction(e);
+    }
+
+    /// \brief Returns the direction of the arc.
+    ///
+    /// Returns true when the arc is opposite oriented as the original arc.
+    static bool backward(const Arc& e) {
+      return !UndirDigraph::direction(e);
+    }
+
+    /// \brief Gives back the forward oriented residual arc.
+    ///
+    /// Gives back the forward oriented residual arc.
+    static Arc forward(const typename Digraph::Arc& e) {
+      return UndirDigraph::direct(e, true);
+    }
+
+    /// \brief Gives back the backward oriented residual arc.
+    ///
+    /// Gives back the backward oriented residual arc.
+    static Arc backward(const typename Digraph::Arc& e) {
+      return UndirDigraph::direct(e, false);
+    }
+
+    /// \brief Residual capacity map.
+    ///
+    /// In generic residual digraphs the residual capacity can be obtained 
+    /// as a map. 
+    class ResCap {
+    protected:
+      const Adaptor* _adaptor;
+    public:
+      typedef Arc Key;
+      typedef typename _CapacityMap::Value Value;
+
+      ResCap(const Adaptor& adaptor) : _adaptor(&adaptor) {}
+      
+      Value operator[](const Arc& e) const {
+        return _adaptor->rescap(e);
+      }
+      
+    };
+
+  };
+
+  /// \brief Base class for split digraph adaptor
+  ///
+  /// Base class of split digraph adaptor. In most case you do not need to
+  /// use it directly but the documented member functions of this class can 
+  /// be used with the SplitDigraphAdaptor class.
+  /// \sa SplitDigraphAdaptor
+  template <typename _Digraph>
+  class SplitDigraphAdaptorBase {
+  public:
+
+    typedef _Digraph Digraph;
+    typedef DigraphAdaptorBase<const _Digraph> Parent;
+    typedef SplitDigraphAdaptorBase Adaptor;
+
+    typedef typename Digraph::Node DigraphNode;
+    typedef typename Digraph::Arc DigraphArc;
+
+    class Node;
+    class Arc;
+
+  private:
+
+    template <typename T> class NodeMapBase;
+    template <typename T> class ArcMapBase;
+
+  public:
+    
+    class Node : public DigraphNode {
+      friend class SplitDigraphAdaptorBase;
+      template <typename T> friend class NodeMapBase;
+    private:
+
+      bool _in;
+      Node(DigraphNode node, bool in)
+	: DigraphNode(node), _in(in) {}
+      
+    public:
+
+      Node() {}
+      Node(Invalid) : DigraphNode(INVALID), _in(true) {}
+
+      bool operator==(const Node& node) const {
+	return DigraphNode::operator==(node) && _in == node._in;
+      }
+      
+      bool operator!=(const Node& node) const {
+	return !(*this == node);
+      }
+      
+      bool operator<(const Node& node) const {
+	return DigraphNode::operator<(node) || 
+	  (DigraphNode::operator==(node) && _in < node._in);
+      }
+    };
+
+    class Arc {
+      friend class SplitDigraphAdaptorBase;
+      template <typename T> friend class ArcMapBase;
+    private:
+      typedef BiVariant<DigraphArc, DigraphNode> ArcImpl;
+
+      explicit Arc(const DigraphArc& arc) : _item(arc) {}
+      explicit Arc(const DigraphNode& node) : _item(node) {}
+      
+      ArcImpl _item;
+
+    public:
+      Arc() {}
+      Arc(Invalid) : _item(DigraphArc(INVALID)) {}
+
+      bool operator==(const Arc& arc) const {
+        if (_item.firstState()) {
+          if (arc._item.firstState()) {
+            return _item.first() == arc._item.first();
+          }
+        } else {
+          if (arc._item.secondState()) {
+            return _item.second() == arc._item.second();
+          }
+        }
+        return false;
+      }
+      
+      bool operator!=(const Arc& arc) const {
+	return !(*this == arc);
+      }
+      
+      bool operator<(const Arc& arc) const {
+        if (_item.firstState()) {
+          if (arc._item.firstState()) {
+            return _item.first() < arc._item.first();
+          }
+          return false;
+        } else {
+          if (arc._item.secondState()) {
+            return _item.second() < arc._item.second();
+          }
+          return true;
+        }
+      }
+
+      operator DigraphArc() const { return _item.first(); }
+      operator DigraphNode() const { return _item.second(); }
+
+    };
+
+    void first(Node& n) const {
+      _digraph->first(n);
+      n._in = true;
+    }
+
+    void next(Node& n) const {
+      if (n._in) {
+	n._in = false;
+      } else {
+	n._in = true;
+	_digraph->next(n);
+      }
+    }
+
+    void first(Arc& e) const {
+      e._item.setSecond();
+      _digraph->first(e._item.second());
+      if (e._item.second() == INVALID) {
+        e._item.setFirst();
+	_digraph->first(e._item.first());
+      }
+    }
+
+    void next(Arc& e) const {
+      if (e._item.secondState()) {
+	_digraph->next(e._item.second());
+        if (e._item.second() == INVALID) {
+          e._item.setFirst();
+          _digraph->first(e._item.first());
+        }
+      } else {
+	_digraph->next(e._item.first());
+      }      
+    }
+
+    void firstOut(Arc& e, const Node& n) const {
+      if (n._in) {
+        e._item.setSecond(n);
+      } else {
+        e._item.setFirst();
+	_digraph->firstOut(e._item.first(), n);
+      }
+    }
+
+    void nextOut(Arc& e) const {
+      if (!e._item.firstState()) {
+	e._item.setFirst(INVALID);
+      } else {
+	_digraph->nextOut(e._item.first());
+      }      
+    }
+
+    void firstIn(Arc& e, const Node& n) const {
+      if (!n._in) {
+        e._item.setSecond(n);        
+      } else {
+        e._item.setFirst();
+	_digraph->firstIn(e._item.first(), n);
+      }
+    }
+
+    void nextIn(Arc& e) const {
+      if (!e._item.firstState()) {
+	e._item.setFirst(INVALID);
+      } else {
+	_digraph->nextIn(e._item.first());
+      }
+    }
+
+    Node source(const Arc& e) const {
+      if (e._item.firstState()) {
+	return Node(_digraph->source(e._item.first()), false);
+      } else {
+	return Node(e._item.second(), true);
+      }
+    }
+
+    Node target(const Arc& e) const {
+      if (e._item.firstState()) {
+	return Node(_digraph->target(e._item.first()), true);
+      } else {
+	return Node(e._item.second(), false);
+      }
+    }
+
+    int id(const Node& n) const {
+      return (_digraph->id(n) << 1) | (n._in ? 0 : 1);
+    }
+    Node nodeFromId(int ix) const {
+      return Node(_digraph->nodeFromId(ix >> 1), (ix & 1) == 0);
+    }
+    int maxNodeId() const {
+      return 2 * _digraph->maxNodeId() + 1;
+    }
+
+    int id(const Arc& e) const {
+      if (e._item.firstState()) {
+        return _digraph->id(e._item.first()) << 1;
+      } else {
+        return (_digraph->id(e._item.second()) << 1) | 1;
+      }
+    }
+    Arc arcFromId(int ix) const {
+      if ((ix & 1) == 0) {
+        return Arc(_digraph->arcFromId(ix >> 1));
+      } else {
+        return Arc(_digraph->nodeFromId(ix >> 1));
+      }
+    }
+    int maxArcId() const {
+      return std::max(_digraph->maxNodeId() << 1, 
+                      (_digraph->maxArcId() << 1) | 1);
+    }
+
+    /// \brief Returns true when the node is in-node.
+    ///
+    /// Returns true when the node is in-node.
+    static bool inNode(const Node& n) {
+      return n._in;
+    }
+
+    /// \brief Returns true when the node is out-node.
+    ///
+    /// Returns true when the node is out-node.
+    static bool outNode(const Node& n) {
+      return !n._in;
+    }
+
+    /// \brief Returns true when the arc is arc in the original digraph.
+    ///
+    /// Returns true when the arc is arc in the original digraph.
+    static bool origArc(const Arc& e) {
+      return e._item.firstState();
+    }
+
+    /// \brief Returns true when the arc binds an in-node and an out-node.
+    ///
+    /// Returns true when the arc binds an in-node and an out-node.
+    static bool bindArc(const Arc& e) {
+      return e._item.secondState();
+    }
+
+    /// \brief Gives back the in-node created from the \c node.
+    ///
+    /// Gives back the in-node created from the \c node.
+    static Node inNode(const DigraphNode& n) {
+      return Node(n, true);
+    }
+
+    /// \brief Gives back the out-node created from the \c node.
+    ///
+    /// Gives back the out-node created from the \c node.
+    static Node outNode(const DigraphNode& n) {
+      return Node(n, false);
+    }
+
+    /// \brief Gives back the arc binds the two part of the node.
+    /// 
+    /// Gives back the arc binds the two part of the node.
+    static Arc arc(const DigraphNode& n) {
+      return Arc(n);
+    }
+
+    /// \brief Gives back the arc of the original arc.
+    /// 
+    /// Gives back the arc of the original arc.
+    static Arc arc(const DigraphArc& e) {
+      return Arc(e);
+    }
+
+    typedef True NodeNumTag;
+
+    int nodeNum() const {
+      return  2 * countNodes(*_digraph);
+    }
+
+    typedef True EdgeNumTag;
+    int arcNum() const {
+      return countArcs(*_digraph) + countNodes(*_digraph);
+    }
+
+    typedef True FindEdgeTag;
+    Arc findArc(const Node& u, const Node& v, 
+		const Arc& prev = INVALID) const {
+      if (inNode(u)) {
+        if (outNode(v)) {
+          if (static_cast<const DigraphNode&>(u) == 
+              static_cast<const DigraphNode&>(v) && prev == INVALID) {
+            return Arc(u);
+          }
+        }
+      } else {
+        if (inNode(v)) {
+          return Arc(::lemon::findArc(*_digraph, u, v, prev));
+        }
+      }
+      return INVALID;
+    }
+
+  private:
+    
+    template <typename _Value>
+    class NodeMapBase 
+      : public MapTraits<typename Parent::template NodeMap<_Value> > {
+      typedef typename Parent::template NodeMap<_Value> NodeImpl;
+    public:
+      typedef Node Key;
+      typedef _Value Value;
+      
+      NodeMapBase(const Adaptor& adaptor) 
+	: _in_map(*adaptor._digraph), _out_map(*adaptor._digraph) {}
+      NodeMapBase(const Adaptor& adaptor, const Value& value) 
+	: _in_map(*adaptor._digraph, value), 
+	  _out_map(*adaptor._digraph, value) {}
+
+      void set(const Node& key, const Value& val) {
+	if (Adaptor::inNode(key)) { _in_map.set(key, val); }
+	else {_out_map.set(key, val); }
+      }
+      
+      typename MapTraits<NodeImpl>::ReturnValue 
+      operator[](const Node& key) {
+	if (Adaptor::inNode(key)) { return _in_map[key]; }
+	else { return _out_map[key]; }
+      }
+
+      typename MapTraits<NodeImpl>::ConstReturnValue
+      operator[](const Node& key) const {
+	if (Adaptor::inNode(key)) { return _in_map[key]; }
+	else { return _out_map[key]; }
+      }
+
+    private:
+      NodeImpl _in_map, _out_map;
+    };
+
+    template <typename _Value>
+    class ArcMapBase 
+      : public MapTraits<typename Parent::template ArcMap<_Value> > {
+      typedef typename Parent::template ArcMap<_Value> ArcImpl;
+      typedef typename Parent::template NodeMap<_Value> NodeImpl;
+    public:
+      typedef Arc Key;
+      typedef _Value Value;
+
+      ArcMapBase(const Adaptor& adaptor) 
+	: _arc_map(*adaptor._digraph), _node_map(*adaptor._digraph) {}
+      ArcMapBase(const Adaptor& adaptor, const Value& value) 
+	: _arc_map(*adaptor._digraph, value), 
+	  _node_map(*adaptor._digraph, value) {}
+
+      void set(const Arc& key, const Value& val) {
+	if (Adaptor::origArc(key)) { 
+          _arc_map.set(key._item.first(), val); 
+        } else {
+          _node_map.set(key._item.second(), val); 
+        }
+      }
+      
+      typename MapTraits<ArcImpl>::ReturnValue
+      operator[](const Arc& key) {
+	if (Adaptor::origArc(key)) { 
+          return _arc_map[key._item.first()];
+        } else {
+          return _node_map[key._item.second()];
+        }
+      }
+
+      typename MapTraits<ArcImpl>::ConstReturnValue
+      operator[](const Arc& key) const {
+	if (Adaptor::origArc(key)) { 
+          return _arc_map[key._item.first()];
+        } else {
+          return _node_map[key._item.second()];
+        }
+      }
+
+    private:
+      ArcImpl _arc_map;
+      NodeImpl _node_map;
+    };
+
+  public:
+
+    template <typename _Value>
+    class NodeMap 
+      : public SubMapExtender<Adaptor, NodeMapBase<_Value> > 
+    {
+    public:
+      typedef _Value Value;
+      typedef SubMapExtender<Adaptor, NodeMapBase<Value> > Parent;
+    
+      NodeMap(const Adaptor& adaptor) 
+	: Parent(adaptor) {}
+
+      NodeMap(const Adaptor& adaptor, const Value& value) 
+	: Parent(adaptor, value) {}
+    
+    private:
+      NodeMap& operator=(const NodeMap& cmap) {
+	return operator=<NodeMap>(cmap);
+      }
+    
+      template <typename CMap>
+      NodeMap& operator=(const CMap& cmap) {
+        Parent::operator=(cmap);
+	return *this;
+      }
+    };
+
+    template <typename _Value>
+    class ArcMap 
+      : public SubMapExtender<Adaptor, ArcMapBase<_Value> > 
+    {
+    public:
+      typedef _Value Value;
+      typedef SubMapExtender<Adaptor, ArcMapBase<Value> > Parent;
+    
+      ArcMap(const Adaptor& adaptor) 
+	: Parent(adaptor) {}
+
+      ArcMap(const Adaptor& adaptor, const Value& value) 
+	: Parent(adaptor, value) {}
+    
+    private:
+      ArcMap& operator=(const ArcMap& cmap) {
+	return operator=<ArcMap>(cmap);
+      }
+    
+      template <typename CMap>
+      ArcMap& operator=(const CMap& cmap) {
+        Parent::operator=(cmap);
+	return *this;
+      }
+    };
+
+  protected:
+
+    SplitDigraphAdaptorBase() : _digraph(0) {}
+
+    Digraph* _digraph;
+
+    void setDigraph(Digraph& digraph) {
+      _digraph = &digraph;
+    }
+    
+  };
+
+  /// \ingroup graph_adaptors
+  ///
+  /// \brief Split digraph adaptor class
+  /// 
+  /// This is an digraph adaptor which splits all node into an in-node
+  /// and an out-node. Formaly, the adaptor replaces each \f$ u \f$
+  /// node in the digraph with two node, \f$ u_{in} \f$ node and 
+  /// \f$ u_{out} \f$ node. If there is an \f$ (v, u) \f$ arc in the 
+  /// original digraph the new target of the arc will be \f$ u_{in} \f$ and
+  /// similarly the source of the original \f$ (u, v) \f$ arc will be
+  /// \f$ u_{out} \f$.  The adaptor will add for each node in the 
+  /// original digraph an additional arc which will connect 
+  /// \f$ (u_{in}, u_{out}) \f$.
+  ///
+  /// The aim of this class is to run algorithm with node costs if the 
+  /// algorithm can use directly just arc costs. In this case we should use
+  /// a \c SplitDigraphAdaptor and set the node cost of the digraph to the
+  /// bind arc in the adapted digraph.
+  /// 
+  /// By example a maximum flow algoritm can compute how many arc
+  /// disjoint paths are in the digraph. But we would like to know how
+  /// many node disjoint paths are in the digraph. First we have to
+  /// adapt the digraph with the \c SplitDigraphAdaptor. Then run the flow
+  /// algorithm on the adapted digraph. The bottleneck of the flow will
+  /// be the bind arcs which bounds the flow with the count of the
+  /// node disjoint paths.
+  ///
+  ///\code
+  ///
+  /// typedef SplitDigraphAdaptor<SmartDigraph> SDigraph;
+  ///
+  /// SDigraph sdigraph(digraph);
+  ///
+  /// typedef ConstMap<SDigraph::Arc, int> SCapacity;
+  /// SCapacity scapacity(1);
+  ///
+  /// SDigraph::ArcMap<int> sflow(sdigraph);
+  ///
+  /// Preflow<SDigraph, SCapacity> 
+  ///   spreflow(sdigraph, scapacity, 
+  ///            SDigraph::outNode(source), SDigraph::inNode(target));
+  ///                                            
+  /// spreflow.run();
+  ///
+  ///\endcode
+  ///
+  /// The result of the mamixum flow on the original digraph
+  /// shows the next figure:
+  ///
+  /// \image html arc_disjoint.png
+  /// \image latex arc_disjoint.eps "Arc disjoint paths" width=\textwidth
+  /// 
+  /// And the maximum flow on the adapted digraph:
+  ///
+  /// \image html node_disjoint.png
+  /// \image latex node_disjoint.eps "Node disjoint paths" width=\textwidth
+  ///
+  /// The second solution contains just 3 disjoint paths while the first 4.
+  /// The full code can be found in the \ref disjoint_paths_demo.cc demo file.
+  ///
+  /// This digraph adaptor is fully conform to the 
+  /// \ref concepts::Digraph "Digraph" concept and
+  /// contains some additional member functions and types. The 
+  /// documentation of some member functions may be found just in the
+  /// SplitDigraphAdaptorBase class.
+  ///
+  /// \sa SplitDigraphAdaptorBase
+  template <typename _Digraph>
+  class SplitDigraphAdaptor 
+    : public DigraphAdaptorExtender<SplitDigraphAdaptorBase<_Digraph> > {
+  public:
+    typedef _Digraph Digraph;
+    typedef DigraphAdaptorExtender<SplitDigraphAdaptorBase<Digraph> > Parent;
+
+    typedef typename Parent::Node Node;
+    typedef typename Parent::Arc Arc;
+
+    /// \brief Constructor of the adaptor.
+    ///
+    /// Constructor of the adaptor.
+    SplitDigraphAdaptor(Digraph& g) {
+      Parent::setDigraph(g);
+    }
+
+    /// \brief NodeMap combined from two original NodeMap
+    ///
+    /// This class adapt two of the original digraph NodeMap to
+    /// get a node map on the adapted digraph.
+    template <typename InNodeMap, typename OutNodeMap>
+    class CombinedNodeMap {
+    public:
+
+      typedef Node Key;
+      typedef typename InNodeMap::Value Value;
+
+      /// \brief Constructor
+      ///
+      /// Constructor.
+      CombinedNodeMap(InNodeMap& in_map, OutNodeMap& out_map) 
+	: _in_map(in_map), _out_map(out_map) {}
+
+      /// \brief The subscript operator.
+      ///
+      /// The subscript operator.
+      Value& operator[](const Key& key) {
+	if (Parent::inNode(key)) {
+	  return _in_map[key];
+	} else {
+	  return _out_map[key];
+	}
+      }
+
+      /// \brief The const subscript operator.
+      ///
+      /// The const subscript operator.
+      Value operator[](const Key& key) const {
+	if (Parent::inNode(key)) {
+	  return _in_map[key];
+	} else {
+	  return _out_map[key];
+	}
+      }
+
+      /// \brief The setter function of the map.
+      /// 
+      /// The setter function of the map.
+      void set(const Key& key, const Value& value) {
+	if (Parent::inNode(key)) {
+	  _in_map.set(key, value);
+	} else {
+	  _out_map.set(key, value);
+	}
+      }
+      
+    private:
+      
+      InNodeMap& _in_map;
+      OutNodeMap& _out_map;
+      
+    };
+
+
+    /// \brief Just gives back a combined node map.
+    /// 
+    /// Just gives back a combined node map.
+    template <typename InNodeMap, typename OutNodeMap>
+    static CombinedNodeMap<InNodeMap, OutNodeMap> 
+    combinedNodeMap(InNodeMap& in_map, OutNodeMap& out_map) {
+      return CombinedNodeMap<InNodeMap, OutNodeMap>(in_map, out_map);
+    }
+
+    template <typename InNodeMap, typename OutNodeMap>
+    static CombinedNodeMap<const InNodeMap, OutNodeMap> 
+    combinedNodeMap(const InNodeMap& in_map, OutNodeMap& out_map) {
+      return CombinedNodeMap<const InNodeMap, OutNodeMap>(in_map, out_map);
+    }
+
+    template <typename InNodeMap, typename OutNodeMap>
+    static CombinedNodeMap<InNodeMap, const OutNodeMap> 
+    combinedNodeMap(InNodeMap& in_map, const OutNodeMap& out_map) {
+      return CombinedNodeMap<InNodeMap, const OutNodeMap>(in_map, out_map);
+    }
+
+    template <typename InNodeMap, typename OutNodeMap>
+    static CombinedNodeMap<const InNodeMap, const OutNodeMap> 
+    combinedNodeMap(const InNodeMap& in_map, const OutNodeMap& out_map) {
+      return CombinedNodeMap<const InNodeMap, 
+        const OutNodeMap>(in_map, out_map);
+    }
+
+    /// \brief ArcMap combined from an original ArcMap and NodeMap
+    ///
+    /// This class adapt an original digraph ArcMap and NodeMap to
+    /// get an arc map on the adapted digraph.
+    template <typename DigraphArcMap, typename DigraphNodeMap>
+    class CombinedArcMap {
+    public:
+      
+      typedef Arc Key;
+      typedef typename DigraphArcMap::Value Value;
+      
+      /// \brief Constructor
+      ///
+      /// Constructor.
+      CombinedArcMap(DigraphArcMap& arc_map, DigraphNodeMap& node_map) 
+	: _arc_map(arc_map), _node_map(node_map) {}
+
+      /// \brief The subscript operator.
+      ///
+      /// The subscript operator.
+      void set(const Arc& arc, const Value& val) {
+	if (Parent::origArc(arc)) {
+	  _arc_map.set(arc, val);
+	} else {
+	  _node_map.set(arc, val);
+	}
+      }
+
+      /// \brief The const subscript operator.
+      ///
+      /// The const subscript operator.
+      Value operator[](const Key& arc) const {
+	if (Parent::origArc(arc)) {
+	  return _arc_map[arc];
+	} else {
+	  return _node_map[arc];
+	}
+      }      
+
+      /// \brief The const subscript operator.
+      ///
+      /// The const subscript operator.
+      Value& operator[](const Key& arc) {
+	if (Parent::origArc(arc)) {
+	  return _arc_map[arc];
+	} else {
+	  return _node_map[arc];
+	}
+      }      
+      
+    private:
+      DigraphArcMap& _arc_map;
+      DigraphNodeMap& _node_map;
+    };
+                    
+    /// \brief Just gives back a combined arc map.
+    /// 
+    /// Just gives back a combined arc map.
+    template <typename DigraphArcMap, typename DigraphNodeMap>
+    static CombinedArcMap<DigraphArcMap, DigraphNodeMap> 
+    combinedArcMap(DigraphArcMap& arc_map, DigraphNodeMap& node_map) {
+      return CombinedArcMap<DigraphArcMap, DigraphNodeMap>(arc_map, node_map);
+    }
+
+    template <typename DigraphArcMap, typename DigraphNodeMap>
+    static CombinedArcMap<const DigraphArcMap, DigraphNodeMap> 
+    combinedArcMap(const DigraphArcMap& arc_map, DigraphNodeMap& node_map) {
+      return CombinedArcMap<const DigraphArcMap, 
+        DigraphNodeMap>(arc_map, node_map);
+    }
+
+    template <typename DigraphArcMap, typename DigraphNodeMap>
+    static CombinedArcMap<DigraphArcMap, const DigraphNodeMap> 
+    combinedArcMap(DigraphArcMap& arc_map, const DigraphNodeMap& node_map) {
+      return CombinedArcMap<DigraphArcMap, 
+        const DigraphNodeMap>(arc_map, node_map);
+    }
+
+    template <typename DigraphArcMap, typename DigraphNodeMap>
+    static CombinedArcMap<const DigraphArcMap, const DigraphNodeMap> 
+    combinedArcMap(const DigraphArcMap& arc_map, 
+                    const DigraphNodeMap& node_map) {
+      return CombinedArcMap<const DigraphArcMap, 
+        const DigraphNodeMap>(arc_map, node_map);
+    }
+
+  };
+
+  /// \brief Just gives back a split digraph adaptor
+  ///
+  /// Just gives back a split digraph adaptor
+  template<typename Digraph>
+  SplitDigraphAdaptor<Digraph>
+  splitDigraphAdaptor(const Digraph& digraph) {
+    return SplitDigraphAdaptor<Digraph>(digraph);
+  }
+
+
+} //namespace lemon
+
+#endif //LEMON_DIGRAPH_ADAPTOR_H
+
Index: lemon/dijkstra.h
===================================================================
--- lemon/dijkstra.h	(revision 397)
+++ lemon/dijkstra.h	(revision 313)
@@ -48,4 +48,27 @@
     static Value plus(const Value& left, const Value& right) {
       return left + right;
+    }
+    /// \brief Gives back true only if the first value is less than the second.
+    static bool less(const Value& left, const Value& right) {
+      return left < right;
+    }
+  };
+
+  /// \brief Widest path operation traits for the Dijkstra algorithm class.
+  ///
+  /// This operation traits class defines all computational operations and
+  /// constants which are used in the Dijkstra algorithm for widest path
+  /// computation.
+  ///
+  /// \see DijkstraDefaultOperationTraits
+  template <typename Value>
+  struct DijkstraWidestPathOperationTraits {
+    /// \brief Gives back the maximum value of the type.
+    static Value zero() {
+      return std::numeric_limits<Value>::max();
+    }
+    /// \brief Gives back the minimum of the given two elements.
+    static Value plus(const Value& left, const Value& right) {
+      return std::min(left, right);
     }
     /// \brief Gives back true only if the first value is less than the second.
Index: lemon/graph_adaptor.h
===================================================================
--- lemon/graph_adaptor.h	(revision 414)
+++ lemon/graph_adaptor.h	(revision 414)
@@ -0,0 +1,1136 @@
+/* -*- C++ -*-
+ *
+ * This file is a part of LEMON, a generic C++ optimization library
+ *
+ * Copyright (C) 2003-2008
+ * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
+ * (Egervary Research Group on Combinatorial Optimization, EGRES).
+ *
+ * Permission to use, modify and distribute this software is granted
+ * provided that this copyright notice appears in all copies. For
+ * precise terms see the accompanying LICENSE file.
+ *
+ * This software is provided "AS IS" with no warranty of any kind,
+ * express or implied, and with no claim as to its suitability for any
+ * purpose.
+ *
+ */
+
+#ifndef LEMON_GRAPH_ADAPTOR_H
+#define LEMON_GRAPH_ADAPTOR_H
+
+///\ingroup graph_adaptors
+///\file
+///\brief Several graph adaptors.
+///
+///This file contains several useful undirected graph adaptor classes.
+
+#include <lemon/core.h>
+#include <lemon/maps.h>
+#include <lemon/bits/graph_adaptor_extender.h>
+
+namespace lemon {
+
+  /// \brief Base type for the Graph Adaptors
+  ///
+  /// This is the base type for most of LEMON graph adaptors. 
+  /// This class implements a trivial graph adaptor i.e. it only wraps the 
+  /// functions and types of the graph. The purpose of this class is to 
+  /// make easier implementing graph adaptors. E.g. if an adaptor is 
+  /// considered which differs from the wrapped graph only in some of its 
+  /// functions or types, then it can be derived from GraphAdaptor, and only 
+  /// the differences should be implemented.
+  template<typename _Graph>
+  class GraphAdaptorBase {
+  public:
+    typedef _Graph Graph;
+    typedef Graph ParentGraph;
+
+  protected:
+    Graph* _graph;
+
+    GraphAdaptorBase() : _graph(0) {}
+
+    void setGraph(Graph& graph) { _graph = &graph; }
+
+  public:
+    GraphAdaptorBase(Graph& graph) : _graph(&graph) {}
+ 
+    typedef typename Graph::Node Node;
+    typedef typename Graph::Arc Arc;
+    typedef typename Graph::Edge Edge;
+   
+    void first(Node& i) const { _graph->first(i); }
+    void first(Arc& i) const { _graph->first(i); }
+    void first(Edge& i) const { _graph->first(i); }
+    void firstIn(Arc& i, const Node& n) const { _graph->firstIn(i, n); }
+    void firstOut(Arc& i, const Node& n ) const { _graph->firstOut(i, n); }
+    void firstInc(Edge &i, bool &d, const Node &n) const {
+      _graph->firstInc(i, d, n);
+    }
+
+    void next(Node& i) const { _graph->next(i); }
+    void next(Arc& i) const { _graph->next(i); }
+    void next(Edge& i) const { _graph->next(i); }
+    void nextIn(Arc& i) const { _graph->nextIn(i); }
+    void nextOut(Arc& i) const { _graph->nextOut(i); }
+    void nextInc(Edge &i, bool &d) const { _graph->nextInc(i, d); }
+
+    Node u(const Edge& e) const { return _graph->u(e); }
+    Node v(const Edge& e) const { return _graph->v(e); }
+
+    Node source(const Arc& a) const { return _graph->source(a); }
+    Node target(const Arc& a) const { return _graph->target(a); }
+
+    typedef NodeNumTagIndicator<Graph> NodeNumTag;
+    int nodeNum() const { return _graph->nodeNum(); }
+    
+    typedef EdgeNumTagIndicator<Graph> EdgeNumTag;
+    int arcNum() const { return _graph->arcNum(); }
+    int edgeNum() const { return _graph->edgeNum(); }
+
+    typedef FindEdgeTagIndicator<Graph> FindEdgeTag;
+    Arc findArc(const Node& u, const Node& v, const Arc& prev = INVALID) {
+      return _graph->findArc(u, v, prev);
+    }
+    Edge findEdge(const Node& u, const Node& v, const Edge& prev = INVALID) {
+      return _graph->findEdge(u, v, prev);
+    }
+  
+    Node addNode() { return _graph->addNode(); }
+    Edge addEdge(const Node& u, const Node& v) { return _graph->addEdge(u, v); }
+
+    void erase(const Node& i) { _graph->erase(i); }
+    void erase(const Edge& i) { _graph->erase(i); }
+  
+    void clear() { _graph->clear(); }
+    
+    bool direction(const Arc& a) const { return _graph->direction(a); }
+    Arc direct(const Edge& e, bool d) const { return _graph->direct(e, d); }
+
+    int id(const Node& v) const { return _graph->id(v); }
+    int id(const Arc& a) const { return _graph->id(a); }
+    int id(const Edge& e) const { return _graph->id(e); }
+
+    Node nodeFromId(int ix) const { return _graph->nodeFromId(ix); }
+    Arc arcFromId(int ix) const { return _graph->arcFromId(ix); }
+    Edge edgeFromId(int ix) const { return _graph->edgeFromId(ix); }
+
+    int maxNodeId() const { return _graph->maxNodeId(); }
+    int maxArcId() const { return _graph->maxArcId(); }
+    int maxEdgeId() const { return _graph->maxEdgeId(); }
+
+    typedef typename ItemSetTraits<Graph, Node>::ItemNotifier NodeNotifier;
+    NodeNotifier& notifier(Node) const { return _graph->notifier(Node()); } 
+
+    typedef typename ItemSetTraits<Graph, Arc>::ItemNotifier ArcNotifier;
+    ArcNotifier& notifier(Arc) const { return _graph->notifier(Arc()); } 
+
+    typedef typename ItemSetTraits<Graph, Edge>::ItemNotifier EdgeNotifier;
+    EdgeNotifier& notifier(Edge) const { return _graph->notifier(Edge()); } 
+
+    template <typename _Value>
+    class NodeMap : public Graph::template NodeMap<_Value> {
+    public:
+      typedef typename Graph::template NodeMap<_Value> Parent;
+      explicit NodeMap(const GraphAdaptorBase<Graph>& adapter) 
+	: Parent(*adapter._graph) {}
+      NodeMap(const GraphAdaptorBase<Graph>& adapter, const _Value& value)
+	: Parent(*adapter._graph, value) {}
+
+    private:
+      NodeMap& operator=(const NodeMap& cmap) {
+	return operator=<NodeMap>(cmap);
+      }
+
+      template <typename CMap>
+      NodeMap& operator=(const CMap& cmap) {
+        Parent::operator=(cmap);
+        return *this;
+      }
+      
+    };
+
+    template <typename _Value>
+    class ArcMap : public Graph::template ArcMap<_Value> {
+    public:
+      typedef typename Graph::template ArcMap<_Value> Parent;
+      explicit ArcMap(const GraphAdaptorBase<Graph>& adapter) 
+	: Parent(*adapter._graph) {}
+      ArcMap(const GraphAdaptorBase<Graph>& adapter, const _Value& value)
+	: Parent(*adapter._graph, value) {}
+
+    private:
+      ArcMap& operator=(const ArcMap& cmap) {
+	return operator=<ArcMap>(cmap);
+      }
+
+      template <typename CMap>
+      ArcMap& operator=(const CMap& cmap) {
+        Parent::operator=(cmap);
+	return *this;
+      }
+    };
+
+    template <typename _Value>
+    class EdgeMap : public Graph::template EdgeMap<_Value> {
+    public:
+      typedef typename Graph::template EdgeMap<_Value> Parent;
+      explicit EdgeMap(const GraphAdaptorBase<Graph>& adapter) 
+	: Parent(*adapter._graph) {}
+      EdgeMap(const GraphAdaptorBase<Graph>& adapter, const _Value& value)
+	: Parent(*adapter._graph, value) {}
+
+    private:
+      EdgeMap& operator=(const EdgeMap& cmap) {
+	return operator=<EdgeMap>(cmap);
+      }
+
+      template <typename CMap>
+      EdgeMap& operator=(const CMap& cmap) {
+        Parent::operator=(cmap);
+        return *this;
+      }
+    };
+
+  };
+
+  /// \ingroup graph_adaptors
+  ///
+  /// \brief Trivial graph adaptor
+  ///
+  /// This class is an adaptor which does not change the adapted undirected
+  /// graph. It can be used only to test the graph adaptors.
+  template <typename _Graph>
+  class GraphAdaptor 
+    : public GraphAdaptorExtender< GraphAdaptorBase<_Graph> > { 
+  public:
+    typedef _Graph Graph;
+    typedef GraphAdaptorExtender<GraphAdaptorBase<_Graph> > Parent;
+  protected:
+    GraphAdaptor() : Parent() {}
+
+  public:
+    explicit GraphAdaptor(Graph& graph) { setGraph(graph); }
+  };
+
+  template <typename _Graph, typename NodeFilterMap, 
+	    typename EdgeFilterMap, bool checked = true>
+  class SubGraphAdaptorBase : public GraphAdaptorBase<_Graph> {
+  public:
+    typedef _Graph Graph;
+    typedef SubGraphAdaptorBase Adaptor;
+    typedef GraphAdaptorBase<_Graph> Parent;
+  protected:
+
+    NodeFilterMap* _node_filter_map;
+    EdgeFilterMap* _edge_filter_map;
+
+    SubGraphAdaptorBase() 
+      : Parent(), _node_filter_map(0), _edge_filter_map(0) { }
+
+    void setNodeFilterMap(NodeFilterMap& node_filter_map) {
+      _node_filter_map=&node_filter_map;
+    }
+    void setEdgeFilterMap(EdgeFilterMap& edge_filter_map) {
+      _edge_filter_map=&edge_filter_map;
+    }
+
+  public:
+
+    typedef typename Parent::Node Node;
+    typedef typename Parent::Arc Arc;
+    typedef typename Parent::Edge Edge;
+
+    void first(Node& i) const { 
+      Parent::first(i); 
+      while (i!=INVALID && !(*_node_filter_map)[i]) Parent::next(i); 
+    }
+
+    void first(Arc& i) const { 
+      Parent::first(i); 
+      while (i!=INVALID && (!(*_edge_filter_map)[i] 
+	     || !(*_node_filter_map)[Parent::source(i)]
+	     || !(*_node_filter_map)[Parent::target(i)])) Parent::next(i); 
+    }
+
+    void first(Edge& i) const { 
+      Parent::first(i); 
+      while (i!=INVALID && (!(*_edge_filter_map)[i] 
+	     || !(*_node_filter_map)[Parent::u(i)]
+	     || !(*_node_filter_map)[Parent::v(i)])) Parent::next(i); 
+    }
+
+    void firstIn(Arc& i, const Node& n) const { 
+      Parent::firstIn(i, n); 
+      while (i!=INVALID && (!(*_edge_filter_map)[i] 
+	     || !(*_node_filter_map)[Parent::source(i)])) Parent::nextIn(i); 
+    }
+
+    void firstOut(Arc& i, const Node& n) const { 
+      Parent::firstOut(i, n); 
+      while (i!=INVALID && (!(*_edge_filter_map)[i] 
+	     || !(*_node_filter_map)[Parent::target(i)])) Parent::nextOut(i); 
+    }
+
+    void firstInc(Edge& i, bool& d, const Node& n) const { 
+      Parent::firstInc(i, d, n); 
+      while (i!=INVALID && (!(*_edge_filter_map)[i] 
+            || !(*_node_filter_map)[Parent::u(i)]
+            || !(*_node_filter_map)[Parent::v(i)])) Parent::nextInc(i, d); 
+    }
+
+    void next(Node& i) const { 
+      Parent::next(i); 
+      while (i!=INVALID && !(*_node_filter_map)[i]) Parent::next(i); 
+    }
+
+    void next(Arc& i) const { 
+      Parent::next(i); 
+      while (i!=INVALID && (!(*_edge_filter_map)[i] 
+	     || !(*_node_filter_map)[Parent::source(i)]
+	     || !(*_node_filter_map)[Parent::target(i)])) Parent::next(i); 
+    }
+
+    void next(Edge& i) const { 
+      Parent::next(i); 
+      while (i!=INVALID && (!(*_edge_filter_map)[i] 
+	     || !(*_node_filter_map)[Parent::u(i)]
+	     || !(*_node_filter_map)[Parent::v(i)])) Parent::next(i); 
+    }
+
+    void nextIn(Arc& i) const { 
+      Parent::nextIn(i); 
+      while (i!=INVALID && (!(*_edge_filter_map)[i] 
+	     || !(*_node_filter_map)[Parent::source(i)])) Parent::nextIn(i); 
+    }
+
+    void nextOut(Arc& i) const { 
+      Parent::nextOut(i); 
+      while (i!=INVALID && (!(*_edge_filter_map)[i] 
+	     || !(*_node_filter_map)[Parent::target(i)])) Parent::nextOut(i); 
+    }
+
+    void nextInc(Edge& i, bool& d) const { 
+      Parent::nextInc(i, d); 
+      while (i!=INVALID && (!(*_edge_filter_map)[i]
+            || !(*_node_filter_map)[Parent::u(i)]
+            || !(*_node_filter_map)[Parent::v(i)])) Parent::nextInc(i, d); 
+    }
+
+    /// \brief Hide the given node in the graph.
+    ///
+    /// This function hides \c n in the graph, i.e. the iteration 
+    /// jumps over it. This is done by simply setting the value of \c n  
+    /// to be false in the corresponding node-map.
+    void hide(const Node& n) const { _node_filter_map->set(n, false); }
+
+    /// \brief Hide the given edge in the graph.
+    ///
+    /// This function hides \c e in the graph, i.e. the iteration 
+    /// jumps over it. This is done by simply setting the value of \c e  
+    /// to be false in the corresponding edge-map.
+    void hide(const Edge& e) const { _edge_filter_map->set(e, false); }
+
+    /// \brief Unhide the given node in the graph.
+    ///
+    /// The value of \c n is set to be true in the node-map which stores 
+    /// hide information. If \c n was hidden previuosly, then it is shown 
+    /// again
+     void unHide(const Node& n) const { _node_filter_map->set(n, true); }
+
+    /// \brief Hide the given edge in the graph.
+    ///
+    /// The value of \c e is set to be true in the edge-map which stores 
+    /// hide information. If \c e was hidden previuosly, then it is shown 
+    /// again
+    void unHide(const Edge& e) const { _edge_filter_map->set(e, true); }
+
+    /// \brief Returns true if \c n is hidden.
+    ///
+    /// Returns true if \c n is hidden.
+    bool hidden(const Node& n) const { return !(*_node_filter_map)[n]; }
+
+    /// \brief Returns true if \c e is hidden.
+    ///
+    /// Returns true if \c e is hidden.
+    bool hidden(const Edge& e) const { return !(*_edge_filter_map)[e]; }
+
+    typedef False NodeNumTag;
+    typedef False EdgeNumTag;
+
+    typedef FindEdgeTagIndicator<Graph> FindEdgeTag;
+    Arc findArc(const Node& u, const Node& v, 
+		  const Arc& prev = INVALID) {
+      if (!(*_node_filter_map)[u] || !(*_node_filter_map)[v]) {
+        return INVALID;
+      }
+      Arc arc = Parent::findArc(u, v, prev);
+      while (arc != INVALID && !(*_edge_filter_map)[arc]) {
+        arc = Parent::findArc(u, v, arc);
+      }
+      return arc;
+    }
+    Edge findEdge(const Node& u, const Node& v, 
+		  const Edge& prev = INVALID) {
+      if (!(*_node_filter_map)[u] || !(*_node_filter_map)[v]) {
+        return INVALID;
+      }
+      Edge edge = Parent::findEdge(u, v, prev);
+      while (edge != INVALID && !(*_edge_filter_map)[edge]) {
+        edge = Parent::findEdge(u, v, edge);
+      }
+      return edge;
+    }
+
+    template <typename _Value>
+    class NodeMap : public SubMapExtender<Adaptor, 
+        typename Parent::template NodeMap<_Value> > {
+    public:
+      typedef _Value Value;
+      typedef SubMapExtender<Adaptor, typename Parent::
+                             template NodeMap<Value> > MapParent;
+    
+      NodeMap(const Adaptor& adaptor) 
+	: MapParent(adaptor) {}
+      NodeMap(const Adaptor& adaptor, const Value& value) 
+	: MapParent(adaptor, value) {}
+
+    private:
+      NodeMap& operator=(const NodeMap& cmap) {
+	return operator=<NodeMap>(cmap);
+      }
+    
+      template <typename CMap>
+      NodeMap& operator=(const CMap& cmap) {
+        MapParent::operator=(cmap);
+	return *this;
+      }
+    };
+
+    template <typename _Value>
+    class ArcMap : public SubMapExtender<Adaptor, 
+	typename Parent::template ArcMap<_Value> > {
+    public:
+      typedef _Value Value;
+      typedef SubMapExtender<Adaptor, typename Parent::
+                             template ArcMap<Value> > MapParent;
+    
+      ArcMap(const Adaptor& adaptor) 
+	: MapParent(adaptor) {}
+      ArcMap(const Adaptor& adaptor, const Value& value) 
+	: MapParent(adaptor, value) {}
+
+    private:
+      ArcMap& operator=(const ArcMap& cmap) {
+	return operator=<ArcMap>(cmap);
+      }
+    
+      template <typename CMap>
+      ArcMap& operator=(const CMap& cmap) {
+        MapParent::operator=(cmap);
+	return *this;
+      }
+    };
+
+    template <typename _Value>
+    class EdgeMap : public SubMapExtender<Adaptor, 
+        typename Parent::template EdgeMap<_Value> > {
+    public:
+      typedef _Value Value;
+      typedef SubMapExtender<Adaptor, typename Parent::
+                             template EdgeMap<Value> > MapParent;
+    
+      EdgeMap(const Adaptor& adaptor) 
+	: MapParent(adaptor) {}
+
+      EdgeMap(const Adaptor& adaptor, const Value& value) 
+	: MapParent(adaptor, value) {}
+
+    private:
+      EdgeMap& operator=(const EdgeMap& cmap) {
+	return operator=<EdgeMap>(cmap);
+      }
+    
+      template <typename CMap>
+      EdgeMap& operator=(const CMap& cmap) {
+        MapParent::operator=(cmap);
+	return *this;
+      }
+    };
+
+  };
+
+  template <typename _Graph, typename NodeFilterMap, typename EdgeFilterMap>
+  class SubGraphAdaptorBase<_Graph, NodeFilterMap, EdgeFilterMap, false> 
+    : public GraphAdaptorBase<_Graph> {
+  public:
+    typedef _Graph Graph;
+    typedef SubGraphAdaptorBase Adaptor;
+    typedef GraphAdaptorBase<_Graph> Parent;
+  protected:
+    NodeFilterMap* _node_filter_map;
+    EdgeFilterMap* _edge_filter_map;
+    SubGraphAdaptorBase() : Parent(), 
+			    _node_filter_map(0), _edge_filter_map(0) { }
+
+    void setNodeFilterMap(NodeFilterMap& node_filter_map) {
+      _node_filter_map=&node_filter_map;
+    }
+    void setEdgeFilterMap(EdgeFilterMap& edge_filter_map) {
+      _edge_filter_map=&edge_filter_map;
+    }
+
+  public:
+
+    typedef typename Parent::Node Node;
+    typedef typename Parent::Arc Arc;
+    typedef typename Parent::Edge Edge;
+
+    void first(Node& i) const { 
+      Parent::first(i); 
+      while (i!=INVALID && !(*_node_filter_map)[i]) Parent::next(i); 
+    }
+
+    void first(Arc& i) const { 
+      Parent::first(i); 
+      while (i!=INVALID && !(*_edge_filter_map)[i]) Parent::next(i); 
+    }
+
+    void first(Edge& i) const { 
+      Parent::first(i); 
+      while (i!=INVALID && !(*_edge_filter_map)[i]) Parent::next(i); 
+    }
+
+    void firstIn(Arc& i, const Node& n) const { 
+      Parent::firstIn(i, n); 
+      while (i!=INVALID && !(*_edge_filter_map)[i]) Parent::nextIn(i); 
+    }
+
+    void firstOut(Arc& i, const Node& n) const { 
+      Parent::firstOut(i, n); 
+      while (i!=INVALID && !(*_edge_filter_map)[i]) Parent::nextOut(i); 
+    }
+
+    void firstInc(Edge& i, bool& d, const Node& n) const { 
+      Parent::firstInc(i, d, n); 
+      while (i!=INVALID && !(*_edge_filter_map)[i]) Parent::nextInc(i, d); 
+    }
+
+    void next(Node& i) const { 
+      Parent::next(i); 
+      while (i!=INVALID && !(*_node_filter_map)[i]) Parent::next(i); 
+    }
+    void next(Arc& i) const { 
+      Parent::next(i); 
+      while (i!=INVALID && !(*_edge_filter_map)[i]) Parent::next(i); 
+    }
+    void next(Edge& i) const { 
+      Parent::next(i); 
+      while (i!=INVALID && !(*_edge_filter_map)[i]) Parent::next(i); 
+    }
+    void nextIn(Arc& i) const { 
+      Parent::nextIn(i); 
+      while (i!=INVALID && !(*_edge_filter_map)[i]) Parent::nextIn(i); 
+    }
+
+    void nextOut(Arc& i) const { 
+      Parent::nextOut(i); 
+      while (i!=INVALID && !(*_edge_filter_map)[i]) Parent::nextOut(i); 
+    }
+    void nextInc(Edge& i, bool& d) const { 
+      Parent::nextInc(i, d); 
+      while (i!=INVALID && !(*_edge_filter_map)[i]) Parent::nextInc(i, d); 
+    }
+
+    /// \brief Hide the given node in the graph.
+    ///
+    /// This function hides \c n in the graph, i.e. the iteration 
+    /// jumps over it. This is done by simply setting the value of \c n  
+    /// to be false in the corresponding node-map.
+    void hide(const Node& n) const { _node_filter_map->set(n, false); }
+
+    /// \brief Hide the given edge in the graph.
+    ///
+    /// This function hides \c e in the graph, i.e. the iteration 
+    /// jumps over it. This is done by simply setting the value of \c e  
+    /// to be false in the corresponding edge-map.
+    void hide(const Edge& e) const { _edge_filter_map->set(e, false); }
+
+    /// \brief Unhide the given node in the graph.
+    ///
+    /// The value of \c n is set to be true in the node-map which stores 
+    /// hide information. If \c n was hidden previuosly, then it is shown 
+    /// again
+     void unHide(const Node& n) const { _node_filter_map->set(n, true); }
+
+    /// \brief Hide the given edge in the graph.
+    ///
+    /// The value of \c e is set to be true in the edge-map which stores 
+    /// hide information. If \c e was hidden previuosly, then it is shown 
+    /// again
+    void unHide(const Edge& e) const { _edge_filter_map->set(e, true); }
+
+    /// \brief Returns true if \c n is hidden.
+    ///
+    /// Returns true if \c n is hidden.
+    bool hidden(const Node& n) const { return !(*_node_filter_map)[n]; }
+
+    /// \brief Returns true if \c e is hidden.
+    ///
+    /// Returns true if \c e is hidden.
+    bool hidden(const Edge& e) const { return !(*_edge_filter_map)[e]; }
+
+    typedef False NodeNumTag;
+    typedef False EdgeNumTag;
+
+    typedef FindEdgeTagIndicator<Graph> FindEdgeTag;
+    Arc findArc(const Node& u, const Node& v, 
+		  const Arc& prev = INVALID) {
+      Arc arc = Parent::findArc(u, v, prev);
+      while (arc != INVALID && !(*_edge_filter_map)[arc]) {
+        arc = Parent::findArc(u, v, arc);
+      }
+      return arc;
+    }
+    Edge findEdge(const Node& u, const Node& v, 
+		  const Edge& prev = INVALID) {
+      Edge edge = Parent::findEdge(u, v, prev);
+      while (edge != INVALID && !(*_edge_filter_map)[edge]) {
+        edge = Parent::findEdge(u, v, edge);
+      }
+      return edge;
+    }
+
+    template <typename _Value>
+    class NodeMap : public SubMapExtender<Adaptor, 
+        typename Parent::template NodeMap<_Value> > {
+    public:
+      typedef _Value Value;
+      typedef SubMapExtender<Adaptor, typename Parent::
+                             template NodeMap<Value> > MapParent;
+    
+      NodeMap(const Adaptor& adaptor) 
+	: MapParent(adaptor) {}
+      NodeMap(const Adaptor& adaptor, const Value& value) 
+	: MapParent(adaptor, value) {}
+    
+    private:
+      NodeMap& operator=(const NodeMap& cmap) {
+	return operator=<NodeMap>(cmap);
+      }
+    
+      template <typename CMap>
+      NodeMap& operator=(const CMap& cmap) {
+        MapParent::operator=(cmap);
+	return *this;
+      }
+    };
+
+    template <typename _Value>
+    class ArcMap : public SubMapExtender<Adaptor, 
+	typename Parent::template ArcMap<_Value> > {
+    public:
+      typedef _Value Value;
+      typedef SubMapExtender<Adaptor, typename Parent::
+                             template ArcMap<Value> > MapParent;
+    
+      ArcMap(const Adaptor& adaptor) 
+	: MapParent(adaptor) {}
+      ArcMap(const Adaptor& adaptor, const Value& value) 
+	: MapParent(adaptor, value) {}
+
+    private:
+      ArcMap& operator=(const ArcMap& cmap) {
+	return operator=<ArcMap>(cmap);
+      }
+    
+      template <typename CMap>
+      ArcMap& operator=(const CMap& cmap) {
+        MapParent::operator=(cmap);
+	return *this;
+      }
+    };
+
+    template <typename _Value>
+    class EdgeMap : public SubMapExtender<Adaptor, 
+        typename Parent::template EdgeMap<_Value> > {
+    public:
+      typedef _Value Value;
+      typedef SubMapExtender<Adaptor, typename Parent::
+                             template EdgeMap<Value> > MapParent;
+    
+      EdgeMap(const Adaptor& adaptor) 
+	: MapParent(adaptor) {}
+
+      EdgeMap(const Adaptor& adaptor, const _Value& value) 
+	: MapParent(adaptor, value) {}
+
+    private:
+      EdgeMap& operator=(const EdgeMap& cmap) {
+	return operator=<EdgeMap>(cmap);
+      }
+    
+      template <typename CMap>
+      EdgeMap& operator=(const CMap& cmap) {
+        MapParent::operator=(cmap);
+	return *this;
+      }
+    };
+
+  };
+
+  /// \ingroup graph_adaptors
+  ///
+  /// \brief A graph adaptor for hiding nodes and arcs from an
+  /// undirected graph.
+  /// 
+  /// SubGraphAdaptor shows the graph with filtered node-set and
+  /// edge-set. If the \c checked parameter is true then it filters
+  /// the edge-set to do not get invalid edges which incident node is
+  /// filtered.
+  /// 
+  /// If the \c checked template parameter is false then we have to
+  /// note that the node-iterator cares only the filter on the
+  /// node-set, and the edge-iterator cares only the filter on the
+  /// edge-set.  This way the edge-map should filter all arcs which
+  /// has filtered end node.
+  template<typename _Graph, typename NodeFilterMap, 
+	   typename EdgeFilterMap, bool checked = true>
+  class SubGraphAdaptor : 
+    public GraphAdaptorExtender<
+    SubGraphAdaptorBase<_Graph, NodeFilterMap, EdgeFilterMap, checked> > {
+  public:
+    typedef _Graph Graph;
+    typedef GraphAdaptorExtender<
+      SubGraphAdaptorBase<_Graph, NodeFilterMap, EdgeFilterMap> > Parent;
+  protected:
+    SubGraphAdaptor() { }
+  public:
+    SubGraphAdaptor(Graph& _graph, NodeFilterMap& node_filter_map, 
+		    EdgeFilterMap& edge_filter_map) { 
+      setGraph(_graph);
+      setNodeFilterMap(node_filter_map);
+      setEdgeFilterMap(edge_filter_map);
+    }
+  };
+
+  template<typename Graph, typename NodeFilterMap, typename ArcFilterMap>
+  SubGraphAdaptor<const Graph, NodeFilterMap, ArcFilterMap>
+  subGraphAdaptor(const Graph& graph, 
+                   NodeFilterMap& nfm, ArcFilterMap& efm) {
+    return SubGraphAdaptor<const Graph, NodeFilterMap, ArcFilterMap>
+      (graph, nfm, efm);
+  }
+
+  template<typename Graph, typename NodeFilterMap, typename ArcFilterMap>
+  SubGraphAdaptor<const Graph, const NodeFilterMap, ArcFilterMap>
+  subGraphAdaptor(const Graph& graph, 
+                   NodeFilterMap& nfm, ArcFilterMap& efm) {
+    return SubGraphAdaptor<const Graph, const NodeFilterMap, ArcFilterMap>
+      (graph, nfm, efm);
+  }
+
+  template<typename Graph, typename NodeFilterMap, typename ArcFilterMap>
+  SubGraphAdaptor<const Graph, NodeFilterMap, const ArcFilterMap>
+  subGraphAdaptor(const Graph& graph, 
+                   NodeFilterMap& nfm, ArcFilterMap& efm) {
+    return SubGraphAdaptor<const Graph, NodeFilterMap, const ArcFilterMap>
+      (graph, nfm, efm);
+  }
+
+  template<typename Graph, typename NodeFilterMap, typename ArcFilterMap>
+  SubGraphAdaptor<const Graph, const NodeFilterMap, const ArcFilterMap>
+  subGraphAdaptor(const Graph& graph, 
+                   NodeFilterMap& nfm, ArcFilterMap& efm) {
+    return SubGraphAdaptor<const Graph, const NodeFilterMap, 
+      const ArcFilterMap>(graph, nfm, efm);
+  }
+
+  /// \ingroup graph_adaptors
+  ///
+  /// \brief An adaptor for hiding nodes from an graph.
+  ///
+  /// An adaptor for hiding nodes from an graph.  This
+  /// adaptor specializes SubGraphAdaptor in the way that only the
+  /// node-set can be filtered. In usual case the checked parameter is
+  /// true, we get the induced subgraph. But if the checked parameter
+  /// is false then we can filter only isolated nodes.
+  template<typename _Graph, typename _NodeFilterMap, bool checked = true>
+  class NodeSubGraphAdaptor : 
+    public SubGraphAdaptor<_Graph, _NodeFilterMap, 
+			   ConstMap<typename _Graph::Edge, bool>, checked> {
+  public:
+    typedef _Graph Graph;
+    typedef _NodeFilterMap NodeFilterMap;
+    typedef SubGraphAdaptor<Graph, NodeFilterMap, 
+			    ConstMap<typename Graph::Edge, bool> > Parent;
+  protected:
+    ConstMap<typename Graph::Edge, bool> const_true_map;
+
+    NodeSubGraphAdaptor() : const_true_map(true) {
+      Parent::setEdgeFilterMap(const_true_map);
+    }
+
+  public:
+    NodeSubGraphAdaptor(Graph& _graph, NodeFilterMap& node_filter_map) : 
+      Parent(), const_true_map(true) { 
+      Parent::setGraph(_graph);
+      Parent::setNodeFilterMap(node_filter_map);
+      Parent::setEdgeFilterMap(const_true_map);
+    }
+  };
+
+  template<typename Graph, typename NodeFilterMap>
+  NodeSubGraphAdaptor<const Graph, NodeFilterMap>
+  nodeSubGraphAdaptor(const Graph& graph, NodeFilterMap& nfm) {
+    return NodeSubGraphAdaptor<const Graph, NodeFilterMap>(graph, nfm);
+  }
+
+  template<typename Graph, typename NodeFilterMap>
+  NodeSubGraphAdaptor<const Graph, const NodeFilterMap>
+  nodeSubGraphAdaptor(const Graph& graph, const NodeFilterMap& nfm) {
+    return NodeSubGraphAdaptor<const Graph, const NodeFilterMap>(graph, nfm);
+  }
+
+  /// \ingroup graph_adaptors
+  ///
+  /// \brief An adaptor for hiding edges from an graph.
+  ///
+  /// \warning Graph adaptors are in even more experimental state
+  /// than the other parts of the lib. Use them at you own risk.
+  ///
+  /// An adaptor for hiding edges from an graph.
+  /// This adaptor specializes SubGraphAdaptor in the way that
+  /// only the arc-set 
+  /// can be filtered.
+  template<typename _Graph, typename _EdgeFilterMap>
+  class EdgeSubGraphAdaptor : 
+    public SubGraphAdaptor<_Graph, ConstMap<typename _Graph::Node,bool>, 
+                           _EdgeFilterMap, false> {
+  public:
+    typedef _Graph Graph;
+    typedef _EdgeFilterMap EdgeFilterMap;
+    typedef SubGraphAdaptor<Graph, ConstMap<typename Graph::Node,bool>, 
+			    EdgeFilterMap, false> Parent;
+  protected:
+    ConstMap<typename Graph::Node, bool> const_true_map;
+
+    EdgeSubGraphAdaptor() : const_true_map(true) {
+      Parent::setNodeFilterMap(const_true_map);
+    }
+
+  public:
+
+    EdgeSubGraphAdaptor(Graph& _graph, EdgeFilterMap& edge_filter_map) : 
+      Parent(), const_true_map(true) { 
+      Parent::setGraph(_graph);
+      Parent::setNodeFilterMap(const_true_map);
+      Parent::setEdgeFilterMap(edge_filter_map);
+    }
+
+  };
+
+  template<typename Graph, typename EdgeFilterMap>
+  EdgeSubGraphAdaptor<const Graph, EdgeFilterMap>
+  edgeSubGraphAdaptor(const Graph& graph, EdgeFilterMap& efm) {
+    return EdgeSubGraphAdaptor<const Graph, EdgeFilterMap>(graph, efm);
+  }
+
+  template<typename Graph, typename EdgeFilterMap>
+  EdgeSubGraphAdaptor<const Graph, const EdgeFilterMap>
+  edgeSubGraphAdaptor(const Graph& graph, const EdgeFilterMap& efm) {
+    return EdgeSubGraphAdaptor<const Graph, const EdgeFilterMap>(graph, efm);
+  }
+
+  /// \brief Base of direct graph adaptor
+  ///
+  /// Base class of the direct graph adaptor. All public member
+  /// of this class can be used with the DirGraphAdaptor too.
+  /// \sa DirGraphAdaptor
+  template <typename _Graph, typename _DirectionMap>
+  class DirGraphAdaptorBase {
+  public:
+    
+    typedef _Graph Graph;
+    typedef _DirectionMap DirectionMap;
+
+    typedef typename Graph::Node Node;
+    typedef typename Graph::Edge Arc;
+   
+    /// \brief Reverse arc
+    /// 
+    /// It reverse the given arc. It simply negate the direction in the map.
+    void reverseArc(const Arc& arc) {
+      _direction->set(arc, !(*_direction)[arc]);
+    }
+
+    void first(Node& i) const { _graph->first(i); }
+    void first(Arc& i) const { _graph->first(i); }
+    void firstIn(Arc& i, const Node& n) const {
+      bool d;
+      _graph->firstInc(i, d, n);
+      while (i != INVALID && d == (*_direction)[i]) _graph->nextInc(i, d);
+    }
+    void firstOut(Arc& i, const Node& n ) const { 
+      bool d;
+      _graph->firstInc(i, d, n);
+      while (i != INVALID && d != (*_direction)[i]) _graph->nextInc(i, d);
+    }
+
+    void next(Node& i) const { _graph->next(i); }
+    void next(Arc& i) const { _graph->next(i); }
+    void nextIn(Arc& i) const {
+      bool d = !(*_direction)[i];
+      _graph->nextInc(i, d);
+      while (i != INVALID && d == (*_direction)[i]) _graph->nextInc(i, d);
+    }
+    void nextOut(Arc& i) const {
+      bool d = (*_direction)[i];
+      _graph->nextInc(i, d);
+      while (i != INVALID && d != (*_direction)[i]) _graph->nextInc(i, d);
+    }
+
+    Node source(const Arc& e) const { 
+      return (*_direction)[e] ? _graph->u(e) : _graph->v(e); 
+    }
+    Node target(const Arc& e) const { 
+      return (*_direction)[e] ? _graph->v(e) : _graph->u(e); 
+    }
+
+    typedef NodeNumTagIndicator<Graph> NodeNumTag;
+    int nodeNum() const { return _graph->nodeNum(); }
+    
+    typedef EdgeNumTagIndicator<Graph> EdgeNumTag;
+    int arcNum() const { return _graph->edgeNum(); }
+
+    typedef FindEdgeTagIndicator<Graph> FindEdgeTag;
+    Arc findArc(const Node& u, const Node& v, 
+		  const Arc& prev = INVALID) {
+      Arc arc = prev;
+      bool d = arc == INVALID ? true : (*_direction)[arc];
+      if (d) {
+        arc = _graph->findEdge(u, v, arc);
+        while (arc != INVALID && !(*_direction)[arc]) {
+          _graph->findEdge(u, v, arc);
+        }
+        if (arc != INVALID) return arc;
+      }
+      _graph->findEdge(v, u, arc);
+      while (arc != INVALID && (*_direction)[arc]) {
+        _graph->findEdge(u, v, arc);
+      }
+      return arc;
+    }
+  
+    Node addNode() { 
+      return Node(_graph->addNode()); 
+    }
+
+    Arc addArc(const Node& u, const Node& v) {
+      Arc arc = _graph->addArc(u, v);
+      _direction->set(arc, _graph->source(arc) == u);
+      return arc; 
+    }
+
+    void erase(const Node& i) { _graph->erase(i); }
+    void erase(const Arc& i) { _graph->erase(i); }
+  
+    void clear() { _graph->clear(); }
+    
+    int id(const Node& v) const { return _graph->id(v); }
+    int id(const Arc& e) const { return _graph->id(e); }
+
+    Node nodeFromId(int idx) const { return _graph->nodeFromId(idx); }
+    Arc arcFromId(int idx) const { return _graph->edgeFromId(idx); }
+
+    int maxNodeId() const { return _graph->maxNodeId(); }
+    int maxArcId() const { return _graph->maxEdgeId(); }
+
+    typedef typename ItemSetTraits<Graph, Node>::ItemNotifier NodeNotifier;
+    NodeNotifier& notifier(Node) const { return _graph->notifier(Node()); } 
+
+    typedef typename ItemSetTraits<Graph, Arc>::ItemNotifier ArcNotifier;
+    ArcNotifier& notifier(Arc) const { return _graph->notifier(Arc()); } 
+
+    template <typename _Value>
+    class NodeMap : public _Graph::template NodeMap<_Value> {
+    public:
+
+      typedef typename _Graph::template NodeMap<_Value> Parent;
+
+      explicit NodeMap(const DirGraphAdaptorBase& adapter) 
+	: Parent(*adapter._graph) {}
+
+      NodeMap(const DirGraphAdaptorBase& adapter, const _Value& value)
+	: Parent(*adapter._graph, value) {}
+
+    private:
+      NodeMap& operator=(const NodeMap& cmap) {
+        return operator=<NodeMap>(cmap);
+      }
+
+      template <typename CMap>
+      NodeMap& operator=(const CMap& cmap) {
+        Parent::operator=(cmap);
+        return *this;
+      }
+
+    };
+
+    template <typename _Value>
+    class ArcMap : public _Graph::template EdgeMap<_Value> {
+    public:
+
+      typedef typename Graph::template EdgeMap<_Value> Parent;
+
+      explicit ArcMap(const DirGraphAdaptorBase& adapter) 
+	: Parent(*adapter._graph) { }
+
+      ArcMap(const DirGraphAdaptorBase& adapter, const _Value& value)
+	: Parent(*adapter._graph, value) { }
+
+    private:
+      ArcMap& operator=(const ArcMap& cmap) {
+        return operator=<ArcMap>(cmap);
+      }
+
+      template <typename CMap>
+      ArcMap& operator=(const CMap& cmap) {
+        Parent::operator=(cmap);
+        return *this;
+      }
+    };
+
+    
+
+  protected:
+    Graph* _graph;
+    DirectionMap* _direction;
+
+    void setDirectionMap(DirectionMap& direction) {
+      _direction = &direction;
+    }
+
+    void setGraph(Graph& graph) {
+      _graph = &graph;
+    }
+
+  };
+
+
+  /// \ingroup graph_adaptors
+  ///
+  /// \brief A directed graph is made from an graph by an adaptor
+  ///
+  /// This adaptor gives a direction for each edge in the undirected
+  /// graph. The direction of the arcs stored in the
+  /// DirectionMap. This map is a bool map on the edges. If
+  /// the edge is mapped to true then the direction of the directed
+  /// arc will be the same as the default direction of the edge. The
+  /// arcs can be easily reverted by the \ref
+  /// DirGraphAdaptorBase::reverseArc "reverseArc()" member in the
+  /// adaptor.
+  ///
+  /// It can be used to solve orientation problems on directed graphs.
+  /// For example how can we orient an graph to get the minimum
+  /// number of strongly connected components. If we orient the arcs with
+  /// the dfs algorithm out from the source then we will get such an 
+  /// orientation. 
+  ///
+  /// We use the \ref DfsVisitor "visitor" interface of the 
+  /// \ref DfsVisit "dfs" algorithm:
+  ///\code
+  /// template <typename DirMap>
+  /// class OrientVisitor : public DfsVisitor<Graph> {
+  /// public:
+  ///
+  ///   OrientVisitor(const Graph& graph, DirMap& dirMap)
+  ///     : _graph(graph), _dirMap(dirMap), _processed(graph, false) {}
+  ///
+  ///   void discover(const Arc& arc) {
+  ///     _processed.set(arc, true);
+  ///     _dirMap.set(arc, _graph.direction(arc));
+  ///   }
+  ///
+  ///   void examine(const Arc& arc) {
+  ///     if (_processed[arc]) return;
+  ///     _processed.set(arc, true);
+  ///     _dirMap.set(arc, _graph.direction(arc));
+  ///   }  
+  /// 
+  /// private:
+  ///   const Graph& _graph;  
+  ///   DirMap& _dirMap;
+  ///   Graph::EdgeMap<bool> _processed;
+  /// };
+  ///\endcode
+  ///
+  /// And now we can use the orientation:
+  ///\code
+  /// Graph::EdgeMap<bool> dmap(graph);
+  ///
+  /// typedef OrientVisitor<Graph::EdgeMap<bool> > Visitor;
+  /// Visitor visitor(graph, dmap);
+  ///
+  /// DfsVisit<Graph, Visitor> dfs(graph, visitor);
+  ///
+  /// dfs.run();
+  ///
+  /// typedef DirGraphAdaptor<Graph> DGraph;
+  /// DGraph dgraph(graph, dmap);
+  ///
+  /// LEMON_ASSERT(countStronglyConnectedComponents(dgraph) == 
+  ///              countBiArcConnectedComponents(graph), "Wrong Orientation");
+  ///\endcode
+  ///
+  /// The number of the bi-connected components is a lower bound for
+  /// the number of the strongly connected components in the directed
+  /// graph because if we contract the bi-connected components to
+  /// nodes we will get a tree therefore we cannot orient arcs in
+  /// both direction between bi-connected components. In the other way
+  /// the algorithm will orient one component to be strongly
+  /// connected. The two relations proof that the assertion will
+  /// be always true and the found solution is optimal.
+  ///
+  /// \sa DirGraphAdaptorBase
+  /// \sa dirGraphAdaptor
+  template<typename _Graph, 
+           typename DirectionMap = typename _Graph::template EdgeMap<bool> > 
+  class DirGraphAdaptor : 
+    public DigraphAdaptorExtender<DirGraphAdaptorBase<_Graph, DirectionMap> > {
+  public:
+    typedef _Graph Graph;
+    typedef DigraphAdaptorExtender<
+      DirGraphAdaptorBase<_Graph, DirectionMap> > Parent;
+  protected:
+    DirGraphAdaptor() { }
+  public:
+    
+    /// \brief Constructor of the adaptor
+    ///
+    /// Constructor of the adaptor
+    DirGraphAdaptor(Graph& graph, DirectionMap& direction) { 
+      setGraph(graph);
+      setDirectionMap(direction);
+    }
+  };
+
+  /// \brief Just gives back a DirGraphAdaptor
+  ///
+  /// Just gives back a DirGraphAdaptor
+  template<typename Graph, typename DirectionMap>
+  DirGraphAdaptor<const Graph, DirectionMap>
+  dirGraphAdaptor(const Graph& graph, DirectionMap& dm) {
+    return DirGraphAdaptor<const Graph, DirectionMap>(graph, dm);
+  }
+
+  template<typename Graph, typename DirectionMap>
+  DirGraphAdaptor<const Graph, const DirectionMap>
+  dirGraphAdaptor(const Graph& graph, const DirectionMap& dm) {
+    return DirGraphAdaptor<const Graph, const DirectionMap>(graph, dm);
+  }
+
+}
+
+#endif
Index: lemon/hao_orlin.h
===================================================================
--- lemon/hao_orlin.h	(revision 412)
+++ 	(revision )
@@ -1,966 +1,0 @@
-/* -*- mode: C++; indent-tabs-mode: nil; -*-
- *
- * This file is a part of LEMON, a generic C++ optimization library.
- *
- * Copyright (C) 2003-2008
- * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
- * (Egervary Research Group on Combinatorial Optimization, EGRES).
- *
- * Permission to use, modify and distribute this software is granted
- * provided that this copyright notice appears in all copies. For
- * precise terms see the accompanying LICENSE file.
- *
- * This software is provided "AS IS" with no warranty of any kind,
- * express or implied, and with no claim as to its suitability for any
- * purpose.
- *
- */
-
-#ifndef LEMON_HAO_ORLIN_H
-#define LEMON_HAO_ORLIN_H
-
-#include <vector>
-#include <list>
-#include <limits>
-
-#include <lemon/maps.h>
-#include <lemon/core.h>
-#include <lemon/tolerance.h>
-
-/// \file
-/// \ingroup min_cut
-/// \brief Implementation of the Hao-Orlin algorithm.
-///
-/// Implementation of the Hao-Orlin algorithm class for testing network
-/// reliability.
-
-namespace lemon {
-
-  /// \ingroup min_cut
-  ///
-  /// \brief %Hao-Orlin algorithm to find a minimum cut in directed graphs.
-  ///
-  /// Hao-Orlin calculates a minimum cut in a directed graph
-  /// \f$D=(V,A)\f$. It takes a fixed node \f$ source \in V \f$ and
-  /// consists of two phases: in the first phase it determines a
-  /// minimum cut with \f$ source \f$ on the source-side (i.e. a set
-  /// \f$ X\subsetneq V \f$ with \f$ source \in X \f$ and minimal
-  /// out-degree) and in the second phase it determines a minimum cut
-  /// with \f$ source \f$ on the sink-side (i.e. a set
-  /// \f$ X\subsetneq V \f$ with \f$ source \notin X \f$ and minimal
-  /// out-degree). Obviously, the smaller of these two cuts will be a
-  /// minimum cut of \f$ D \f$. The algorithm is a modified
-  /// push-relabel preflow algorithm and our implementation calculates
-  /// the minimum cut in \f$ O(n^2\sqrt{m}) \f$ time (we use the
-  /// highest-label rule), or in \f$O(nm)\f$ for unit capacities. The
-  /// purpose of such algorithm is testing network reliability. For an
-  /// undirected graph you can run just the first phase of the
-  /// algorithm or you can use the algorithm of Nagamochi and Ibaraki
-  /// which solves the undirected problem in
-  /// \f$ O(nm + n^2 \log(n)) \f$ time: it is implemented in the
-  /// NagamochiIbaraki algorithm class.
-  ///
-  /// \param _Digraph is the graph type of the algorithm.
-  /// \param _CapacityMap is an edge map of capacities which should
-  /// be any numreric type. The default type is _Digraph::ArcMap<int>.
-  /// \param _Tolerance is the handler of the inexact computation. The
-  /// default type for this is Tolerance<CapacityMap::Value>.
-#ifdef DOXYGEN
-  template <typename _Digraph, typename _CapacityMap, typename _Tolerance>
-#else
-  template <typename _Digraph,
-            typename _CapacityMap = typename _Digraph::template ArcMap<int>,
-            typename _Tolerance = Tolerance<typename _CapacityMap::Value> >
-#endif
-  class HaoOrlin {
-  private:
-
-    typedef _Digraph Digraph;
-    typedef _CapacityMap CapacityMap;
-    typedef _Tolerance Tolerance;
-
-    typedef typename CapacityMap::Value Value;
-
-    TEMPLATE_GRAPH_TYPEDEFS(Digraph);
-
-    const Digraph& _graph;
-    const CapacityMap* _capacity;
-
-    typedef typename Digraph::template ArcMap<Value> FlowMap;
-    FlowMap* _flow;
-
-    Node _source;
-
-    int _node_num;
-
-    // Bucketing structure
-    std::vector<Node> _first, _last;
-    typename Digraph::template NodeMap<Node>* _next;
-    typename Digraph::template NodeMap<Node>* _prev;
-    typename Digraph::template NodeMap<bool>* _active;
-    typename Digraph::template NodeMap<int>* _bucket;
-
-    std::vector<bool> _dormant;
-
-    std::list<std::list<int> > _sets;
-    std::list<int>::iterator _highest;
-
-    typedef typename Digraph::template NodeMap<Value> ExcessMap;
-    ExcessMap* _excess;
-
-    typedef typename Digraph::template NodeMap<bool> SourceSetMap;
-    SourceSetMap* _source_set;
-
-    Value _min_cut;
-
-    typedef typename Digraph::template NodeMap<bool> MinCutMap;
-    MinCutMap* _min_cut_map;
-
-    Tolerance _tolerance;
-
-  public:
-
-    /// \brief Constructor
-    ///
-    /// Constructor of the algorithm class.
-    HaoOrlin(const Digraph& graph, const CapacityMap& capacity,
-             const Tolerance& tolerance = Tolerance()) :
-      _graph(graph), _capacity(&capacity), _flow(0), _source(),
-      _node_num(), _first(), _last(), _next(0), _prev(0),
-      _active(0), _bucket(0), _dormant(), _sets(), _highest(),
-      _excess(0), _source_set(0), _min_cut(), _min_cut_map(0),
-      _tolerance(tolerance) {}
-
-    ~HaoOrlin() {
-      if (_min_cut_map) {
-        delete _min_cut_map;
-      }
-      if (_source_set) {
-        delete _source_set;
-      }
-      if (_excess) {
-        delete _excess;
-      }
-      if (_next) {
-        delete _next;
-      }
-      if (_prev) {
-        delete _prev;
-      }
-      if (_active) {
-        delete _active;
-      }
-      if (_bucket) {
-        delete _bucket;
-      }
-      if (_flow) {
-        delete _flow;
-      }
-    }
-
-  private:
-
-    void activate(const Node& i) {
-      _active->set(i, true);
-
-      int bucket = (*_bucket)[i];
-
-      if ((*_prev)[i] == INVALID || (*_active)[(*_prev)[i]]) return;
-      //unlace
-      _next->set((*_prev)[i], (*_next)[i]);
-      if ((*_next)[i] != INVALID) {
-        _prev->set((*_next)[i], (*_prev)[i]);
-      } else {
-        _last[bucket] = (*_prev)[i];
-      }
-      //lace
-      _next->set(i, _first[bucket]);
-      _prev->set(_first[bucket], i);
-      _prev->set(i, INVALID);
-      _first[bucket] = i;
-    }
-
-    void deactivate(const Node& i) {
-      _active->set(i, false);
-      int bucket = (*_bucket)[i];
-
-      if ((*_next)[i] == INVALID || !(*_active)[(*_next)[i]]) return;
-
-      //unlace
-      _prev->set((*_next)[i], (*_prev)[i]);
-      if ((*_prev)[i] != INVALID) {
-        _next->set((*_prev)[i], (*_next)[i]);
-      } else {
-        _first[bucket] = (*_next)[i];
-      }
-      //lace
-      _prev->set(i, _last[bucket]);
-      _next->set(_last[bucket], i);
-      _next->set(i, INVALID);
-      _last[bucket] = i;
-    }
-
-    void addItem(const Node& i, int bucket) {
-      (*_bucket)[i] = bucket;
-      if (_last[bucket] != INVALID) {
-        _prev->set(i, _last[bucket]);
-        _next->set(_last[bucket], i);
-        _next->set(i, INVALID);
-        _last[bucket] = i;
-      } else {
-        _prev->set(i, INVALID);
-        _first[bucket] = i;
-        _next->set(i, INVALID);
-        _last[bucket] = i;
-      }
-    }
-
-    void findMinCutOut() {
-
-      for (NodeIt n(_graph); n != INVALID; ++n) {
-        _excess->set(n, 0);
-      }
-
-      for (ArcIt a(_graph); a != INVALID; ++a) {
-        _flow->set(a, 0);
-      }
-
-      int bucket_num = 0;
-      std::vector<Node> queue(_node_num);
-      int qfirst = 0, qlast = 0, qsep = 0;
-
-      {
-        typename Digraph::template NodeMap<bool> reached(_graph, false);
-
-        reached.set(_source, true);
-        bool first_set = true;
-
-        for (NodeIt t(_graph); t != INVALID; ++t) {
-          if (reached[t]) continue;
-          _sets.push_front(std::list<int>());
-          
-          queue[qlast++] = t;
-          reached.set(t, true);
-
-          while (qfirst != qlast) {
-            if (qsep == qfirst) {
-              ++bucket_num;
-              _sets.front().push_front(bucket_num);
-              _dormant[bucket_num] = !first_set;
-              _first[bucket_num] = _last[bucket_num] = INVALID;
-              qsep = qlast;
-            }
-
-            Node n = queue[qfirst++];
-            addItem(n, bucket_num);
-
-            for (InArcIt a(_graph, n); a != INVALID; ++a) {
-              Node u = _graph.source(a);
-              if (!reached[u] && _tolerance.positive((*_capacity)[a])) {
-                reached.set(u, true);
-                queue[qlast++] = u;
-              }
-            }
-          }
-          first_set = false;
-        }
-
-        ++bucket_num;
-        _bucket->set(_source, 0);
-        _dormant[0] = true;
-      }
-      _source_set->set(_source, true);
-
-      Node target = _last[_sets.back().back()];
-      {
-        for (OutArcIt a(_graph, _source); a != INVALID; ++a) {
-          if (_tolerance.positive((*_capacity)[a])) {
-            Node u = _graph.target(a);
-            _flow->set(a, (*_capacity)[a]);
-            _excess->set(u, (*_excess)[u] + (*_capacity)[a]);
-            if (!(*_active)[u] && u != _source) {
-              activate(u);
-            }
-          }
-        }
-
-        if ((*_active)[target]) {
-          deactivate(target);
-        }
-
-        _highest = _sets.back().begin();
-        while (_highest != _sets.back().end() &&
-               !(*_active)[_first[*_highest]]) {
-          ++_highest;
-        }
-      }
-
-      while (true) {
-        while (_highest != _sets.back().end()) {
-          Node n = _first[*_highest];
-          Value excess = (*_excess)[n];
-          int next_bucket = _node_num;
-
-          int under_bucket;
-          if (++std::list<int>::iterator(_highest) == _sets.back().end()) {
-            under_bucket = -1;
-          } else {
-            under_bucket = *(++std::list<int>::iterator(_highest));
-          }
-
-          for (OutArcIt a(_graph, n); a != INVALID; ++a) {
-            Node v = _graph.target(a);
-            if (_dormant[(*_bucket)[v]]) continue;
-            Value rem = (*_capacity)[a] - (*_flow)[a];
-            if (!_tolerance.positive(rem)) continue;
-            if ((*_bucket)[v] == under_bucket) {
-              if (!(*_active)[v] && v != target) {
-                activate(v);
-              }
-              if (!_tolerance.less(rem, excess)) {
-                _flow->set(a, (*_flow)[a] + excess);
-                _excess->set(v, (*_excess)[v] + excess);
-                excess = 0;
-                goto no_more_push;
-              } else {
-                excess -= rem;
-                _excess->set(v, (*_excess)[v] + rem);
-                _flow->set(a, (*_capacity)[a]);
-              }
-            } else if (next_bucket > (*_bucket)[v]) {
-              next_bucket = (*_bucket)[v];
-            }
-          }
-
-          for (InArcIt a(_graph, n); a != INVALID; ++a) {
-            Node v = _graph.source(a);
-            if (_dormant[(*_bucket)[v]]) continue;
-            Value rem = (*_flow)[a];
-            if (!_tolerance.positive(rem)) continue;
-            if ((*_bucket)[v] == under_bucket) {
-              if (!(*_active)[v] && v != target) {
-                activate(v);
-              }
-              if (!_tolerance.less(rem, excess)) {
-                _flow->set(a, (*_flow)[a] - excess);
-                _excess->set(v, (*_excess)[v] + excess);
-                excess = 0;
-                goto no_more_push;
-              } else {
-                excess -= rem;
-                _excess->set(v, (*_excess)[v] + rem);
-                _flow->set(a, 0);
-              }
-            } else if (next_bucket > (*_bucket)[v]) {
-              next_bucket = (*_bucket)[v];
-            }
-          }
-
-        no_more_push:
-
-          _excess->set(n, excess);
-
-          if (excess != 0) {
-            if ((*_next)[n] == INVALID) {
-              typename std::list<std::list<int> >::iterator new_set =
-                _sets.insert(--_sets.end(), std::list<int>());
-              new_set->splice(new_set->end(), _sets.back(),
-                              _sets.back().begin(), ++_highest);
-              for (std::list<int>::iterator it = new_set->begin();
-                   it != new_set->end(); ++it) {
-                _dormant[*it] = true;
-              }
-              while (_highest != _sets.back().end() &&
-                     !(*_active)[_first[*_highest]]) {
-                ++_highest;
-              }
-            } else if (next_bucket == _node_num) {
-              _first[(*_bucket)[n]] = (*_next)[n];
-              _prev->set((*_next)[n], INVALID);
-
-              std::list<std::list<int> >::iterator new_set =
-                _sets.insert(--_sets.end(), std::list<int>());
-
-              new_set->push_front(bucket_num);
-              _bucket->set(n, bucket_num);
-              _first[bucket_num] = _last[bucket_num] = n;
-              _next->set(n, INVALID);
-              _prev->set(n, INVALID);
-              _dormant[bucket_num] = true;
-              ++bucket_num;
-
-              while (_highest != _sets.back().end() &&
-                     !(*_active)[_first[*_highest]]) {
-                ++_highest;
-              }
-            } else {
-              _first[*_highest] = (*_next)[n];
-              _prev->set((*_next)[n], INVALID);
-
-              while (next_bucket != *_highest) {
-                --_highest;
-              }
-
-              if (_highest == _sets.back().begin()) {
-                _sets.back().push_front(bucket_num);
-                _dormant[bucket_num] = false;
-                _first[bucket_num] = _last[bucket_num] = INVALID;
-                ++bucket_num;
-              }
-              --_highest;
-
-              _bucket->set(n, *_highest);
-              _next->set(n, _first[*_highest]);
-              if (_first[*_highest] != INVALID) {
-                _prev->set(_first[*_highest], n);
-              } else {
-                _last[*_highest] = n;
-              }
-              _first[*_highest] = n;
-            }
-          } else {
-
-            deactivate(n);
-            if (!(*_active)[_first[*_highest]]) {
-              ++_highest;
-              if (_highest != _sets.back().end() &&
-                  !(*_active)[_first[*_highest]]) {
-                _highest = _sets.back().end();
-              }
-            }
-          }
-        }
-
-        if ((*_excess)[target] < _min_cut) {
-          _min_cut = (*_excess)[target];
-          for (NodeIt i(_graph); i != INVALID; ++i) {
-            _min_cut_map->set(i, true);
-          }
-          for (std::list<int>::iterator it = _sets.back().begin();
-               it != _sets.back().end(); ++it) {
-            Node n = _first[*it];
-            while (n != INVALID) {
-              _min_cut_map->set(n, false);
-              n = (*_next)[n];
-            }
-          }
-        }
-
-        {
-          Node new_target;
-          if ((*_prev)[target] != INVALID || (*_next)[target] != INVALID) {
-            if ((*_next)[target] == INVALID) {
-              _last[(*_bucket)[target]] = (*_prev)[target];
-              new_target = (*_prev)[target];
-            } else {
-              _prev->set((*_next)[target], (*_prev)[target]);
-              new_target = (*_next)[target];
-            }
-            if ((*_prev)[target] == INVALID) {
-              _first[(*_bucket)[target]] = (*_next)[target];
-            } else {
-              _next->set((*_prev)[target], (*_next)[target]);
-            }
-          } else {
-            _sets.back().pop_back();
-            if (_sets.back().empty()) {
-              _sets.pop_back();
-              if (_sets.empty())
-                break;
-              for (std::list<int>::iterator it = _sets.back().begin();
-                   it != _sets.back().end(); ++it) {
-                _dormant[*it] = false;
-              }
-            }
-            new_target = _last[_sets.back().back()];
-          }
-
-          _bucket->set(target, 0);
-
-          _source_set->set(target, true);
-          for (OutArcIt a(_graph, target); a != INVALID; ++a) {
-            Value rem = (*_capacity)[a] - (*_flow)[a];
-            if (!_tolerance.positive(rem)) continue;
-            Node v = _graph.target(a);
-            if (!(*_active)[v] && !(*_source_set)[v]) {
-              activate(v);
-            }
-            _excess->set(v, (*_excess)[v] + rem);
-            _flow->set(a, (*_capacity)[a]);
-          }
-
-          for (InArcIt a(_graph, target); a != INVALID; ++a) {
-            Value rem = (*_flow)[a];
-            if (!_tolerance.positive(rem)) continue;
-            Node v = _graph.source(a);
-            if (!(*_active)[v] && !(*_source_set)[v]) {
-              activate(v);
-            }
-            _excess->set(v, (*_excess)[v] + rem);
-            _flow->set(a, 0);
-          }
-
-          target = new_target;
-          if ((*_active)[target]) {
-            deactivate(target);
-          }
-
-          _highest = _sets.back().begin();
-          while (_highest != _sets.back().end() &&
-                 !(*_active)[_first[*_highest]]) {
-            ++_highest;
-          }
-        }
-      }
-    }
-
-    void findMinCutIn() {
-
-      for (NodeIt n(_graph); n != INVALID; ++n) {
-        _excess->set(n, 0);
-      }
-
-      for (ArcIt a(_graph); a != INVALID; ++a) {
-        _flow->set(a, 0);
-      }
-
-      int bucket_num = 0;
-      std::vector<Node> queue(_node_num);
-      int qfirst = 0, qlast = 0, qsep = 0;
-
-      {
-        typename Digraph::template NodeMap<bool> reached(_graph, false);
-
-        reached.set(_source, true);
-
-        bool first_set = true;
-
-        for (NodeIt t(_graph); t != INVALID; ++t) {
-          if (reached[t]) continue;
-          _sets.push_front(std::list<int>());
-          
-          queue[qlast++] = t;
-          reached.set(t, true);
-
-          while (qfirst != qlast) {
-            if (qsep == qfirst) {
-              ++bucket_num;
-              _sets.front().push_front(bucket_num);
-              _dormant[bucket_num] = !first_set;
-              _first[bucket_num] = _last[bucket_num] = INVALID;
-              qsep = qlast;
-            }
-
-            Node n = queue[qfirst++];
-            addItem(n, bucket_num);
-
-            for (OutArcIt a(_graph, n); a != INVALID; ++a) {
-              Node u = _graph.target(a);
-              if (!reached[u] && _tolerance.positive((*_capacity)[a])) {
-                reached.set(u, true);
-                queue[qlast++] = u;
-              }
-            }
-          }
-          first_set = false;
-        }
-
-        ++bucket_num;
-        _bucket->set(_source, 0);
-        _dormant[0] = true;
-      }
-      _source_set->set(_source, true);
-
-      Node target = _last[_sets.back().back()];
-      {
-        for (InArcIt a(_graph, _source); a != INVALID; ++a) {
-          if (_tolerance.positive((*_capacity)[a])) {
-            Node u = _graph.source(a);
-            _flow->set(a, (*_capacity)[a]);
-            _excess->set(u, (*_excess)[u] + (*_capacity)[a]);
-            if (!(*_active)[u] && u != _source) {
-              activate(u);
-            }
-          }
-        }
-        if ((*_active)[target]) {
-          deactivate(target);
-        }
-
-        _highest = _sets.back().begin();
-        while (_highest != _sets.back().end() &&
-               !(*_active)[_first[*_highest]]) {
-          ++_highest;
-        }
-      }
-
-
-      while (true) {
-        while (_highest != _sets.back().end()) {
-          Node n = _first[*_highest];
-          Value excess = (*_excess)[n];
-          int next_bucket = _node_num;
-
-          int under_bucket;
-          if (++std::list<int>::iterator(_highest) == _sets.back().end()) {
-            under_bucket = -1;
-          } else {
-            under_bucket = *(++std::list<int>::iterator(_highest));
-          }
-
-          for (InArcIt a(_graph, n); a != INVALID; ++a) {
-            Node v = _graph.source(a);
-            if (_dormant[(*_bucket)[v]]) continue;
-            Value rem = (*_capacity)[a] - (*_flow)[a];
-            if (!_tolerance.positive(rem)) continue;
-            if ((*_bucket)[v] == under_bucket) {
-              if (!(*_active)[v] && v != target) {
-                activate(v);
-              }
-              if (!_tolerance.less(rem, excess)) {
-                _flow->set(a, (*_flow)[a] + excess);
-                _excess->set(v, (*_excess)[v] + excess);
-                excess = 0;
-                goto no_more_push;
-              } else {
-                excess -= rem;
-                _excess->set(v, (*_excess)[v] + rem);
-                _flow->set(a, (*_capacity)[a]);
-              }
-            } else if (next_bucket > (*_bucket)[v]) {
-              next_bucket = (*_bucket)[v];
-            }
-          }
-
-          for (OutArcIt a(_graph, n); a != INVALID; ++a) {
-            Node v = _graph.target(a);
-            if (_dormant[(*_bucket)[v]]) continue;
-            Value rem = (*_flow)[a];
-            if (!_tolerance.positive(rem)) continue;
-            if ((*_bucket)[v] == under_bucket) {
-              if (!(*_active)[v] && v != target) {
-                activate(v);
-              }
-              if (!_tolerance.less(rem, excess)) {
-                _flow->set(a, (*_flow)[a] - excess);
-                _excess->set(v, (*_excess)[v] + excess);
-                excess = 0;
-                goto no_more_push;
-              } else {
-                excess -= rem;
-                _excess->set(v, (*_excess)[v] + rem);
-                _flow->set(a, 0);
-              }
-            } else if (next_bucket > (*_bucket)[v]) {
-              next_bucket = (*_bucket)[v];
-            }
-          }
-
-        no_more_push:
-
-          _excess->set(n, excess);
-
-          if (excess != 0) {
-            if ((*_next)[n] == INVALID) {
-              typename std::list<std::list<int> >::iterator new_set =
-                _sets.insert(--_sets.end(), std::list<int>());
-              new_set->splice(new_set->end(), _sets.back(),
-                              _sets.back().begin(), ++_highest);
-              for (std::list<int>::iterator it = new_set->begin();
-                   it != new_set->end(); ++it) {
-                _dormant[*it] = true;
-              }
-              while (_highest != _sets.back().end() &&
-                     !(*_active)[_first[*_highest]]) {
-                ++_highest;
-              }
-            } else if (next_bucket == _node_num) {
-              _first[(*_bucket)[n]] = (*_next)[n];
-              _prev->set((*_next)[n], INVALID);
-
-              std::list<std::list<int> >::iterator new_set =
-                _sets.insert(--_sets.end(), std::list<int>());
-
-              new_set->push_front(bucket_num);
-              _bucket->set(n, bucket_num);
-              _first[bucket_num] = _last[bucket_num] = n;
-              _next->set(n, INVALID);
-              _prev->set(n, INVALID);
-              _dormant[bucket_num] = true;
-              ++bucket_num;
-
-              while (_highest != _sets.back().end() &&
-                     !(*_active)[_first[*_highest]]) {
-                ++_highest;
-              }
-            } else {
-              _first[*_highest] = (*_next)[n];
-              _prev->set((*_next)[n], INVALID);
-
-              while (next_bucket != *_highest) {
-                --_highest;
-              }
-              if (_highest == _sets.back().begin()) {
-                _sets.back().push_front(bucket_num);
-                _dormant[bucket_num] = false;
-                _first[bucket_num] = _last[bucket_num] = INVALID;
-                ++bucket_num;
-              }
-              --_highest;
-
-              _bucket->set(n, *_highest);
-              _next->set(n, _first[*_highest]);
-              if (_first[*_highest] != INVALID) {
-                _prev->set(_first[*_highest], n);
-              } else {
-                _last[*_highest] = n;
-              }
-              _first[*_highest] = n;
-            }
-          } else {
-
-            deactivate(n);
-            if (!(*_active)[_first[*_highest]]) {
-              ++_highest;
-              if (_highest != _sets.back().end() &&
-                  !(*_active)[_first[*_highest]]) {
-                _highest = _sets.back().end();
-              }
-            }
-          }
-        }
-
-        if ((*_excess)[target] < _min_cut) {
-          _min_cut = (*_excess)[target];
-          for (NodeIt i(_graph); i != INVALID; ++i) {
-            _min_cut_map->set(i, false);
-          }
-          for (std::list<int>::iterator it = _sets.back().begin();
-               it != _sets.back().end(); ++it) {
-            Node n = _first[*it];
-            while (n != INVALID) {
-              _min_cut_map->set(n, true);
-              n = (*_next)[n];
-            }
-          }
-        }
-
-        {
-          Node new_target;
-          if ((*_prev)[target] != INVALID || (*_next)[target] != INVALID) {
-            if ((*_next)[target] == INVALID) {
-              _last[(*_bucket)[target]] = (*_prev)[target];
-              new_target = (*_prev)[target];
-            } else {
-              _prev->set((*_next)[target], (*_prev)[target]);
-              new_target = (*_next)[target];
-            }
-            if ((*_prev)[target] == INVALID) {
-              _first[(*_bucket)[target]] = (*_next)[target];
-            } else {
-              _next->set((*_prev)[target], (*_next)[target]);
-            }
-          } else {
-            _sets.back().pop_back();
-            if (_sets.back().empty()) {
-              _sets.pop_back();
-              if (_sets.empty())
-                break;
-              for (std::list<int>::iterator it = _sets.back().begin();
-                   it != _sets.back().end(); ++it) {
-                _dormant[*it] = false;
-              }
-            }
-            new_target = _last[_sets.back().back()];
-          }
-
-          _bucket->set(target, 0);
-
-          _source_set->set(target, true);
-          for (InArcIt a(_graph, target); a != INVALID; ++a) {
-            Value rem = (*_capacity)[a] - (*_flow)[a];
-            if (!_tolerance.positive(rem)) continue;
-            Node v = _graph.source(a);
-            if (!(*_active)[v] && !(*_source_set)[v]) {
-              activate(v);
-            }
-            _excess->set(v, (*_excess)[v] + rem);
-            _flow->set(a, (*_capacity)[a]);
-          }
-
-          for (OutArcIt a(_graph, target); a != INVALID; ++a) {
-            Value rem = (*_flow)[a];
-            if (!_tolerance.positive(rem)) continue;
-            Node v = _graph.target(a);
-            if (!(*_active)[v] && !(*_source_set)[v]) {
-              activate(v);
-            }
-            _excess->set(v, (*_excess)[v] + rem);
-            _flow->set(a, 0);
-          }
-
-          target = new_target;
-          if ((*_active)[target]) {
-            deactivate(target);
-          }
-
-          _highest = _sets.back().begin();
-          while (_highest != _sets.back().end() &&
-                 !(*_active)[_first[*_highest]]) {
-            ++_highest;
-          }
-        }
-      }
-    }
-
-  public:
-
-    /// \name Execution control
-    /// The simplest way to execute the algorithm is to use
-    /// one of the member functions called \c run(...).
-    /// \n
-    /// If you need more control on the execution,
-    /// first you must call \ref init(), then the \ref calculateIn() or
-    /// \ref calculateOut() functions.
-
-    /// @{
-
-    /// \brief Initializes the internal data structures.
-    ///
-    /// Initializes the internal data structures. It creates
-    /// the maps, residual graph adaptors and some bucket structures
-    /// for the algorithm.
-    void init() {
-      init(NodeIt(_graph));
-    }
-
-    /// \brief Initializes the internal data structures.
-    ///
-    /// Initializes the internal data structures. It creates
-    /// the maps, residual graph adaptor and some bucket structures
-    /// for the algorithm. Node \c source  is used as the push-relabel
-    /// algorithm's source.
-    void init(const Node& source) {
-      _source = source;
-
-      _node_num = countNodes(_graph);
-
-      _first.resize(_node_num);
-      _last.resize(_node_num);
-
-      _dormant.resize(_node_num);
-
-      if (!_flow) {
-        _flow = new FlowMap(_graph);
-      }
-      if (!_next) {
-        _next = new typename Digraph::template NodeMap<Node>(_graph);
-      }
-      if (!_prev) {
-        _prev = new typename Digraph::template NodeMap<Node>(_graph);
-      }
-      if (!_active) {
-        _active = new typename Digraph::template NodeMap<bool>(_graph);
-      }
-      if (!_bucket) {
-        _bucket = new typename Digraph::template NodeMap<int>(_graph);
-      }
-      if (!_excess) {
-        _excess = new ExcessMap(_graph);
-      }
-      if (!_source_set) {
-        _source_set = new SourceSetMap(_graph);
-      }
-      if (!_min_cut_map) {
-        _min_cut_map = new MinCutMap(_graph);
-      }
-
-      _min_cut = std::numeric_limits<Value>::max();
-    }
-
-
-    /// \brief Calculates a minimum cut with \f$ source \f$ on the
-    /// source-side.
-    ///
-    /// Calculates a minimum cut with \f$ source \f$ on the
-    /// source-side (i.e. a set \f$ X\subsetneq V \f$ with
-    /// \f$ source \in X \f$ and minimal out-degree).
-    void calculateOut() {
-      findMinCutOut();
-    }
-
-    /// \brief Calculates a minimum cut with \f$ source \f$ on the
-    /// target-side.
-    ///
-    /// Calculates a minimum cut with \f$ source \f$ on the
-    /// target-side (i.e. a set \f$ X\subsetneq V \f$ with
-    /// \f$ source \in X \f$ and minimal out-degree).
-    void calculateIn() {
-      findMinCutIn();
-    }
-
-
-    /// \brief Runs the algorithm.
-    ///
-    /// Runs the algorithm. It finds nodes \c source and \c target
-    /// arbitrarily and then calls \ref init(), \ref calculateOut()
-    /// and \ref calculateIn().
-    void run() {
-      init();
-      calculateOut();
-      calculateIn();
-    }
-
-    /// \brief Runs the algorithm.
-    ///
-    /// Runs the algorithm. It uses the given \c source node, finds a
-    /// proper \c target and then calls the \ref init(), \ref
-    /// calculateOut() and \ref calculateIn().
-    void run(const Node& s) {
-      init(s);
-      calculateOut();
-      calculateIn();
-    }
-
-    /// @}
-
-    /// \name Query Functions
-    /// The result of the %HaoOrlin algorithm
-    /// can be obtained using these functions.
-    /// \n
-    /// Before using these functions, either \ref run(), \ref
-    /// calculateOut() or \ref calculateIn() must be called.
-
-    /// @{
-
-    /// \brief Returns the value of the minimum value cut.
-    ///
-    /// Returns the value of the minimum value cut.
-    Value minCutValue() const {
-      return _min_cut;
-    }
-
-
-    /// \brief Returns a minimum cut.
-    ///
-    /// Sets \c nodeMap to the characteristic vector of a minimum
-    /// value cut: it will give a nonempty set \f$ X\subsetneq V \f$
-    /// with minimal out-degree (i.e. \c nodeMap will be true exactly
-    /// for the nodes of \f$ X \f$).  \pre nodeMap should be a
-    /// bool-valued node-map.
-    template <typename NodeMap>
-    Value minCutMap(NodeMap& nodeMap) const {
-      for (NodeIt it(_graph); it != INVALID; ++it) {
-        nodeMap.set(it, (*_min_cut_map)[it]);
-      }
-      return _min_cut;
-    }
-
-    /// @}
-
-  }; //class HaoOrlin
-
-
-} //namespace lemon
-
-#endif //LEMON_HAO_ORLIN_H
