Index: Makefile.am
===================================================================
--- Makefile.am	(revision 363)
+++ Makefile.am	(revision 321)
@@ -1,5 +1,3 @@
 ACLOCAL_AMFLAGS = -I m4
-
-AM_CXXFLAGS = $(WARNINGCXXFLAGS)
 
 AM_CPPFLAGS = -I$(top_srcdir) -I$(top_builddir)
Index: configure.ac
===================================================================
--- configure.ac	(revision 363)
+++ configure.ac	(revision 310)
@@ -19,4 +19,6 @@
 AC_CONFIG_SRCDIR([lemon/list_graph.h])
 AC_CONFIG_HEADERS([config.h lemon/config.h])
+
+lx_cmdline_cxxflags_set=${CXXFLAGS+set}
 
 dnl Do compilation tests using the C++ compiler.
@@ -45,8 +47,7 @@
 
 dnl Set custom compiler flags when using g++.
-if test "$GXX" = yes -a "$ICC" = no; then
-  WARNINGCXXFLAGS="-Wall -W -Wall -W -Wunused -Wformat=2 -Wctor-dtor-privacy -Wnon-virtual-dtor -Wno-char-subscripts -Wwrite-strings -Wno-char-subscripts -Wreturn-type -Wcast-qual -Wcast-align -Wsign-promo -Woverloaded-virtual -ansi -fno-strict-aliasing -Wold-style-cast -Wno-unknown-pragmas"
+if test x"$lx_cmdline_cxxflags_set" != x"set" -a "$GXX" = yes -a "$ICC" = no; then
+  CXXFLAGS="$CXXFLAGS -Wall -W -Wall -W -Wunused -Wformat=2 -Wctor-dtor-privacy -Wnon-virtual-dtor -Wno-char-subscripts -Wwrite-strings -Wno-char-subscripts -Wreturn-type -Wcast-qual -Wcast-align -Wsign-promo -Woverloaded-virtual -Woverloaded-virtual -ansi -fno-strict-aliasing -Wold-style-cast -Wno-unknown-pragmas"
 fi
-AC_SUBST([WARNINGCXXFLAGS])
 
 dnl Checks for libraries.
@@ -113,5 +114,5 @@
 echo
 echo C++ compiler.................. : $CXX
-echo C++ compiles flags............ : $WARNINGCXXFLAGS $CXXFLAGS
+echo C++ compiles flags............ : $CXXFLAGS
 echo
 #echo GLPK support.................. : $lx_glpk_found
Index: doc/Doxyfile.in
===================================================================
--- doc/Doxyfile.in	(revision 367)
+++ doc/Doxyfile.in	(revision 316)
@@ -67,5 +67,5 @@
 ENABLED_SECTIONS       = 
 MAX_INITIALIZER_LINES  = 5
-SHOW_USED_FILES        = NO
+SHOW_USED_FILES        = YES
 SHOW_DIRECTORIES       = YES
 SHOW_FILES             = YES
Index: lemon/Makefile.am
===================================================================
--- lemon/Makefile.am	(revision 366)
+++ lemon/Makefile.am	(revision 379)
@@ -13,5 +13,5 @@
         lemon/random.cc
 
-#lemon_libemon_la_CXXFLAGS = $(GLPK_CFLAGS) $(CPLEX_CFLAGS) $(SOPLEX_CXXFLAGS) $(AM_CXXFLAGS)
+#lemon_libemon_la_CXXFLAGS = $(GLPK_CFLAGS) $(CPLEX_CFLAGS) $(SOPLEX_CXXFLAGS)
 #lemon_libemon_la_LDFLAGS = $(GLPK_LIBS) $(CPLEX_LIBS) $(SOPLEX_LIBS)
 
@@ -28,9 +28,9 @@
         lemon/dijkstra.h \
         lemon/dim2.h \
+	lemon/elevator.h \
 	lemon/error.h \
 	lemon/full_graph.h \
         lemon/graph_to_eps.h \
         lemon/grid_graph.h \
-	lemon/hypercube_graph.h \
 	lemon/kruskal.h \
 	lemon/lgf_reader.h \
Index: lemon/bits/alteration_notifier.h
===================================================================
--- lemon/bits/alteration_notifier.h	(revision 361)
+++ lemon/bits/alteration_notifier.h	(revision 314)
@@ -36,60 +36,59 @@
   // a container.
   //
-  // The simple graphs can be refered as two containers: a node container
-  // and an edge container. But they do not store values directly, they
-  // are just key continars for more value containers, which are the
-  // node and edge maps.
-  //
-  // The node and edge sets of the graphs can be changed as we add or erase
+  // The simple graph's can be refered as two containers, one node container
+  // and one edge container. But they are not standard containers they
+  // does not store values directly they are just key continars for more
+  // value containers which are the node and edge maps.
+  //
+  // The graph's node and edge sets can be changed as we add or erase
   // nodes and edges in the graph. LEMON would like to handle easily
   // that the node and edge maps should contain values for all nodes or
   // edges. If we want to check on every indicing if the map contains
   // the current indicing key that cause a drawback in the performance
-  // in the library. We use another solution: we notify all maps about
+  // in the library. We use another solution we notify all maps about
   // an alteration in the graph, which cause only drawback on the
   // alteration of the graph.
   //
-  // This class provides an interface to a node or edge container.
-  // The first() and next() member functions make possible
-  // to iterate on the keys of the container.
-  // The id() function returns an integer id for each key.
-  // The maxId() function gives back an upper bound of the ids.
+  // This class provides an interface to the container. The \e first() and \e
+  // next() member functions make possible to iterate on the keys of the
+  // container. The \e id() function returns an integer id for each key.
+  // The \e maxId() function gives back an upper bound of the ids.
   //
   // For the proper functonality of this class, we should notify it
-  // about each alteration in the container. The alterations have four type:
-  // add(), erase(), build() and clear(). The add() and
-  // erase() signal that only one or few items added or erased to or
-  // from the graph. If all items are erased from the graph or if a new graph
-  // is built from an empty graph, then it can be signaled with the
+  // about each alteration in the container. The alterations have four type
+  // as \e add(), \e erase(), \e build() and \e clear(). The \e add() and
+  // \e erase() signals that only one or few items added or erased to or
+  // from the graph. If all items are erased from the graph or from an empty
+  // graph a new graph is builded then it can be signaled with the
   // clear() and build() members. Important rule that if we erase items
-  // from graphs we should first signal the alteration and after that erase
+  // from graph we should first signal the alteration and after that erase
   // them from the container, on the other way on item addition we should
   // first extend the container and just after that signal the alteration.
   //
   // The alteration can be observed with a class inherited from the
-  // ObserverBase nested class. The signals can be handled with
+  // \e ObserverBase nested class. The signals can be handled with
   // overriding the virtual functions defined in the base class.  The
   // observer base can be attached to the notifier with the
-  // attach() member and can be detached with detach() function. The
+  // \e attach() member and can be detached with detach() function. The
   // alteration handlers should not call any function which signals
   // an other alteration in the same notifier and should not
   // detach any observer from the notifier.
   //
-  // Alteration observers try to be exception safe. If an add() or
-  // a clear() function throws an exception then the remaining
+  // Alteration observers try to be exception safe. If an \e add() or
+  // a \e clear() function throws an exception then the remaining
   // observeres will not be notified and the fulfilled additions will
-  // be rolled back by calling the erase() or clear() functions.
-  // Hence erase() and clear() should not throw exception.
-  // Actullay, they can throw only \ref ImmediateDetach exception,
-  // which detach the observer from the notifier.
-  //
-  // There are some cases, when the alteration observing is not completly
+  // be rolled back by calling the \e erase() or \e clear()
+  // functions. Thence the \e erase() and \e clear() should not throw
+  // exception. Actullay, it can be throw only \ref ImmediateDetach
+  // exception which detach the observer from the notifier.
+  //
+  // There are some place when the alteration observing is not completly
   // reliable. If we want to carry out the node degree in the graph
-  // as in the \ref InDegMap and we use the reverseArc(), then it cause
+  // as in the \ref InDegMap and we use the reverseEdge that cause
   // unreliable functionality. Because the alteration observing signals
-  // only erasing and adding but not the reversing, it will stores bad
-  // degrees. Apart form that the subgraph adaptors cannot even signal
-  // the alterations because just a setting in the filter map can modify
-  // the graph and this cannot be watched in any way.
+  // only erasing and adding but not the reversing it will stores bad
+  // degrees. The sub graph adaptors cannot signal the alterations because
+  // just a setting in the filter map can modify the graph and this cannot
+  // be watched in any way.
   //
   // \param _Container The container which is observed.
@@ -105,11 +104,11 @@
     typedef _Item Item;
 
-    // \brief Exception which can be called from clear() and
-    // erase().
-    //
-    // From the clear() and erase() function only this
+    // \brief Exception which can be called from \e clear() and
+    // \e erase().
+    //
+    // From the \e clear() and \e erase() function only this
     // exception is allowed to throw. The exception immediatly
     // detaches the current observer from the notifier. Because the
-    // clear() and erase() should not throw other exceptions
+    // \e clear() and \e erase() should not throw other exceptions
     // it can be used to invalidate the observer.
     struct ImmediateDetach {};
@@ -123,5 +122,6 @@
     // The observer interface contains some pure virtual functions
     // to override. The add() and erase() functions are
-    // to notify the oberver when one item is added or erased.
+    // to notify the oberver when one item is added or
+    // erased.
     //
     // The build() and clear() members are to notify the observer
Index: lemon/bits/array_map.h
===================================================================
--- lemon/bits/array_map.h	(revision 361)
+++ lemon/bits/array_map.h	(revision 314)
@@ -37,9 +37,10 @@
   // \brief Graph map based on the array storage.
   //
-  // The ArrayMap template class is graph map structure that automatically
-  // updates the map when a key is added to or erased from the graph.
-  // This map uses the allocators to implement the container functionality.
+  // The ArrayMap template class is graph map structure what
+  // automatically updates the map when a key is added to or erased from
+  // the map. This map uses the allocators to implement
+  // the container functionality.
   //
-  // The template parameters are the Graph, the current Item type and
+  // The template parameters are the Graph the current Item type and
   // the Value type of the map.
   template <typename _Graph, typename _Item, typename _Value>
@@ -47,12 +48,12 @@
     : public ItemSetTraits<_Graph, _Item>::ItemNotifier::ObserverBase {
   public:
-    // The graph type.
+    // The graph type of the maps.
     typedef _Graph Graph;
-    // The item type.
+    // The item type of the map.
     typedef _Item Item;
     // The reference map tag.
     typedef True ReferenceMapTag;
 
-    // The key type of the map.
+    // The key type of the maps.
     typedef _Item Key;
     // The value type of the map.
@@ -200,5 +201,5 @@
     // \brief Adds a new key to the map.
     //
-    // It adds a new key to the map. It is called by the observer notifier
+    // It adds a new key to the map. It called by the observer notifier
     // and it overrides the add() member function of the observer base.
     virtual void add(const Key& key) {
@@ -228,5 +229,5 @@
     // \brief Adds more new keys to the map.
     //
-    // It adds more new keys to the map. It is called by the observer notifier
+    // It adds more new keys to the map. It called by the observer notifier
     // and it overrides the add() member function of the observer base.
     virtual void add(const std::vector<Key>& keys) {
@@ -272,5 +273,5 @@
     // \brief Erase a key from the map.
     //
-    // Erase a key from the map. It is called by the observer notifier
+    // Erase a key from the map. It called by the observer notifier
     // and it overrides the erase() member function of the observer base.
     virtual void erase(const Key& key) {
@@ -281,5 +282,5 @@
     // \brief Erase more keys from the map.
     //
-    // Erase more keys from the map. It is called by the observer notifier
+    // Erase more keys from the map. It called by the observer notifier
     // and it overrides the erase() member function of the observer base.
     virtual void erase(const std::vector<Key>& keys) {
@@ -290,7 +291,7 @@
     }
 
-    // \brief Builds the map.
-    //
-    // It builds the map. It is called by the observer notifier
+    // \brief Buildes the map.
+    //
+    // It buildes the map. It called by the observer notifier
     // and it overrides the build() member function of the observer base.
     virtual void build() {
@@ -306,5 +307,5 @@
     // \brief Clear the map.
     //
-    // It erase all items from the map. It is called by the observer notifier
+    // It erase all items from the map. It called by the observer notifier
     // and it overrides the clear() member function of the observer base.
     virtual void clear() {
Index: lemon/bits/base_extender.h
===================================================================
--- lemon/bits/base_extender.h	(revision 361)
+++ lemon/bits/base_extender.h	(revision 314)
@@ -31,5 +31,5 @@
 //\ingroup digraphbits
 //\file
-//\brief Extenders for the graph types
+//\brief Extenders for the digraph types
 namespace lemon {
 
Index: lemon/bits/graph_extender.h
===================================================================
--- lemon/bits/graph_extender.h	(revision 361)
+++ lemon/bits/graph_extender.h	(revision 314)
@@ -30,10 +30,10 @@
 //\ingroup graphbits
 //\file
-//\brief Extenders for the graph types
+//\brief Extenders for the digraph types
 namespace lemon {
 
   // \ingroup graphbits
   //
-  // \brief Extender for the digraph implementations
+  // \brief Extender for the Digraphs
   template <typename Base>
   class DigraphExtender : public Base {
Index: lemon/bits/traits.h
===================================================================
--- lemon/bits/traits.h	(revision 360)
+++ lemon/bits/traits.h	(revision 314)
@@ -219,17 +219,4 @@
 
   template <typename Graph, typename Enable = void>
-  struct ArcNumTagIndicator {
-    static const bool value = false;
-  };
-
-  template <typename Graph>
-  struct ArcNumTagIndicator<
-    Graph,
-    typename enable_if<typename Graph::ArcNumTag, void>::type
-  > {
-    static const bool value = true;
-  };
-
-  template <typename Graph, typename Enable = void>
   struct EdgeNumTagIndicator {
     static const bool value = false;
@@ -245,17 +232,4 @@
 
   template <typename Graph, typename Enable = void>
-  struct FindArcTagIndicator {
-    static const bool value = false;
-  };
-
-  template <typename Graph>
-  struct FindArcTagIndicator<
-    Graph,
-    typename enable_if<typename Graph::FindArcTag, void>::type
-  > {
-    static const bool value = true;
-  };
-
-  template <typename Graph, typename Enable = void>
   struct FindEdgeTagIndicator {
     static const bool value = false;
Index: lemon/bits/vector_map.h
===================================================================
--- lemon/bits/vector_map.h	(revision 361)
+++ lemon/bits/vector_map.h	(revision 314)
@@ -39,7 +39,7 @@
   // \brief Graph map based on the std::vector storage.
   //
-  // The VectorMap template class is graph map structure that automatically
-  // updates the map when a key is added to or erased from the graph.
-  // This map type uses std::vector to store the values.
+  // The VectorMap template class is graph map structure what
+  // automatically updates the map when a key is added to or erased from
+  // the map. This map type uses the std::vector to store the values.
   //
   // \tparam _Graph The graph this map is attached to.
@@ -170,5 +170,5 @@
     // \brief Adds a new key to the map.
     //
-    // It adds a new key to the map. It is called by the observer notifier
+    // It adds a new key to the map. It called by the observer notifier
     // and it overrides the add() member function of the observer base.
     virtual void add(const Key& key) {
@@ -181,5 +181,5 @@
     // \brief Adds more new keys to the map.
     //
-    // It adds more new keys to the map. It is called by the observer notifier
+    // It adds more new keys to the map. It called by the observer notifier
     // and it overrides the add() member function of the observer base.
     virtual void add(const std::vector<Key>& keys) {
@@ -196,5 +196,5 @@
     // \brief Erase a key from the map.
     //
-    // Erase a key from the map. It is called by the observer notifier
+    // Erase a key from the map. It called by the observer notifier
     // and it overrides the erase() member function of the observer base.
     virtual void erase(const Key& key) {
@@ -204,5 +204,5 @@
     // \brief Erase more keys from the map.
     //
-    // It erases more keys from the map. It is called by the observer notifier
+    // Erase more keys from the map. It called by the observer notifier
     // and it overrides the erase() member function of the observer base.
     virtual void erase(const std::vector<Key>& keys) {
@@ -212,7 +212,7 @@
     }
 
-    // \brief Build the map.
-    //
-    // It builds the map. It is called by the observer notifier
+    // \brief Buildes the map.
+    //
+    // It buildes the map. It called by the observer notifier
     // and it overrides the build() member function of the observer base.
     virtual void build() {
@@ -224,5 +224,5 @@
     // \brief Clear the map.
     //
-    // It erases all items from the map. It is called by the observer notifier
+    // It erase all items from the map. It called by the observer notifier
     // and it overrides the clear() member function of the observer base.
     virtual void clear() {
Index: lemon/elevator.h
===================================================================
--- lemon/elevator.h	(revision 379)
+++ lemon/elevator.h	(revision 379)
@@ -0,0 +1,1003 @@
+/* -*- 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_ELEVATOR_H
+#define LEMON_ELEVATOR_H
+
+///\ingroup auxdat
+///\file
+///\brief Elevator class
+///
+///Elevator class implements an efficient data structure
+///for labeling items in push-relabel type algorithms.
+///
+
+#include <test/test_tools.h>
+namespace lemon {
+
+  ///Class for handling "labels" in push-relabel type algorithms.
+
+  ///A class for handling "labels" in push-relabel type algorithms.
+  ///
+  ///\ingroup auxdat
+  ///Using this class you can assign "labels" (nonnegative integer numbers)
+  ///to the edges or nodes of a graph, manipulate and query them through
+  ///operations typically arising in "push-relabel" type algorithms.
+  ///
+  ///Each item is either \em active or not, and you can also choose a
+  ///highest level active item.
+  ///
+  ///\sa LinkedElevator
+  ///
+  ///\param Graph the underlying graph type
+  ///\param Item Type of the items the data is assigned to (Graph::Node,
+  ///Graph::Edge, Graph::UEdge)
+  template<class Graph, class Item>
+  class Elevator
+  {
+  public:
+
+    typedef Item Key;
+    typedef int Value;
+
+  private:
+
+    typedef typename std::vector<Item>::iterator Vit;
+    typedef typename ItemSetTraits<Graph,Item>::template Map<Vit>::Type VitMap;
+    typedef typename ItemSetTraits<Graph,Item>::template Map<int>::Type IntMap;
+
+    const Graph &_g;
+    int _max_level;
+    int _item_num;
+    VitMap _where;
+    IntMap _level;
+    std::vector<Item> _items;
+    std::vector<Vit> _first;
+    std::vector<Vit> _last_active;
+
+    int _highest_active;
+
+    void copy(Item i, Vit p)
+    {
+      _where[*p=i]=p;
+    }
+    void copy(Vit s, Vit p)
+    {
+      if(s!=p)
+        {
+          Item i=*s;
+          *p=i;
+          _where[i]=p;
+        }
+    }
+    void swap(Vit i, Vit j)
+    {
+      Item ti=*i;
+      Vit ct = _where[ti];
+      _where[ti]=_where[*i=*j];
+      _where[*j]=ct;
+      *j=ti;
+    }
+
+  public:
+
+    ///Constructor with given maximum level.
+
+    ///Constructor with given maximum level.
+    ///
+    ///\param g The underlying graph
+    ///\param max_level Set the range of the possible labels to
+    ///[0...\c max_level]
+    Elevator(const Graph &g,int max_level) :
+      _g(g),
+      _max_level(max_level),
+      _item_num(_max_level),
+      _where(g),
+      _level(g,0),
+      _items(_max_level),
+      _first(_max_level+2),
+      _last_active(_max_level+2),
+      _highest_active(-1) {}
+    ///Constructor.
+
+    ///Constructor.
+    ///
+    ///\param g The underlying graph
+    ///The range of the possible labels is [0...\c max_level],
+    ///where \c max_level is equal to the number of labeled items in the graph.
+    Elevator(const Graph &g) :
+      _g(g),
+      _max_level(countItems<Graph, Item>(g)),
+      _item_num(_max_level),
+      _where(g),
+      _level(g,0),
+      _items(_max_level),
+      _first(_max_level+2),
+      _last_active(_max_level+2),
+      _highest_active(-1)
+    {
+    }
+
+    ///Activate item \c i.
+
+    ///Activate item \c i.
+    ///\pre Item \c i shouldn't be active before.
+    void activate(Item i)
+    {
+      const int l=_level[i];
+      swap(_where[i],++_last_active[l]);
+      if(l>_highest_active) _highest_active=l;
+    }
+
+    ///Deactivate item \c i.
+
+    ///Deactivate item \c i.
+    ///\pre Item \c i must be active before.
+    void deactivate(Item i)
+    {
+      swap(_where[i],_last_active[_level[i]]--);
+      while(_highest_active>=0 &&
+            _last_active[_highest_active]<_first[_highest_active])
+        _highest_active--;
+    }
+
+    ///Query whether item \c i is active
+    bool active(Item i) const { return _where[i]<=_last_active[_level[i]]; }
+
+    ///Return the level of item \c i.
+    int operator[](Item i) const { return _level[i]; }
+
+    ///Return the number of items on level \c l.
+    int onLevel(int l) const
+    {
+      return _first[l+1]-_first[l];
+    }
+    ///Return true if the level is empty.
+    bool emptyLevel(int l) const
+    {
+      return _first[l+1]-_first[l]==0;
+    }
+    ///Return the number of items above level \c l.
+    int aboveLevel(int l) const
+    {
+      return _first[_max_level+1]-_first[l+1];
+    }
+    ///Return the number of active items on level \c l.
+    int activesOnLevel(int l) const
+    {
+      return _last_active[l]-_first[l]+1;
+    }
+    ///Return true if there is not active item on level \c l.
+    bool activeFree(int l) const
+    {
+      return _last_active[l]<_first[l];
+    }
+    ///Return the maximum allowed level.
+    int maxLevel() const
+    {
+      return _max_level;
+    }
+
+    ///\name Highest Active Item
+    ///Functions for working with the highest level
+    ///active item.
+
+    ///@{
+
+    ///Return a highest level active item.
+
+    ///Return a highest level active item.
+    ///
+    ///\return the highest level active item or INVALID if there is no active
+    ///item.
+    Item highestActive() const
+    {
+      return _highest_active>=0?*_last_active[_highest_active]:INVALID;
+    }
+
+    ///Return a highest active level.
+
+    ///Return a highest active level.
+    ///
+    ///\return the level of the highest active item or -1 if there is no active
+    ///item.
+    int highestActiveLevel() const
+    {
+      return _highest_active;
+    }
+
+    ///Lift the highest active item by one.
+
+    ///Lift the item returned by highestActive() by one.
+    ///
+    void liftHighestActive()
+    {
+      ++_level[*_last_active[_highest_active]];
+      swap(_last_active[_highest_active]--,_last_active[_highest_active+1]);
+      --_first[++_highest_active];
+    }
+
+    ///Lift the highest active item.
+
+    ///Lift the item returned by highestActive() to level \c new_level.
+    ///
+    ///\warning \c new_level must be strictly higher
+    ///than the current level.
+    ///
+    void liftHighestActive(int new_level)
+    {
+      const Item li = *_last_active[_highest_active];
+
+      copy(--_first[_highest_active+1],_last_active[_highest_active]--);
+      for(int l=_highest_active+1;l<new_level;l++)
+        {
+          copy(--_first[l+1],_first[l]);
+          --_last_active[l];
+        }
+      copy(li,_first[new_level]);
+      _level[li]=new_level;
+      _highest_active=new_level;
+    }
+
+    ///Lift the highest active item.
+
+    ///Lift the item returned by highestActive() to the top level and
+    ///deactivates it.
+    ///
+    ///\warning \c new_level must be strictly higher
+    ///than the current level.
+    ///
+    void liftHighestActiveToTop()
+    {
+      const Item li = *_last_active[_highest_active];
+
+      copy(--_first[_highest_active+1],_last_active[_highest_active]--);
+      for(int l=_highest_active+1;l<_max_level;l++)
+        {
+          copy(--_first[l+1],_first[l]);
+          --_last_active[l];
+        }
+      copy(li,_first[_max_level]);
+      --_last_active[_max_level];
+      _level[li]=_max_level;
+
+      while(_highest_active>=0 &&
+            _last_active[_highest_active]<_first[_highest_active])
+        _highest_active--;
+    }
+
+    ///@}
+
+    ///\name Active Item on Certain Level
+    ///Functions for working with the active items.
+
+    ///@{
+
+    ///Returns an active item on level \c l.
+
+    ///Returns an active item on level \c l.
+    ///
+    ///Returns an active item on level \c l or \ref INVALID if there is no such
+    ///an item. (\c l must be from the range [0...\c max_level].
+    Item activeOn(int l) const
+    {
+      return _last_active[l]>=_first[l]?*_last_active[l]:INVALID;
+    }
+
+    ///Lifts the active item returned by \c activeOn() member function.
+
+    ///Lifts the active item returned by \c activeOn() member function
+    ///by one.
+    Item liftActiveOn(int level)
+    {
+      ++_level[*_last_active[level]];
+      swap(_last_active[level]--, --_first[level+1]);
+      if (level+1>_highest_active) ++_highest_active;
+    }
+
+    ///Lifts the active item returned by \c activeOn() member function.
+
+    ///Lifts the active item returned by \c activeOn() member function
+    ///to the given level.
+    void liftActiveOn(int level, int new_level)
+    {
+      const Item ai = *_last_active[level];
+
+      copy(--_first[level+1], _last_active[level]--);
+      for(int l=level+1;l<new_level;l++)
+        {
+          copy(_last_active[l],_first[l]);
+          copy(--_first[l+1], _last_active[l]--);
+        }
+      copy(ai,_first[new_level]);
+      _level[ai]=new_level;
+      if (new_level>_highest_active) _highest_active=new_level;
+    }
+
+    ///Lifts the active item returned by \c activeOn() member function.
+
+    ///Lifts the active item returned by \c activeOn() member function
+    ///to the top level.
+    void liftActiveToTop(int level)
+    {
+      const Item ai = *_last_active[level];
+
+      copy(--_first[level+1],_last_active[level]--);
+      for(int l=level+1;l<_max_level;l++)
+        {
+          copy(_last_active[l],_first[l]);
+          copy(--_first[l+1], _last_active[l]--);
+        }
+      copy(ai,_first[_max_level]);
+      --_last_active[_max_level];
+      _level[ai]=_max_level;
+
+      if (_highest_active==level) {
+        while(_highest_active>=0 &&
+              _last_active[_highest_active]<_first[_highest_active])
+          _highest_active--;
+      }
+    }
+
+    ///@}
+
+    ///Lift an active item to a higher level.
+
+    ///Lift an active item to a higher level.
+    ///\param i The item to be lifted. It must be active.
+    ///\param new_level The new level of \c i. It must be strictly higher
+    ///than the current level.
+    ///
+    void lift(Item i, int new_level)
+    {
+      const int lo = _level[i];
+      const Vit w = _where[i];
+
+      copy(_last_active[lo],w);
+      copy(--_first[lo+1],_last_active[lo]--);
+      for(int l=lo+1;l<new_level;l++)
+        {
+          copy(_last_active[l],_first[l]);
+          copy(--_first[l+1],_last_active[l]--);
+        }
+      copy(i,_first[new_level]);
+      _level[i]=new_level;
+      if(new_level>_highest_active) _highest_active=new_level;
+    }
+
+    ///Mark the node as it did not reach the max level
+
+    ///Mark the node as it did not reach the max level. It sets the
+    ///level to the under the max level value. The node will be never
+    ///more activated because the push operation from the maximum
+    ///level is forbidden in the push-relabel algorithms. The node
+    ///should be lifted previously to the top level.
+    void markToBottom(Item i) {
+      _level[i] = _max_level - 1;
+    }
+
+    ///Lift all nodes on and above a level to the top (and deactivate them).
+
+    ///This function lifts all nodes on and above level \c l to \c
+    ///maxLevel(), and also deactivates them.
+    void liftToTop(int l)
+    {
+      const Vit f=_first[l];
+      const Vit tl=_first[_max_level];
+      for(Vit i=f;i!=tl;++i)
+        _level[*i]=_max_level;
+      for(int i=l;i<=_max_level;i++)
+        {
+          _first[i]=f;
+          _last_active[i]=f-1;
+        }
+      for(_highest_active=l-1;
+          _highest_active>=0 &&
+            _last_active[_highest_active]<_first[_highest_active];
+          _highest_active--) ;
+    }
+
+  private:
+    int _init_lev;
+    Vit _init_num;
+
+  public:
+
+    ///\name Initialization
+    ///Using this function you can initialize the levels of the item.
+    ///\n
+    ///This initializatios is started with calling \c initStart().
+    ///Then the
+    ///items should be listed levels by levels statring with the lowest one
+    ///(with level 0). This is done by using \c initAddItem()
+    ///and \c initNewLevel(). Finally \c initFinish() must be called.
+    ///The items not listed will be put on the highest level.
+    ///@{
+
+    ///Start the initialization process.
+
+    void initStart()
+    {
+      _init_lev=0;
+      _init_num=_items.begin();
+      _first[0]=_items.begin();
+      _last_active[0]=_items.begin()-1;
+      Vit n=_items.begin();
+      for(typename ItemSetTraits<Graph,Item>::ItemIt i(_g);i!=INVALID;++i)
+        {
+          *n=i;
+          _where[i]=n;
+          _level[i]=_max_level;
+          ++n;
+        }
+    }
+
+    ///Add an item to the current level.
+
+    void initAddItem(Item i)
+    {
+     swap(_where[i],_init_num);
+      _level[i]=_init_lev;
+      ++_init_num;
+    }
+
+    ///Start a new level.
+
+    ///Start a new level.
+    ///It shouldn't be used before the items on level 0 are listed.
+    void initNewLevel()
+    {
+      _init_lev++;
+      _first[_init_lev]=_init_num;
+      _last_active[_init_lev]=_init_num-1;
+    }
+
+    ///Finalize the initialization process.
+
+    void initFinish()
+    {
+      for(_init_lev++;_init_lev<=_max_level;_init_lev++)
+        {
+          _first[_init_lev]=_init_num;
+          _last_active[_init_lev]=_init_num-1;
+        }
+      _first[_max_level+1]=_items.begin()+_item_num;
+      _last_active[_max_level+1]=_items.begin()+_item_num-1;
+      _highest_active = -1;
+    }
+
+    ///@}
+
+  };
+
+  ///Class for handling "labels" in push-relabel type algorithms.
+
+  ///A class for handling "labels" in push-relabel type algorithms.
+  ///
+  ///\ingroup auxdat
+  ///Using this class you can assign "labels" (nonnegative integer numbers)
+  ///to the edges or nodes of a graph, manipulate and query them through
+  ///operations typically arising in "push-relabel" type algorithms.
+  ///
+  ///Each item is either \em active or not, and you can also choose a
+  ///highest level active item.
+  ///
+  ///\sa Elevator
+  ///
+  ///\param Graph the underlying graph type
+  ///\param Item Type of the items the data is assigned to (Graph::Node,
+  ///Graph::Edge, Graph::UEdge)
+  template <class Graph, class Item>
+  class LinkedElevator {
+  public:
+
+    typedef Item Key;
+    typedef int Value;
+
+  private:
+
+    typedef typename ItemSetTraits<Graph,Item>::
+    template Map<Item>::Type ItemMap;
+    typedef typename ItemSetTraits<Graph,Item>::
+    template Map<int>::Type IntMap;
+    typedef typename ItemSetTraits<Graph,Item>::
+    template Map<bool>::Type BoolMap;
+
+    const Graph &_graph;
+    int _max_level;
+    int _item_num;
+    std::vector<Item> _first, _last;
+    ItemMap _prev, _next;
+    int _highest_active;
+    IntMap _level;
+    BoolMap _active;
+
+  public:
+    ///Constructor with given maximum level.
+
+    ///Constructor with given maximum level.
+    ///
+    ///\param g The underlying graph
+    ///\param max_level Set the range of the possible labels to
+    ///[0...\c max_level]
+    LinkedElevator(const Graph& graph, int max_level)
+      : _graph(graph), _max_level(max_level), _item_num(_max_level),
+        _first(_max_level + 1), _last(_max_level + 1),
+        _prev(graph), _next(graph),
+        _highest_active(-1), _level(graph), _active(graph) {}
+
+    ///Constructor.
+
+    ///Constructor.
+    ///
+    ///\param g The underlying graph
+    ///The range of the possible labels is [0...\c max_level],
+    ///where \c max_level is equal to the number of labeled items in the graph.
+    LinkedElevator(const Graph& graph)
+      : _graph(graph), _max_level(countItems<Graph, Item>(graph)),
+        _item_num(_max_level),
+        _first(_max_level + 1), _last(_max_level + 1),
+        _prev(graph, INVALID), _next(graph, INVALID),
+        _highest_active(-1), _level(graph), _active(graph) {}
+
+
+    ///Activate item \c i.
+
+    ///Activate item \c i.
+    ///\pre Item \c i shouldn't be active before.
+    void activate(Item i) {
+      _active.set(i, true);
+
+      int level = _level[i];
+      if (level > _highest_active) {
+        _highest_active = level;
+      }
+
+      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[level] = _prev[i];
+      }
+      //lace
+      _next.set(i, _first[level]);
+      _prev.set(_first[level], i);
+      _prev.set(i, INVALID);
+      _first[level] = i;
+
+    }
+
+    ///Deactivate item \c i.
+
+    ///Deactivate item \c i.
+    ///\pre Item \c i must be active before.
+    void deactivate(Item i) {
+      _active.set(i, false);
+      int level = _level[i];
+
+      if (_next[i] == INVALID || !_active[_next[i]])
+        goto find_highest_level;
+
+      //unlace
+      _prev.set(_next[i], _prev[i]);
+      if (_prev[i] != INVALID) {
+        _next.set(_prev[i], _next[i]);
+      } else {
+        _first[_level[i]] = _next[i];
+      }
+      //lace
+      _prev.set(i, _last[level]);
+      _next.set(_last[level], i);
+      _next.set(i, INVALID);
+      _last[level] = i;
+
+    find_highest_level:
+      if (level == _highest_active) {
+        while (_highest_active >= 0 && activeFree(_highest_active))
+          --_highest_active;
+      }
+    }
+
+    ///Query whether item \c i is active
+    bool active(Item i) const { return _active[i]; }
+
+    ///Return the level of item \c i.
+    int operator[](Item i) const { return _level[i]; }
+
+    ///Return the number of items on level \c l.
+    int onLevel(int l) const {
+      int num = 0;
+      Item n = _first[l];
+      while (n != INVALID) {
+        ++num;
+        n = _next[n];
+      }
+      return num;
+    }
+
+    ///Return true if the level is empty.
+    bool emptyLevel(int l) const {
+      return _first[l] == INVALID;
+    }
+
+    ///Return the number of items above level \c l.
+    int aboveLevel(int l) const {
+      int num = 0;
+      for (int level = l + 1; level < _max_level; ++level)
+        num += onLevel(level);
+      return num;
+    }
+
+    ///Return the number of active items on level \c l.
+    int activesOnLevel(int l) const {
+      int num = 0;
+      Item n = _first[l];
+      while (n != INVALID && _active[n]) {
+        ++num;
+        n = _next[n];
+      }
+      return num;
+    }
+
+    ///Return true if there is not active item on level \c l.
+    bool activeFree(int l) const {
+      return _first[l] == INVALID || !_active[_first[l]];
+    }
+
+    ///Return the maximum allowed level.
+    int maxLevel() const {
+      return _max_level;
+    }
+
+    ///\name Highest Active Item
+    ///Functions for working with the highest level
+    ///active item.
+
+    ///@{
+
+    ///Return a highest level active item.
+
+    ///Return a highest level active item.
+    ///
+    ///\return the highest level active item or INVALID if there is no
+    ///active item.
+    Item highestActive() const {
+      return _highest_active >= 0 ? _first[_highest_active] : INVALID;
+    }
+
+    ///Return a highest active level.
+
+    ///Return a highest active level.
+    ///
+    ///\return the level of the highest active item or -1 if there is
+    ///no active item.
+    int highestActiveLevel() const {
+      return _highest_active;
+    }
+
+    ///Lift the highest active item by one.
+
+    ///Lift the item returned by highestActive() by one.
+    ///
+    void liftHighestActive() {
+      Item i = _first[_highest_active];
+      if (_next[i] != INVALID) {
+        _prev.set(_next[i], INVALID);
+        _first[_highest_active] = _next[i];
+      } else {
+        _first[_highest_active] = INVALID;
+        _last[_highest_active] = INVALID;
+      }
+      _level.set(i, ++_highest_active);
+      if (_first[_highest_active] == INVALID) {
+        _first[_highest_active] = i;
+        _last[_highest_active] = i;
+        _prev.set(i, INVALID);
+        _next.set(i, INVALID);
+      } else {
+        _prev.set(_first[_highest_active], i);
+        _next.set(i, _first[_highest_active]);
+        _first[_highest_active] = i;
+      }
+    }
+
+    ///Lift the highest active item.
+
+    ///Lift the item returned by highestActive() to level \c new_level.
+    ///
+    ///\warning \c new_level must be strictly higher
+    ///than the current level.
+    ///
+    void liftHighestActive(int new_level) {
+      Item i = _first[_highest_active];
+      if (_next[i] != INVALID) {
+        _prev.set(_next[i], INVALID);
+        _first[_highest_active] = _next[i];
+      } else {
+        _first[_highest_active] = INVALID;
+        _last[_highest_active] = INVALID;
+      }
+      _level.set(i, _highest_active = new_level);
+      if (_first[_highest_active] == INVALID) {
+        _first[_highest_active] = _last[_highest_active] = i;
+        _prev.set(i, INVALID);
+        _next.set(i, INVALID);
+      } else {
+        _prev.set(_first[_highest_active], i);
+        _next.set(i, _first[_highest_active]);
+        _first[_highest_active] = i;
+      }
+    }
+
+    ///Lift the highest active to top.
+
+    ///Lift the item returned by highestActive() to the top level and
+    ///deactivates the node.
+    ///
+    void liftHighestActiveToTop() {
+      Item i = _first[_highest_active];
+      _level.set(i, _max_level);
+      if (_next[i] != INVALID) {
+        _prev.set(_next[i], INVALID);
+        _first[_highest_active] = _next[i];
+      } else {
+        _first[_highest_active] = INVALID;
+        _last[_highest_active] = INVALID;
+      }
+      while (_highest_active >= 0 && activeFree(_highest_active))
+        --_highest_active;
+    }
+
+    ///@}
+
+    ///\name Active Item on Certain Level
+    ///Functions for working with the active items.
+
+    ///@{
+
+    ///Returns an active item on level \c l.
+
+    ///Returns an active item on level \c l.
+    ///
+    ///Returns an active item on level \c l or \ref INVALID if there is no such
+    ///an item. (\c l must be from the range [0...\c max_level].
+    Item activeOn(int l) const
+    {
+      return _active[_first[l]] ? _first[l] : INVALID;
+    }
+
+    ///Lifts the active item returned by \c activeOn() member function.
+
+    ///Lifts the active item returned by \c activeOn() member function
+    ///by one.
+    Item liftActiveOn(int l)
+    {
+      Item i = _first[l];
+      if (_next[i] != INVALID) {
+        _prev.set(_next[i], INVALID);
+        _first[l] = _next[i];
+      } else {
+        _first[l] = INVALID;
+        _last[l] = INVALID;
+      }
+      _level.set(i, ++l);
+      if (_first[l] == INVALID) {
+        _first[l] = _last[l] = i;
+        _prev.set(i, INVALID);
+        _next.set(i, INVALID);
+      } else {
+        _prev.set(_first[l], i);
+        _next.set(i, _first[l]);
+        _first[l] = i;
+      }
+      if (_highest_active < l) {
+        _highest_active = l;
+      }
+    }
+
+    /// \brief Lifts the active item returned by \c activeOn() member function.
+    ///
+    /// Lifts the active item returned by \c activeOn() member function
+    /// to the given level.
+    void liftActiveOn(int l, int new_level)
+    {
+      Item i = _first[l];
+      if (_next[i] != INVALID) {
+        _prev.set(_next[i], INVALID);
+        _first[l] = _next[i];
+      } else {
+        _first[l] = INVALID;
+        _last[l] = INVALID;
+      }
+      _level.set(i, l = new_level);
+      if (_first[l] == INVALID) {
+        _first[l] = _last[l] = i;
+        _prev.set(i, INVALID);
+        _next.set(i, INVALID);
+      } else {
+        _prev.set(_first[l], i);
+        _next.set(i, _first[l]);
+        _first[l] = i;
+      }
+      if (_highest_active < l) {
+        _highest_active = l;
+      }
+    }
+
+    ///Lifts the active item returned by \c activeOn() member function.
+
+    ///Lifts the active item returned by \c activeOn() member function
+    ///to the top level.
+    void liftActiveToTop(int l)
+    {
+      Item i = _first[l];
+      if (_next[i] != INVALID) {
+        _prev.set(_next[i], INVALID);
+        _first[l] = _next[i];
+      } else {
+        _first[l] = INVALID;
+        _last[l] = INVALID;
+      }
+      _level.set(i, _max_level);
+      if (l == _highest_active) {
+        while (_highest_active >= 0 && activeFree(_highest_active))
+          --_highest_active;
+      }
+    }
+
+    ///@}
+
+    /// \brief Lift an active item to a higher level.
+    ///
+    /// Lift an active item to a higher level.
+    /// \param i The item to be lifted. It must be active.
+    /// \param new_level The new level of \c i. It must be strictly higher
+    /// than the current level.
+    ///
+    void lift(Item i, int new_level) {
+      if (_next[i] != INVALID) {
+        _prev.set(_next[i], _prev[i]);
+      } else {
+        _last[new_level] = _prev[i];
+      }
+      if (_prev[i] != INVALID) {
+        _next.set(_prev[i], _next[i]);
+      } else {
+        _first[new_level] = _next[i];
+      }
+      _level.set(i, new_level);
+      if (_first[new_level] == INVALID) {
+        _first[new_level] = _last[new_level] = i;
+        _prev.set(i, INVALID);
+        _next.set(i, INVALID);
+      } else {
+        _prev.set(_first[new_level], i);
+        _next.set(i, _first[new_level]);
+        _first[new_level] = i;
+      }
+      if (_highest_active < new_level) {
+        _highest_active = new_level;
+      }
+    }
+
+    ///Mark the node as it did not reach the max level
+
+    ///Mark the node as it did not reach the max level. It sets the
+    ///level to the under the max level value. The node will be never
+    ///more activated because the push operation from the maximum
+    ///level is forbidden in the push-relabel algorithms. The node
+    ///should be lifted previously to the top level.
+    void markToBottom(Item i) {
+      _level.set(i, _max_level - 1);
+    }
+
+    ///Lift all nodes on and above a level to the top (and deactivate them).
+
+    ///This function lifts all nodes on and above level \c l to \c
+    ///maxLevel(), and also deactivates them.
+    void liftToTop(int l)  {
+      for (int i = l + 1; _first[i] != INVALID; ++i) {
+        Item n = _first[i];
+        while (n != INVALID) {
+          _level.set(n, _max_level);
+          n = _next[n];
+        }
+        _first[i] = INVALID;
+        _last[i] = INVALID;
+      }
+      if (_highest_active > l - 1) {
+        _highest_active = l - 1;
+        while (_highest_active >= 0 && activeFree(_highest_active))
+          --_highest_active;
+      }
+    }
+
+  private:
+
+    int _init_level;
+
+  public:
+
+    ///\name Initialization
+    ///Using this function you can initialize the levels of the item.
+    ///\n
+    ///This initializatios is started with calling \c initStart().
+    ///Then the
+    ///items should be listed levels by levels statring with the lowest one
+    ///(with level 0). This is done by using \c initAddItem()
+    ///and \c initNewLevel(). Finally \c initFinish() must be called.
+    ///The items not listed will be put on the highest level.
+    ///@{
+
+    ///Start the initialization process.
+
+    void initStart() {
+
+      for (int i = 0; i <= _max_level; ++i) {
+        _first[i] = _last[i] = INVALID;
+      }
+      _init_level = 0;
+      for(typename ItemSetTraits<Graph,Item>::ItemIt i(_graph);
+          i != INVALID; ++i) {
+        _level.set(i, _max_level);
+        _active.set(i, false);
+      }
+    }
+
+    ///Add an item to the current level.
+
+    void initAddItem(Item i) {
+      _level.set(i, _init_level);
+      if (_last[_init_level] == INVALID) {
+        _first[_init_level] = i;
+        _last[_init_level] = i;
+        _prev.set(i, INVALID);
+        _next.set(i, INVALID);
+      } else {
+        _prev.set(i, _last[_init_level]);
+        _next.set(i, INVALID);
+        _next.set(_last[_init_level], i);
+        _last[_init_level] = i;
+      }
+    }
+
+    ///Start a new level.
+
+    ///Start a new level.
+    ///It shouldn't be used before the items on level 0 are listed.
+    void initNewLevel() {
+      ++_init_level;
+    }
+
+    ///Finalize the initialization process.
+
+    void initFinish() {
+      _highest_active = -1;
+    }
+
+    ///@}
+
+  };
+
+
+} //END OF NAMESPACE LEMON
+
+#endif
+
Index: lemon/full_graph.h
===================================================================
--- lemon/full_graph.h	(revision 360)
+++ lemon/full_graph.h	(revision 355)
@@ -307,5 +307,4 @@
 
     typedef True NodeNumTag;
-    typedef True ArcNumTag;
     typedef True EdgeNumTag;
 
@@ -345,5 +344,4 @@
 
     typedef True FindEdgeTag;
-    typedef True FindArcTag;
 
     Edge findEdge(Node u, Node v, Edge prev = INVALID) const {
Index: lemon/grid_graph.h
===================================================================
--- lemon/grid_graph.h	(revision 360)
+++ lemon/grid_graph.h	(revision 338)
@@ -83,5 +83,4 @@
 
     typedef True NodeNumTag;
-    typedef True EdgeNumTag;
     typedef True ArcNumTag;
 
@@ -129,5 +128,4 @@
 
     typedef True FindEdgeTag;
-    typedef True FindArcTag;
 
     Edge findEdge(Node u, Node v, Edge prev = INVALID) const {
Index: mon/hypercube_graph.h
===================================================================
--- lemon/hypercube_graph.h	(revision 372)
+++ 	(revision )
@@ -1,440 +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 HYPERCUBE_GRAPH_H
-#define HYPERCUBE_GRAPH_H
-
-#include <vector>
-#include <lemon/core.h>
-#include <lemon/assert.h>
-#include <lemon/bits/graph_extender.h>
-
-///\ingroup graphs
-///\file
-///\brief HypercubeGraph class.
-
-namespace lemon {
-
-  class HypercubeGraphBase {
-
-  public:
-
-    typedef HypercubeGraphBase Graph;
-
-    class Node;
-    class Edge;
-    class Arc;
-
-  public:
-
-    HypercubeGraphBase() {}
-
-  protected:
-
-    void construct(int dim) {
-      LEMON_ASSERT(dim >= 1, "The number of dimensions must be at least 1.");
-      _dim = dim;
-      _node_num = 1 << dim;
-      _edge_num = dim * (1 << (dim-1));
-    }
-
-  public:
-
-    typedef True NodeNumTag;
-    typedef True EdgeNumTag;
-    typedef True ArcNumTag;
-
-    int nodeNum() const { return _node_num; }
-    int edgeNum() const { return _edge_num; }
-    int arcNum() const { return 2 * _edge_num; }
-
-    int maxNodeId() const { return _node_num - 1; }
-    int maxEdgeId() const { return _edge_num - 1; }
-    int maxArcId() const { return 2 * _edge_num - 1; }
-
-    static Node nodeFromId(int id) { return Node(id); }
-    static Edge edgeFromId(int id) { return Edge(id); }
-    static Arc arcFromId(int id) { return Arc(id); }
-
-    static int id(Node node) { return node._id; }
-    static int id(Edge edge) { return edge._id; }
-    static int id(Arc arc) { return arc._id; }
-
-    Node u(Edge edge) const {
-      int base = edge._id & ((1 << (_dim-1)) - 1);
-      int k = edge._id >> (_dim-1);
-      return ((base >> k) << (k+1)) | (base & ((1 << k) - 1));
-    }
-
-    Node v(Edge edge) const {
-      int base = edge._id & ((1 << (_dim-1)) - 1);
-      int k = edge._id >> (_dim-1);
-      return ((base >> k) << (k+1)) | (base & ((1 << k) - 1)) | (1 << k);
-    }
-
-    Node source(Arc arc) const {
-      return (arc._id & 1) == 1 ? u(arc) : v(arc);
-    }
-
-    Node target(Arc arc) const {
-      return (arc._id & 1) == 1 ? v(arc) : u(arc);
-    }
-
-    typedef True FindEdgeTag;
-    typedef True FindArcTag;
-
-    Edge findEdge(Node u, Node v, Edge prev = INVALID) const {
-      if (prev != INVALID) return INVALID;
-      int d = u._id ^ v._id;
-      int k = 0;
-      if (d == 0) return INVALID;
-      for ( ; (d & 1) == 0; d >>= 1) ++k;
-      if (d >> 1 != 0) return INVALID;
-      return (k << (_dim-1)) | ((u._id >> (k+1)) << k) |
-        (u._id & ((1 << k) - 1));
-    }
-
-    Arc findArc(Node u, Node v, Arc prev = INVALID) const {
-      Edge edge = findEdge(u, v, prev);
-      if (edge == INVALID) return INVALID;
-      int k = edge._id >> (_dim-1);
-      return ((u._id >> k) & 1) == 1 ? edge._id << 1 : (edge._id << 1) | 1;
-    }
-
-    class Node {
-      friend class HypercubeGraphBase;
-
-    protected:
-      int _id;
-      Node(int id) : _id(id) {}
-    public:
-      Node() {}
-      Node (Invalid) : _id(-1) {}
-      bool operator==(const Node node) const {return _id == node._id;}
-      bool operator!=(const Node node) const {return _id != node._id;}
-      bool operator<(const Node node) const {return _id < node._id;}
-    };
-
-    class Edge {
-      friend class HypercubeGraphBase;
-      friend class Arc;
-
-    protected:
-      int _id;
-
-      Edge(int id) : _id(id) {}
-
-    public:
-      Edge() {}
-      Edge (Invalid) : _id(-1) {}
-      bool operator==(const Edge edge) const {return _id == edge._id;}
-      bool operator!=(const Edge edge) const {return _id != edge._id;}
-      bool operator<(const Edge edge) const {return _id < edge._id;}
-    };
-
-    class Arc {
-      friend class HypercubeGraphBase;
-
-    protected:
-      int _id;
-
-      Arc(int id) : _id(id) {}
-
-    public:
-      Arc() {}
-      Arc (Invalid) : _id(-1) {}
-      operator Edge() const { return _id != -1 ? Edge(_id >> 1) : INVALID; }
-      bool operator==(const Arc arc) const {return _id == arc._id;}
-      bool operator!=(const Arc arc) const {return _id != arc._id;}
-      bool operator<(const Arc arc) const {return _id < arc._id;}
-    };
-
-    void first(Node& node) const {
-      node._id = _node_num - 1;
-    }
-
-    static void next(Node& node) {
-      --node._id;
-    }
-
-    void first(Edge& edge) const {
-      edge._id = _edge_num - 1;
-    }
-
-    static void next(Edge& edge) {
-      --edge._id;
-    }
-
-    void first(Arc& arc) const {
-      arc._id = 2 * _edge_num - 1;
-    }
-
-    static void next(Arc& arc) {
-      --arc._id;
-    }
-
-    void firstInc(Edge& edge, bool& dir, const Node& node) const {
-      edge._id = node._id >> 1;
-      dir = (node._id & 1) == 0;
-    }
-
-    void nextInc(Edge& edge, bool& dir) const {
-      Node n = dir ? u(edge) : v(edge);
-      int k = (edge._id >> (_dim-1)) + 1;
-      if (k < _dim) {
-        edge._id = (k << (_dim-1)) |
-          ((n._id >> (k+1)) << k) | (n._id & ((1 << k) - 1));
-        dir = ((n._id >> k) & 1) == 0;
-      } else {
-        edge._id = -1;
-        dir = true;
-      }
-    }
-
-    void firstOut(Arc& arc, const Node& node) const {
-      arc._id = ((node._id >> 1) << 1) | (~node._id & 1);
-    }
-
-    void nextOut(Arc& arc) const {
-      Node n = (arc._id & 1) == 1 ? u(arc) : v(arc);
-      int k = (arc._id >> _dim) + 1;
-      if (k < _dim) {
-        arc._id = (k << (_dim-1)) |
-          ((n._id >> (k+1)) << k) | (n._id & ((1 << k) - 1));
-        arc._id = (arc._id << 1) | (~(n._id >> k) & 1);
-      } else {
-        arc._id = -1;
-      }
-    }
-
-    void firstIn(Arc& arc, const Node& node) const {
-      arc._id = ((node._id >> 1) << 1) | (node._id & 1);
-    }
-
-    void nextIn(Arc& arc) const {
-      Node n = (arc._id & 1) == 1 ? v(arc) : u(arc);
-      int k = (arc._id >> _dim) + 1;
-      if (k < _dim) {
-        arc._id = (k << (_dim-1)) |
-          ((n._id >> (k+1)) << k) | (n._id & ((1 << k) - 1));
-        arc._id = (arc._id << 1) | ((n._id >> k) & 1);
-      } else {
-        arc._id = -1;
-      }
-    }
-
-    static bool direction(Arc arc) {
-      return (arc._id & 1) == 1;
-    }
-
-    static Arc direct(Edge edge, bool dir) {
-      return Arc((edge._id << 1) | (dir ? 1 : 0));
-    }
-
-    int dimension() const {
-      return _dim;
-    }
-
-    bool projection(Node node, int n) const {
-      return static_cast<bool>(node._id & (1 << n));
-    }
-
-    int dimension(Edge edge) const {
-      return edge._id >> (_dim-1);
-    }
-
-    int dimension(Arc arc) const {
-      return arc._id >> _dim;
-    }
-
-    int index(Node node) const {
-      return node._id;
-    }
-
-    Node operator()(int ix) const {
-      return Node(ix);
-    }
-
-  private:
-    int _dim;
-    int _node_num, _edge_num;
-  };
-
-
-  typedef GraphExtender<HypercubeGraphBase> ExtendedHypercubeGraphBase;
-
-  /// \ingroup graphs
-  ///
-  /// \brief Hypercube graph class
-  ///
-  /// This class implements a special graph type. The nodes of the graph
-  /// are indiced with integers with at most \c dim binary digits.
-  /// Two nodes are connected in the graph if and only if their indices
-  /// differ only on one position in the binary form.
-  ///
-  /// \note The type of the indices is chosen to \c int for efficiency
-  /// reasons. Thus the maximum dimension of this implementation is 26
-  /// (assuming that the size of \c int is 32 bit).
-  ///
-  /// This graph type is fully conform to the \ref concepts::Graph
-  /// "Graph" concept, and it also has an important extra feature
-  /// that its maps are real \ref concepts::ReferenceMap
-  /// "reference map"s.
-  class HypercubeGraph : public ExtendedHypercubeGraphBase {
-  public:
-
-    typedef ExtendedHypercubeGraphBase Parent;
-
-    /// \brief Constructs a hypercube graph with \c dim dimensions.
-    ///
-    /// Constructs a hypercube graph with \c dim dimensions.
-    HypercubeGraph(int dim) { construct(dim); }
-
-    /// \brief The number of dimensions.
-    ///
-    /// Gives back the number of dimensions.
-    int dimension() const {
-      return Parent::dimension();
-    }
-
-    /// \brief Returns \c true if the n'th bit of the node is one.
-    ///
-    /// Returns \c true if the n'th bit of the node is one.
-    bool projection(Node node, int n) const {
-      return Parent::projection(node, n);
-    }
-
-    /// \brief The dimension id of an edge.
-    ///
-    /// Gives back the dimension id of the given edge.
-    /// It is in the [0..dim-1] range.
-    int dimension(Edge edge) const {
-      return Parent::dimension(edge);
-    }
-
-    /// \brief The dimension id of an arc.
-    ///
-    /// Gives back the dimension id of the given arc.
-    /// It is in the [0..dim-1] range.
-    int dimension(Arc arc) const {
-      return Parent::dimension(arc);
-    }
-
-    /// \brief The index of a node.
-    ///
-    /// Gives back the index of the given node.
-    /// The lower bits of the integer describes the node.
-    int index(Node node) const {
-      return Parent::index(node);
-    }
-
-    /// \brief Gives back a node by its index.
-    ///
-    /// Gives back a node by its index.
-    Node operator()(int ix) const {
-      return Parent::operator()(ix);
-    }
-
-    /// \brief Number of nodes.
-    int nodeNum() const { return Parent::nodeNum(); }
-    /// \brief Number of edges.
-    int edgeNum() const { return Parent::edgeNum(); }
-    /// \brief Number of arcs.
-    int arcNum() const { return Parent::arcNum(); }
-
-    /// \brief Linear combination map.
-    ///
-    /// This map makes possible to give back a linear combination
-    /// for each node. It works like the \c std::accumulate function,
-    /// so it accumulates the \c bf binary function with the \c fv first
-    /// value. The map accumulates only on that positions (dimensions)
-    /// where the index of the node is one. The values that have to be
-    /// accumulated should be given by the \c begin and \c end iterators
-    /// and the length of this range should be equal to the dimension
-    /// number of the graph.
-    ///
-    ///\code
-    /// const int DIM = 3;
-    /// HypercubeGraph graph(DIM);
-    /// dim2::Point<double> base[DIM];
-    /// for (int k = 0; k < DIM; ++k) {
-    ///   base[k].x = rnd();
-    ///   base[k].y = rnd();
-    /// }
-    /// HypercubeGraph::HyperMap<dim2::Point<double> >
-    ///   pos(graph, base, base + DIM, dim2::Point<double>(0.0, 0.0));
-    ///\endcode
-    ///
-    /// \see HypercubeGraph
-    template <typename T, typename BF = std::plus<T> >
-    class HyperMap {
-    public:
-
-      /// \brief The key type of the map
-      typedef Node Key;
-      /// \brief The value type of the map
-      typedef T Value;
-
-      /// \brief Constructor for HyperMap.
-      ///
-      /// Construct a HyperMap for the given graph. The values that have
-      /// to be accumulated should be given by the \c begin and \c end
-      /// iterators and the length of this range should be equal to the
-      /// dimension number of the graph.
-      ///
-      /// This map accumulates the \c bf binary function with the \c fv
-      /// first value on that positions (dimensions) where the index of
-      /// the node is one.
-      template <typename It>
-      HyperMap(const Graph& graph, It begin, It end,
-               T fv = 0, const BF& bf = BF())
-        : _graph(graph), _values(begin, end), _first_value(fv), _bin_func(bf)
-      {
-        LEMON_ASSERT(_values.size() == graph.dimension(),
-                     "Wrong size of range");
-      }
-
-      /// \brief The partial accumulated value.
-      ///
-      /// Gives back the partial accumulated value.
-      Value operator[](const Key& k) const {
-        Value val = _first_value;
-        int id = _graph.index(k);
-        int n = 0;
-        while (id != 0) {
-          if (id & 1) {
-            val = _bin_func(val, _values[n]);
-          }
-          id >>= 1;
-          ++n;
-        }
-        return val;
-      }
-
-    private:
-      const Graph& _graph;
-      std::vector<T> _values;
-      T _first_value;
-      BF _bin_func;
-    };
-
-  };
-
-}
-
-#endif
Index: lemon/nauty_reader.h
===================================================================
--- lemon/nauty_reader.h	(revision 359)
+++ lemon/nauty_reader.h	(revision 352)
@@ -39,5 +39,5 @@
   /// general, connected, biconnected, triangle-free, 4-cycle-free,
   /// bipartite and graphs with given edge number and degree
-  /// constraints). This function reads a \e nauty \e graph6 \e format
+  /// constraints). This function reads a \e nauty \e graph \e format
   /// line from the given stream and builds it in the given graph.
   ///
@@ -49,5 +49,5 @@
   /// int num = 0;
   /// SmartGraph graph;
-  /// while (readNautyGraph(graph, std::cin)) {
+  /// while (readNauty(graph, std::cin)) {
   ///   PlanarityChecking<SmartGraph> pc(graph);
   ///   if (pc.run()) ++num;
@@ -62,5 +62,5 @@
   ///\endcode
   template <typename Graph>
-  std::istream& readNautyGraph(Graph& graph, std::istream& is = std::cin) {
+  std::istream& readNauty(Graph& graph, std::istream& is = std::cin) {
     graph.clear();
 
Index: lemon/random.h
===================================================================
--- lemon/random.h	(revision 378)
+++ lemon/random.h	(revision 340)
@@ -689,4 +689,20 @@
     }
 
+    /// \brief Returns a random real number the range [0, b)
+    ///
+    /// It returns a random real number from the range [0, b).
+    template <typename Number>
+    Number real(Number b) {
+      return real<Number>() * b;
+    }
+
+    /// \brief Returns a random real number from the range [a, b)
+    ///
+    /// It returns a random real number from the range [a, b).
+    template <typename Number>
+    Number real(Number a, Number b) {
+      return real<Number>() * (b - a) + a;
+    }
+
     /// \brief Returns a random real number from the range [0, 1)
     ///
@@ -699,6 +715,7 @@
     ///
     /// It returns a random real number from the range [0, b).
-    double operator()(double b) {
-      return real<double>() * b;
+    template <typename Number>
+    Number operator()(Number b) {
+      return real<Number>() * b;
     }
 
@@ -706,6 +723,7 @@
     ///
     /// It returns a random real number from the range [a, b).
-    double operator()(double a, double b) {
-      return real<double>() * (b - a) + a;
+    template <typename Number>
+    Number operator()(Number a, Number b) {
+      return real<Number>() * (b - a) + a;
     }
 
Index: lemon/smart_graph.h
===================================================================
--- lemon/smart_graph.h	(revision 375)
+++ lemon/smart_graph.h	(revision 329)
@@ -68,5 +68,5 @@
 
     typedef True NodeNumTag;
-    typedef True ArcNumTag;
+    typedef True EdgeNumTag;
 
     int nodeNum() const { return nodes.size(); }
@@ -306,7 +306,5 @@
       nodes[b._id].first_out=nodes[n._id].first_out;
       nodes[n._id].first_out=-1;
-      for(int i=nodes[b._id].first_out; i!=-1; i=arcs[i].next_out) {
-        arcs[i].source=b._id;
-      }
+      for(int i=nodes[b._id].first_out;i!=-1;i++) arcs[i].source=b._id;
       if(connect) addArc(n,b);
       return b;
@@ -483,11 +481,4 @@
       : nodes(), arcs() {}
 
-    typedef True NodeNumTag;
-    typedef True EdgeNumTag;
-    typedef True ArcNumTag;
-
-    int nodeNum() const { return nodes.size(); }
-    int edgeNum() const { return arcs.size() / 2; }
-    int arcNum() const { return arcs.size(); }
 
     int maxNodeId() const { return nodes.size()-1; }
@@ -738,6 +729,6 @@
         dir.push_back(arcFromId(n-1));
         Parent::notifier(Arc()).erase(dir);
-        nodes[arcs[n-1].target].first_out=arcs[n].next_out;
-        nodes[arcs[n].target].first_out=arcs[n-1].next_out;
+        nodes[arcs[n].target].first_out=arcs[n].next_out;
+        nodes[arcs[n-1].target].first_out=arcs[n-1].next_out;
         arcs.pop_back();
         arcs.pop_back();
Index: scripts/chg-len.py
===================================================================
--- scripts/chg-len.py	(revision 376)
+++ scripts/chg-len.py	(revision 284)
@@ -2,6 +2,5 @@
 
 import sys
-
-from mercurial import ui, hg
+import os
 
 if len(sys.argv)>1 and sys.argv[1] in ["-h","--help"]:
@@ -11,19 +10,31 @@
 """
     exit(0)
+plist = os.popen("HGRCPATH='' hg parents --template='{rev}\n'").readlines()
+if len(plist)>1:
+    print "You are in the process of merging"
+    exit(1)
+PAR = int(plist[0])
 
-u = ui.ui()
-r = hg.repository(u, ".")
-N = r.changectx(".").rev()
-lengths=[0]*(N+1)
-for i in range(N+1):
-    p=r.changectx(i).parents()
-    if p[0]:
-        p0=lengths[p[0].rev()]
+f = os.popen("HGRCPATH='' hg log -r 0:tip --template='{rev} {parents}\n'").\
+    readlines()
+REV = -1
+lengths=[]
+for l in f:
+    REV+=1
+    s = l.split()
+    rev = int(s[0])
+    if REV != rev:
+        print "Something is seriously wrong"
+        exit(1)
+    if len(s) == 1:
+        par1 = par2 = rev - 1
+    elif len(s) == 2:
+        par1 = par2 = int(s[1].split(":")[0])
     else:
-        p0=-1
-    if len(p)>1 and p[1]:
-        p1=lengths[p[1].rev()]
+        par1 = int(s[1].split(":")[0])
+        par2 = int(s[2].split(":")[0])
+    if rev == 0:
+        lengths.append(0)
     else:
-        p1=-1
-    lengths[i]=max(p0,p1)+1
-print lengths[N]
+        lengths.append(max(lengths[par1],lengths[par2])+1)
+print lengths[PAR]
Index: test/digraph_test.cc
===================================================================
--- test/digraph_test.cc	(revision 375)
+++ test/digraph_test.cc	(revision 354)
@@ -21,4 +21,5 @@
 #include <lemon/smart_graph.h>
 #include <lemon/full_graph.h>
+//#include <lemon/hypercube_graph.h>
 
 #include "test_tools.h"
@@ -29,5 +30,5 @@
 
 template <class Digraph>
-void checkDigraphBuild() {
+void checkDigraph() {
   TEMPLATE_DIGRAPH_TYPEDEFS(Digraph);
   Digraph G;
@@ -58,8 +59,5 @@
   checkGraphConArcList(G, 1);
 
-  Arc a2 = G.addArc(n2, n1),
-      a3 = G.addArc(n2, n3),
-      a4 = G.addArc(n2, n3);
-
+  Arc a2 = G.addArc(n2, n1), a3 = G.addArc(n2, n3), a4 = G.addArc(n2, n3);
   checkGraphNodeList(G, 3);
   checkGraphArcList(G, 4);
@@ -79,197 +77,21 @@
   checkGraphNodeMap(G);
   checkGraphArcMap(G);
-}
-
-template <class Digraph>
-void checkDigraphSplit() {
-  TEMPLATE_DIGRAPH_TYPEDEFS(Digraph);
-
-  Digraph G;
-  Node n1 = G.addNode(), n2 = G.addNode(), n3 = G.addNode();
-  Arc a1 = G.addArc(n1, n2), a2 = G.addArc(n2, n1),
-      a3 = G.addArc(n2, n3), a4 = G.addArc(n2, n3);
-
-  Node n4 = G.split(n2);
-
-  check(G.target(OutArcIt(G, n2)) == n4 &&
-        G.source(InArcIt(G, n4)) == n2,
-        "Wrong split.");
-
-  checkGraphNodeList(G, 4);
-  checkGraphArcList(G, 5);
-
-  checkGraphOutArcList(G, n1, 1);
-  checkGraphOutArcList(G, n2, 1);
-  checkGraphOutArcList(G, n3, 0);
-  checkGraphOutArcList(G, n4, 3);
-
-  checkGraphInArcList(G, n1, 1);
-  checkGraphInArcList(G, n2, 1);
-  checkGraphInArcList(G, n3, 2);
-  checkGraphInArcList(G, n4, 1);
-
-  checkGraphConArcList(G, 5);
-}
-
-template <class Digraph>
-void checkDigraphAlter() {
-  TEMPLATE_DIGRAPH_TYPEDEFS(Digraph);
-
-  Digraph G;
-  Node n1 = G.addNode(), n2 = G.addNode(),
-       n3 = G.addNode(), n4 = G.addNode();
-  Arc a1 = G.addArc(n1, n2), a2 = G.addArc(n4, n1),
-      a3 = G.addArc(n4, n3), a4 = G.addArc(n4, n3),
-      a5 = G.addArc(n2, n4);
-
-  checkGraphNodeList(G, 4);
-  checkGraphArcList(G, 5);
-
-  // Check changeSource() and changeTarget()
-  G.changeTarget(a4, n1);
-
-  checkGraphNodeList(G, 4);
-  checkGraphArcList(G, 5);
-
-  checkGraphOutArcList(G, n1, 1);
-  checkGraphOutArcList(G, n2, 1);
-  checkGraphOutArcList(G, n3, 0);
-  checkGraphOutArcList(G, n4, 3);
-
-  checkGraphInArcList(G, n1, 2);
-  checkGraphInArcList(G, n2, 1);
-  checkGraphInArcList(G, n3, 1);
-  checkGraphInArcList(G, n4, 1);
-
-  checkGraphConArcList(G, 5);
-
-  G.changeSource(a4, n3);
-
-  checkGraphNodeList(G, 4);
-  checkGraphArcList(G, 5);
-
-  checkGraphOutArcList(G, n1, 1);
-  checkGraphOutArcList(G, n2, 1);
-  checkGraphOutArcList(G, n3, 1);
-  checkGraphOutArcList(G, n4, 2);
-
-  checkGraphInArcList(G, n1, 2);
-  checkGraphInArcList(G, n2, 1);
-  checkGraphInArcList(G, n3, 1);
-  checkGraphInArcList(G, n4, 1);
-
-  checkGraphConArcList(G, 5);
-
-  // Check contract()
-  G.contract(n2, n4, false);
-
-  checkGraphNodeList(G, 3);
-  checkGraphArcList(G, 5);
-
-  checkGraphOutArcList(G, n1, 1);
-  checkGraphOutArcList(G, n2, 3);
-  checkGraphOutArcList(G, n3, 1);
-
-  checkGraphInArcList(G, n1, 2);
-  checkGraphInArcList(G, n2, 2);
-  checkGraphInArcList(G, n3, 1);
-
-  checkGraphConArcList(G, 5);
-
-  G.contract(n2, n1);
-
-  checkGraphNodeList(G, 2);
-  checkGraphArcList(G, 3);
-
-  checkGraphOutArcList(G, n2, 2);
-  checkGraphOutArcList(G, n3, 1);
-
-  checkGraphInArcList(G, n2, 2);
-  checkGraphInArcList(G, n3, 1);
-
-  checkGraphConArcList(G, 3);
-}
-
-template <class Digraph>
-void checkDigraphErase() {
-  TEMPLATE_DIGRAPH_TYPEDEFS(Digraph);
-
-  Digraph G;
-  Node n1 = G.addNode(), n2 = G.addNode(),
-       n3 = G.addNode(), n4 = G.addNode();
-  Arc a1 = G.addArc(n1, n2), a2 = G.addArc(n4, n1),
-      a3 = G.addArc(n4, n3), a4 = G.addArc(n3, n1),
-      a5 = G.addArc(n2, n4);
-
-  // Check arc deletion
-  G.erase(a1);
-
-  checkGraphNodeList(G, 4);
-  checkGraphArcList(G, 4);
-
-  checkGraphOutArcList(G, n1, 0);
-  checkGraphOutArcList(G, n2, 1);
-  checkGraphOutArcList(G, n3, 1);
-  checkGraphOutArcList(G, n4, 2);
-
-  checkGraphInArcList(G, n1, 2);
-  checkGraphInArcList(G, n2, 0);
-  checkGraphInArcList(G, n3, 1);
-  checkGraphInArcList(G, n4, 1);
-
-  checkGraphConArcList(G, 4);
-
-  // Check node deletion
-  G.erase(n4);
-
-  checkGraphNodeList(G, 3);
-  checkGraphArcList(G, 1);
-
-  checkGraphOutArcList(G, n1, 0);
-  checkGraphOutArcList(G, n2, 0);
-  checkGraphOutArcList(G, n3, 1);
-  checkGraphOutArcList(G, n4, 0);
-
-  checkGraphInArcList(G, n1, 1);
-  checkGraphInArcList(G, n2, 0);
-  checkGraphInArcList(G, n3, 0);
-  checkGraphInArcList(G, n4, 0);
-
-  checkGraphConArcList(G, 1);
-}
-
-
-template <class Digraph>
-void checkDigraphSnapshot() {
-  TEMPLATE_DIGRAPH_TYPEDEFS(Digraph);
-
-  Digraph G;
-  Node n1 = G.addNode(), n2 = G.addNode(), n3 = G.addNode();
-  Arc a1 = G.addArc(n1, n2), a2 = G.addArc(n2, n1),
-      a3 = G.addArc(n2, n3), a4 = G.addArc(n2, n3);
-
-  typename Digraph::Snapshot snapshot(G);
-
-  Node n = G.addNode();
-  G.addArc(n3, n);
-  G.addArc(n, n3);
-
-  checkGraphNodeList(G, 4);
-  checkGraphArcList(G, 6);
-
-  snapshot.restore();
-
-  checkGraphNodeList(G, 3);
-  checkGraphArcList(G, 4);
-
-  checkGraphOutArcList(G, n1, 1);
-  checkGraphOutArcList(G, n2, 3);
-  checkGraphOutArcList(G, n3, 0);
-
-  checkGraphInArcList(G, n1, 1);
-  checkGraphInArcList(G, n2, 1);
-  checkGraphInArcList(G, n3, 2);
-
-  checkGraphConArcList(G, 4);
+
+}
+
+void checkFullDigraph(int num) {
+  typedef FullDigraph Digraph;
+  DIGRAPH_TYPEDEFS(Digraph);
+  Digraph G(num);
+
+  checkGraphNodeList(G, num);
+  checkGraphArcList(G, num * num);
+
+  for (NodeIt n(G); n != INVALID; ++n) {
+    checkGraphOutArcList(G, n, num);
+    checkGraphInArcList(G, n, num);
+  }
+
+  checkGraphConArcList(G, num * num);
 
   checkNodeIds(G);
@@ -278,14 +100,17 @@
   checkGraphArcMap(G);
 
-  G.addNode();
-  snapshot.save(G);
-
-  G.addArc(G.addNode(), G.addNode());
-
-  snapshot.restore();
-
-  checkGraphNodeList(G, 4);
-  checkGraphArcList(G, 4);
-}
+  for (int i = 0; i < G.nodeNum(); ++i) {
+    check(G.index(G(i)) == i, "Wrong index");
+  }
+
+  for (NodeIt s(G); s != INVALID; ++s) {
+    for (NodeIt t(G); t != INVALID; ++t) {
+      Arc a = G.arc(s, t);
+      check(G.source(a) == s && G.target(a) == t, "Wrong arc lookup");
+    }
+  }
+
+}
+
 
 void checkConcepts() {
@@ -321,4 +146,7 @@
     checkConcept<Digraph, FullDigraph>();
   }
+//  { // Checking HyperCubeDigraph
+//    checkConcept<Digraph, HyperCubeDigraph>();
+//  }
 }
 
@@ -373,49 +201,11 @@
 }
 
-void checkFullDigraph(int num) {
-  typedef FullDigraph Digraph;
-  DIGRAPH_TYPEDEFS(Digraph);
-  Digraph G(num);
-
-  checkGraphNodeList(G, num);
-  checkGraphArcList(G, num * num);
-
-  for (NodeIt n(G); n != INVALID; ++n) {
-    checkGraphOutArcList(G, n, num);
-    checkGraphInArcList(G, n, num);
-  }
-
-  checkGraphConArcList(G, num * num);
-
-  checkNodeIds(G);
-  checkArcIds(G);
-  checkGraphNodeMap(G);
-  checkGraphArcMap(G);
-
-  for (int i = 0; i < G.nodeNum(); ++i) {
-    check(G.index(G(i)) == i, "Wrong index");
-  }
-
-  for (NodeIt s(G); s != INVALID; ++s) {
-    for (NodeIt t(G); t != INVALID; ++t) {
-      Arc a = G.arc(s, t);
-      check(G.source(a) == s && G.target(a) == t, "Wrong arc lookup");
-    }
-  }
-}
-
 void checkDigraphs() {
   { // Checking ListDigraph
-    checkDigraphBuild<ListDigraph>();
-    checkDigraphSplit<ListDigraph>();
-    checkDigraphAlter<ListDigraph>();
-    checkDigraphErase<ListDigraph>();
-    checkDigraphSnapshot<ListDigraph>();
+    checkDigraph<ListDigraph>();
     checkDigraphValidityErase<ListDigraph>();
   }
   { // Checking SmartDigraph
-    checkDigraphBuild<SmartDigraph>();
-    checkDigraphSplit<SmartDigraph>();
-    checkDigraphSnapshot<SmartDigraph>();
+    checkDigraph<SmartDigraph>();
     checkDigraphValidity<SmartDigraph>();
   }
Index: test/graph_test.cc
===================================================================
--- test/graph_test.cc	(revision 375)
+++ test/graph_test.cc	(revision 356)
@@ -22,5 +22,4 @@
 #include <lemon/full_graph.h>
 #include <lemon/grid_graph.h>
-#include <lemon/hypercube_graph.h>
 
 #include "test_tools.h"
@@ -31,5 +30,5 @@
 
 template <class Graph>
-void checkGraphBuild() {
+void checkGraph() {
   TEMPLATE_GRAPH_TYPEDEFS(Graph);
 
@@ -37,5 +36,4 @@
   checkGraphNodeList(G, 0);
   checkGraphEdgeList(G, 0);
-  checkGraphArcList(G, 0);
 
   Node
@@ -45,34 +43,46 @@
   checkGraphNodeList(G, 3);
   checkGraphEdgeList(G, 0);
-  checkGraphArcList(G, 0);
 
   Edge e1 = G.addEdge(n1, n2);
   check((G.u(e1) == n1 && G.v(e1) == n2) || (G.u(e1) == n2 && G.v(e1) == n1),
         "Wrong edge");
-
   checkGraphNodeList(G, 3);
+  checkGraphArcList(G, 2);
   checkGraphEdgeList(G, 1);
-  checkGraphArcList(G, 2);
-
-  checkGraphIncEdgeArcLists(G, n1, 1);
-  checkGraphIncEdgeArcLists(G, n2, 1);
-  checkGraphIncEdgeArcLists(G, n3, 0);
-
+
+  checkGraphOutArcList(G, n1, 1);
+  checkGraphOutArcList(G, n2, 1);
+  checkGraphOutArcList(G, n3, 0);
+
+  checkGraphInArcList(G, n1, 1);
+  checkGraphInArcList(G, n2, 1);
+  checkGraphInArcList(G, n3, 0);
+
+  checkGraphIncEdgeList(G, n1, 1);
+  checkGraphIncEdgeList(G, n2, 1);
+  checkGraphIncEdgeList(G, n3, 0);
+
+  checkGraphConArcList(G, 2);
   checkGraphConEdgeList(G, 1);
-  checkGraphConArcList(G, 2);
-
-  Edge e2 = G.addEdge(n2, n1),
-       e3 = G.addEdge(n2, n3);
-
+
+  Edge e2 = G.addEdge(n2, n1), e3 = G.addEdge(n2, n3);
   checkGraphNodeList(G, 3);
+  checkGraphArcList(G, 6);
   checkGraphEdgeList(G, 3);
-  checkGraphArcList(G, 6);
-
-  checkGraphIncEdgeArcLists(G, n1, 2);
-  checkGraphIncEdgeArcLists(G, n2, 3);
-  checkGraphIncEdgeArcLists(G, n3, 1);
-
+
+  checkGraphOutArcList(G, n1, 2);
+  checkGraphOutArcList(G, n2, 3);
+  checkGraphOutArcList(G, n3, 1);
+
+  checkGraphInArcList(G, n1, 2);
+  checkGraphInArcList(G, n2, 3);
+  checkGraphInArcList(G, n3, 1);
+
+  checkGraphIncEdgeList(G, n1, 2);
+  checkGraphIncEdgeList(G, n2, 3);
+  checkGraphIncEdgeList(G, n3, 1);
+
+  checkGraphConArcList(G, 6);
   checkGraphConEdgeList(G, 3);
-  checkGraphConArcList(G, 6);
 
   checkArcDirections(G);
@@ -86,181 +96,4 @@
 }
 
-template <class Graph>
-void checkGraphAlter() {
-  TEMPLATE_GRAPH_TYPEDEFS(Graph);
-
-  Graph G;
-  Node n1 = G.addNode(), n2 = G.addNode(),
-       n3 = G.addNode(), n4 = G.addNode();
-  Edge e1 = G.addEdge(n1, n2), e2 = G.addEdge(n2, n1),
-       e3 = G.addEdge(n2, n3), e4 = G.addEdge(n1, n4),
-       e5 = G.addEdge(n4, n3);
-
-  checkGraphNodeList(G, 4);
-  checkGraphEdgeList(G, 5);
-  checkGraphArcList(G, 10);
-
-  // Check changeU() and changeV()
-  if (G.u(e2) == n2) {
-    G.changeU(e2, n3);
-  } else {
-    G.changeV(e2, n3);
-  }
-
-  checkGraphNodeList(G, 4);
-  checkGraphEdgeList(G, 5);
-  checkGraphArcList(G, 10);
-
-  checkGraphIncEdgeArcLists(G, n1, 3);
-  checkGraphIncEdgeArcLists(G, n2, 2);
-  checkGraphIncEdgeArcLists(G, n3, 3);
-  checkGraphIncEdgeArcLists(G, n4, 2);
-
-  checkGraphConEdgeList(G, 5);
-  checkGraphConArcList(G, 10);
-
-  if (G.u(e2) == n1) {
-    G.changeU(e2, n2);
-  } else {
-    G.changeV(e2, n2);
-  }
-
-  checkGraphNodeList(G, 4);
-  checkGraphEdgeList(G, 5);
-  checkGraphArcList(G, 10);
-
-  checkGraphIncEdgeArcLists(G, n1, 2);
-  checkGraphIncEdgeArcLists(G, n2, 3);
-  checkGraphIncEdgeArcLists(G, n3, 3);
-  checkGraphIncEdgeArcLists(G, n4, 2);
-
-  checkGraphConEdgeList(G, 5);
-  checkGraphConArcList(G, 10);
-
-  // Check contract()
-  G.contract(n1, n4, false);
-
-  checkGraphNodeList(G, 3);
-  checkGraphEdgeList(G, 5);
-  checkGraphArcList(G, 10);
-
-  checkGraphIncEdgeArcLists(G, n1, 4);
-  checkGraphIncEdgeArcLists(G, n2, 3);
-  checkGraphIncEdgeArcLists(G, n3, 3);
-
-  checkGraphConEdgeList(G, 5);
-  checkGraphConArcList(G, 10);
-
-  G.contract(n2, n3);
-
-  checkGraphNodeList(G, 2);
-  checkGraphEdgeList(G, 3);
-  checkGraphArcList(G, 6);
-
-  checkGraphIncEdgeArcLists(G, n1, 4);
-  checkGraphIncEdgeArcLists(G, n2, 2);
-
-  checkGraphConEdgeList(G, 3);
-  checkGraphConArcList(G, 6);
-}
-
-template <class Graph>
-void checkGraphErase() {
-  TEMPLATE_GRAPH_TYPEDEFS(Graph);
-
-  Graph G;
-  Node n1 = G.addNode(), n2 = G.addNode(),
-       n3 = G.addNode(), n4 = G.addNode();
-  Edge e1 = G.addEdge(n1, n2), e2 = G.addEdge(n2, n1),
-       e3 = G.addEdge(n2, n3), e4 = G.addEdge(n1, n4),
-       e5 = G.addEdge(n4, n3);
-
-  // Check edge deletion
-  G.erase(e2);
-
-  checkGraphNodeList(G, 4);
-  checkGraphEdgeList(G, 4);
-  checkGraphArcList(G, 8);
-
-  checkGraphIncEdgeArcLists(G, n1, 2);
-  checkGraphIncEdgeArcLists(G, n2, 2);
-  checkGraphIncEdgeArcLists(G, n3, 2);
-  checkGraphIncEdgeArcLists(G, n4, 2);
-
-  checkGraphConEdgeList(G, 4);
-  checkGraphConArcList(G, 8);
-
-  // Check node deletion
-  G.erase(n3);
-
-  checkGraphNodeList(G, 3);
-  checkGraphEdgeList(G, 2);
-  checkGraphArcList(G, 4);
-
-  checkGraphIncEdgeArcLists(G, n1, 2);
-  checkGraphIncEdgeArcLists(G, n2, 1);
-  checkGraphIncEdgeArcLists(G, n4, 1);
-
-  checkGraphConEdgeList(G, 2);
-  checkGraphConArcList(G, 4);
-}
-
-
-template <class Graph>
-void checkGraphSnapshot() {
-  TEMPLATE_GRAPH_TYPEDEFS(Graph);
-
-  Graph G;
-  Node n1 = G.addNode(), n2 = G.addNode(), n3 = G.addNode();
-  Edge e1 = G.addEdge(n1, n2), e2 = G.addEdge(n2, n1),
-       e3 = G.addEdge(n2, n3);
-
-  checkGraphNodeList(G, 3);
-  checkGraphEdgeList(G, 3);
-  checkGraphArcList(G, 6);
-
-  typename Graph::Snapshot snapshot(G);
-
-  Node n = G.addNode();
-  G.addEdge(n3, n);
-  G.addEdge(n, n3);
-  G.addEdge(n3, n2);
-
-  checkGraphNodeList(G, 4);
-  checkGraphEdgeList(G, 6);
-  checkGraphArcList(G, 12);
-
-  snapshot.restore();
-
-  checkGraphNodeList(G, 3);
-  checkGraphEdgeList(G, 3);
-  checkGraphArcList(G, 6);
-
-  checkGraphIncEdgeArcLists(G, n1, 2);
-  checkGraphIncEdgeArcLists(G, n2, 3);
-  checkGraphIncEdgeArcLists(G, n3, 1);
-
-  checkGraphConEdgeList(G, 3);
-  checkGraphConArcList(G, 6);
-
-  checkNodeIds(G);
-  checkEdgeIds(G);
-  checkArcIds(G);
-  checkGraphNodeMap(G);
-  checkGraphEdgeMap(G);
-  checkGraphArcMap(G);
-
-  G.addNode();
-  snapshot.save(G);
-
-  G.addEdge(G.addNode(), G.addNode());
-
-  snapshot.restore();
-
-  checkGraphNodeList(G, 4);
-  checkGraphEdgeList(G, 3);
-  checkGraphArcList(G, 6);
-}
-
 void checkFullGraph(int num) {
   typedef FullGraph Graph;
@@ -272,7 +105,7 @@
 
   for (NodeIt n(G); n != INVALID; ++n) {
-    checkGraphOutArcList(G, n, num - 1);
-    checkGraphInArcList(G, n, num - 1);
-    checkGraphIncEdgeList(G, n, num - 1);
+    checkGraphOutArcList(G, n, num - 1);    
+    checkGraphInArcList(G, n, num - 1);    
+    checkGraphIncEdgeList(G, n, num - 1);    
   }
 
@@ -289,5 +122,5 @@
   checkGraphEdgeMap(G);
 
-
+  
   for (int i = 0; i < G.nodeNum(); ++i) {
     check(G.index(G(i)) == i, "Wrong index");
@@ -345,7 +178,4 @@
     checkConcept<Graph, GridGraph>();
   }
-  { // Checking HypercubeGraph
-    checkConcept<Graph, HypercubeGraph>();
-  }
 }
 
@@ -483,66 +313,14 @@
 }
 
-void checkHypercubeGraph(int dim) {
-  GRAPH_TYPEDEFS(HypercubeGraph);
-
-  HypercubeGraph G(dim);
-  checkGraphNodeList(G, 1 << dim);
-  checkGraphEdgeList(G, dim * (1 << (dim-1)));
-  checkGraphArcList(G, dim * (1 << dim));
-
-  Node n = G.nodeFromId(dim);
-
-  for (NodeIt n(G); n != INVALID; ++n) {
-    checkGraphIncEdgeList(G, n, dim);
-    for (IncEdgeIt e(G, n); e != INVALID; ++e) {
-      check( (G.u(e) == n &&
-              G.id(G.v(e)) == (G.id(n) ^ (1 << G.dimension(e)))) ||
-             (G.v(e) == n &&
-              G.id(G.u(e)) == (G.id(n) ^ (1 << G.dimension(e)))),
-             "Wrong edge or wrong dimension");
-    }
-
-    checkGraphOutArcList(G, n, dim);
-    for (OutArcIt a(G, n); a != INVALID; ++a) {
-      check(G.source(a) == n &&
-            G.id(G.target(a)) == (G.id(n) ^ (1 << G.dimension(a))),
-            "Wrong arc or wrong dimension");
-    }
-
-    checkGraphInArcList(G, n, dim);
-    for (InArcIt a(G, n); a != INVALID; ++a) {
-      check(G.target(a) == n &&
-            G.id(G.source(a)) == (G.id(n) ^ (1 << G.dimension(a))),
-            "Wrong arc or wrong dimension");
-    }
-  }
-
-  checkGraphConArcList(G, (1 << dim) * dim);
-  checkGraphConEdgeList(G, dim * (1 << (dim-1)));
-
-  checkArcDirections(G);
-
-  checkNodeIds(G);
-  checkArcIds(G);
-  checkEdgeIds(G);
-  checkGraphNodeMap(G);
-  checkGraphArcMap(G);
-  checkGraphEdgeMap(G);
-}
-
 void checkGraphs() {
   { // Checking ListGraph
-    checkGraphBuild<ListGraph>();
-    checkGraphAlter<ListGraph>();
-    checkGraphErase<ListGraph>();
-    checkGraphSnapshot<ListGraph>();
+    checkGraph<ListGraph>();
     checkGraphValidityErase<ListGraph>();
   }
   { // Checking SmartGraph
-    checkGraphBuild<SmartGraph>();
-    checkGraphSnapshot<SmartGraph>();
+    checkGraph<SmartGraph>();
     checkGraphValidity<SmartGraph>();
   }
-  { // Checking FullGraph
+  { // Checking FullGraph   
     checkFullGraph(7);
     checkFullGraph(8);
@@ -555,10 +333,4 @@
     checkGridGraph(1, 1);
   }
-  { // Checking HypercubeGraph
-    checkHypercubeGraph(1);
-    checkHypercubeGraph(2);
-    checkHypercubeGraph(3);
-    checkHypercubeGraph(4);
-  }
 }
 
Index: test/graph_test.h
===================================================================
--- test/graph_test.h	(revision 374)
+++ test/graph_test.h	(revision 263)
@@ -115,13 +115,4 @@
     check(e==INVALID,"Wrong IncEdge list linking.");
     check(countIncEdges(G,n)==cnt,"Wrong IncEdge number.");
-  }
-
-  template <class Graph>
-  void checkGraphIncEdgeArcLists(const Graph &G, typename Graph::Node n,
-                                 int cnt)
-  {
-    checkGraphIncEdgeList(G, n, cnt);
-    checkGraphOutArcList(G, n, cnt);
-    checkGraphInArcList(G, n, cnt);
   }
 
Index: tools/lemon-0.x-to-1.x.sh
===================================================================
--- tools/lemon-0.x-to-1.x.sh	(revision 366)
+++ tools/lemon-0.x-to-1.x.sh	(revision 344)
@@ -82,5 +82,4 @@
         -e "s/\<copyGraph\>/graphCopy/g"\
         -e "s/\<copyDigraph\>/digraphCopy/g"\
-        -e "s/\<HyperCubeDigraph\>/HypercubeGraph/g"\
         -e "s/\<IntegerMap\>/RangeMap/g"\
         -e "s/\<integerMap\>/rangeMap/g"\
@@ -92,5 +91,4 @@
         -e "s/\<storeBoolMap\>/loggerBoolMap/g"\
         -e "s/\<BoundingBox\>/Box/g"\
-        -e "s/\<readNauty\>/readNautyGraph/g"\
     <$i > $TMP
     mv $TMP $i
