Index: CMakeLists.txt
===================================================================
--- CMakeLists.txt	(revision 621)
+++ CMakeLists.txt	(revision 552)
@@ -15,6 +15,4 @@
 INCLUDE(FindGhostscript)
 FIND_PACKAGE(GLPK 4.33)
-FIND_PACKAGE(CPLEX)
-FIND_PACKAGE(COIN)
 
 ADD_DEFINITIONS(-DHAVE_CONFIG_H)
@@ -28,4 +26,10 @@
 # C4996: 'function': was declared deprecated
 ENDIF(MSVC)
+
+IF(GLPK_FOUND)
+  SET(HAVE_LP TRUE)
+  SET(HAVE_MIP TRUE)
+  SET(HAVE_GLPK TRUE)
+ENDIF(GLPK_FOUND)
 
 INCLUDE(CheckTypeSize)
Index: ake/FindCOIN.cmake
===================================================================
--- cmake/FindCOIN.cmake	(revision 621)
+++ 	(revision )
@@ -1,68 +1,0 @@
-SET(COIN_ROOT_DIR "" CACHE PATH "COIN root directory")
-
-FIND_PATH(COIN_INCLUDE_DIR coin/CoinUtilsConfig.h
-  PATHS ${COIN_ROOT_DIR}/include)
-
-FIND_LIBRARY(COIN_CBC_LIBRARY libCbc
-  PATHS ${COIN_ROOT_DIR}/lib)
-FIND_LIBRARY(COIN_CBC_SOLVER_LIBRARY libCbcSolver
-  PATHS ${COIN_ROOT_DIR}/lib)
-FIND_LIBRARY(COIN_CGL_LIBRARY libCgl
-  PATHS ${COIN_ROOT_DIR}/lib)
-FIND_LIBRARY(COIN_CLP_LIBRARY libClp
-  PATHS ${COIN_ROOT_DIR}/lib)
-FIND_LIBRARY(COIN_COIN_UTILS_LIBRARY libCoinUtils
-  PATHS ${COIN_ROOT_DIR}/lib)
-FIND_LIBRARY(COIN_OSI_LIBRARY libOsi
-  PATHS ${COIN_ROOT_DIR}/lib)
-FIND_LIBRARY(COIN_OSI_CBC_LIBRARY libOsiCbc
-  PATHS ${COIN_ROOT_DIR}/lib)
-FIND_LIBRARY(COIN_OSI_CLP_LIBRARY libOsiClp
-  PATHS ${COIN_ROOT_DIR}/lib)
-FIND_LIBRARY(COIN_OSI_VOL_LIBRARY libOsiVol
-  PATHS ${COIN_ROOT_DIR}/lib)
-FIND_LIBRARY(COIN_VOL_LIBRARY libVol
-  PATHS ${COIN_ROOT_DIR}/lib)
-
-INCLUDE(FindPackageHandleStandardArgs)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(COIN DEFAULT_MSG
-  COIN_INCLUDE_DIR
-  COIN_CBC_LIBRARY
-  COIN_CBC_SOLVER_LIBRARY
-  COIN_CGL_LIBRARY
-  COIN_CLP_LIBRARY
-  COIN_COIN_UTILS_LIBRARY
-  COIN_OSI_LIBRARY
-  COIN_OSI_CBC_LIBRARY
-  COIN_OSI_CLP_LIBRARY
-  COIN_OSI_VOL_LIBRARY
-  COIN_VOL_LIBRARY
-)
-
-IF(COIN_FOUND)
-  SET(COIN_INCLUDE_DIRS ${COIN_INCLUDE_DIR})
-  SET(COIN_LIBRARIES "${COIN_CBC_LIBRARY};${COIN_CBC_SOLVER_LIBRARY};${COIN_CGL_LIBRARY};${COIN_CLP_LIBRARY};${COIN_COIN_UTILS_LIBRARY};${COIN_OSI_LIBRARY};${COIN_OSI_CBC_LIBRARY};${COIN_OSI_CLP_LIBRARY};${COIN_OSI_VOL_LIBRARY};${COIN_VOL_LIBRARY}")
-  SET(COIN_CLP_LIBRARIES "${COIN_CLP_LIBRARY};${COIN_COIN_UTILS_LIBRARY}")
-  SET(COIN_CBC_LIBRARIES ${COIN_LIBRARIES})
-ENDIF(COIN_FOUND)
-
-MARK_AS_ADVANCED(
-  COIN_INCLUDE_DIR
-  COIN_CBC_LIBRARY
-  COIN_CBC_SOLVER_LIBRARY
-  COIN_CGL_LIBRARY
-  COIN_CLP_LIBRARY
-  COIN_COIN_UTILS_LIBRARY
-  COIN_OSI_LIBRARY
-  COIN_OSI_CBC_LIBRARY
-  COIN_OSI_CLP_LIBRARY
-  COIN_OSI_VOL_LIBRARY
-  COIN_VOL_LIBRARY
-)
-
-IF(COIN_FOUND)
-  SET(HAVE_LP TRUE)
-  SET(HAVE_MIP TRUE)
-  SET(HAVE_CLP TRUE)
-  SET(HAVE_CBC TRUE)
-ENDIF(COIN_FOUND)
Index: ake/FindCPLEX.cmake
===================================================================
--- cmake/FindCPLEX.cmake	(revision 620)
+++ 	(revision )
@@ -1,27 +1,0 @@
-FIND_PATH(CPLEX_INCLUDE_DIR
-  ilcplex/cplex.h
-  PATHS "C:/ILOG/CPLEX91/include")
-
-FIND_LIBRARY(CPLEX_LIBRARY
-  NAMES cplex91
-  PATHS "C:/ILOG/CPLEX91/lib/msvc7/stat_mda")
-
-INCLUDE(FindPackageHandleStandardArgs)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(CPLEX DEFAULT_MSG CPLEX_LIBRARY CPLEX_INCLUDE_DIR)
-
-FIND_PATH(CPLEX_BIN_DIR
-  cplex91.dll
-  PATHS "C:/ILOG/CPLEX91/bin/x86_win32")
-
-IF(CPLEX_FOUND)
-  SET(CPLEX_INCLUDE_DIRS ${CPLEX_INCLUDE_DIR})
-  SET(CPLEX_LIBRARIES ${CPLEX_LIBRARY})
-ENDIF(CPLEX_FOUND)
-
-MARK_AS_ADVANCED(CPLEX_LIBRARY CPLEX_INCLUDE_DIR CPLEX_BIN_DIR)
-
-IF(CPLEX_FOUND)
-  SET(HAVE_LP TRUE)
-  SET(HAVE_MIP TRUE)
-  SET(HAVE_CPLEX TRUE)
-ENDIF(CPLEX_FOUND)
Index: cmake/FindGLPK.cmake
===================================================================
--- cmake/FindGLPK.cmake	(revision 619)
+++ cmake/FindGLPK.cmake	(revision 473)
@@ -14,5 +14,4 @@
 
 IF(GLPK_FOUND)
-  SET(GLPK_INCLUDE_DIRS ${GLPK_INCLUDE_DIR})
   SET(GLPK_LIBRARIES ${GLPK_LIBRARY})
   SET(GLPK_BIN_DIR ${GLPK_ROOT_PATH}/bin)
@@ -20,8 +19,2 @@
 
 MARK_AS_ADVANCED(GLPK_LIBRARY GLPK_INCLUDE_DIR GLPK_BIN_DIR)
-
-IF(GLPK_FOUND)
-  SET(HAVE_LP TRUE)
-  SET(HAVE_MIP TRUE)
-  SET(HAVE_GLPK TRUE)
-ENDIF(GLPK_FOUND)
Index: demo/graph_to_eps_demo.cc
===================================================================
--- demo/graph_to_eps_demo.cc	(revision 440)
+++ demo/graph_to_eps_demo.cc	(revision 612)
@@ -183,5 +183,5 @@
   ListDigraph::NodeMap<Point> hcoords(h);
 
-  int cols=int(sqrt(double(palette.size())));
+  int cols=int(std::sqrt(double(palette.size())));
   for(int i=0;i<int(paletteW.size());i++) {
     Node n=h.addNode();
Index: lemon/CMakeLists.txt
===================================================================
--- lemon/CMakeLists.txt	(revision 621)
+++ lemon/CMakeLists.txt	(revision 549)
@@ -21,5 +21,5 @@
 IF(HAVE_GLPK)
   SET(LEMON_SOURCES ${LEMON_SOURCES} glpk.cc)
-  INCLUDE_DIRECTORIES(${GLPK_INCLUDE_DIRS})
+  INCLUDE_DIRECTORIES(${GLPK_INCLUDE_DIR})
   IF(WIN32)
     INSTALL(FILES ${GLPK_BIN_DIR}/glpk.dll DESTINATION bin)
@@ -28,19 +28,4 @@
   ENDIF(WIN32)
 ENDIF(HAVE_GLPK)
-
-IF(HAVE_CPLEX)
-  SET(LEMON_SOURCES ${LEMON_SOURCES} cplex.cc)
-  INCLUDE_DIRECTORIES(${CPLEX_INCLUDE_DIRS})
-ENDIF(HAVE_CPLEX)
-
-IF(HAVE_CLP)
-  SET(LEMON_SOURCES ${LEMON_SOURCES} clp.cc)
-  INCLUDE_DIRECTORIES(${COIN_INCLUDE_DIRS})
-ENDIF(HAVE_CLP)
-
-IF(HAVE_CBC)
-  SET(LEMON_SOURCES ${LEMON_SOURCES} cbc.cc)
-  INCLUDE_DIRECTORIES(${COIN_INCLUDE_DIRS})
-ENDIF(HAVE_CBC)
 
 ADD_LIBRARY(lemon ${LEMON_SOURCES})
Index: lemon/adaptors.h
===================================================================
--- lemon/adaptors.h	(revision 579)
+++ lemon/adaptors.h	(revision 617)
@@ -110,11 +110,9 @@
     template <typename V>
     class NodeMap : public DGR::template NodeMap<V> {
+      typedef typename DGR::template NodeMap<V> Parent;
+
     public:
-
-      typedef typename DGR::template NodeMap<V> Parent;
-
       explicit NodeMap(const Adaptor& adaptor)
         : Parent(*adaptor._digraph) {}
-
       NodeMap(const Adaptor& adaptor, const V& value)
         : Parent(*adaptor._digraph, value) { }
@@ -135,11 +133,9 @@
     template <typename V>
     class ArcMap : public DGR::template ArcMap<V> {
+      typedef typename DGR::template ArcMap<V> Parent;
+
     public:
-
-      typedef typename DGR::template ArcMap<V> Parent;
-
       explicit ArcMap(const DigraphAdaptorBase<DGR>& adaptor)
         : Parent(*adaptor._digraph) {}
-
       ArcMap(const DigraphAdaptorBase<DGR>& adaptor, const V& value)
         : Parent(*adaptor._digraph, value) {}
@@ -256,6 +252,7 @@
     template <typename V>
     class NodeMap : public GR::template NodeMap<V> {
+      typedef typename GR::template NodeMap<V> Parent;
+
     public:
-      typedef typename GR::template NodeMap<V> Parent;
       explicit NodeMap(const GraphAdaptorBase<GR>& adapter)
         : Parent(*adapter._graph) {}
@@ -278,6 +275,7 @@
     template <typename V>
     class ArcMap : public GR::template ArcMap<V> {
+      typedef typename GR::template ArcMap<V> Parent;
+
     public:
-      typedef typename GR::template ArcMap<V> Parent;
       explicit ArcMap(const GraphAdaptorBase<GR>& adapter)
         : Parent(*adapter._graph) {}
@@ -299,6 +297,7 @@
     template <typename V>
     class EdgeMap : public GR::template EdgeMap<V> {
+      typedef typename GR::template EdgeMap<V> Parent;
+
     public:
-      typedef typename GR::template EdgeMap<V> Parent;
       explicit EdgeMap(const GraphAdaptorBase<GR>& adapter)
         : Parent(*adapter._graph) {}
@@ -322,7 +321,7 @@
   template <typename DGR>
   class ReverseDigraphBase : public DigraphAdaptorBase<DGR> {
+    typedef DigraphAdaptorBase<DGR> Parent;
   public:
     typedef DGR Digraph;
-    typedef DigraphAdaptorBase<DGR> Parent;
   protected:
     ReverseDigraphBase() : Parent() { }
@@ -375,8 +374,8 @@
     public DigraphAdaptorExtender<ReverseDigraphBase<DGR> > {
 #endif
+    typedef DigraphAdaptorExtender<ReverseDigraphBase<DGR> > Parent;
   public:
     /// The type of the adapted digraph.
     typedef DGR Digraph;
-    typedef DigraphAdaptorExtender<ReverseDigraphBase<DGR> > Parent;
   protected:
     ReverseDigraph() { }
@@ -404,4 +403,5 @@
   template <typename DGR, typename NF, typename AF, bool ch = true>
   class SubDigraphBase : public DigraphAdaptorBase<DGR> {
+    typedef DigraphAdaptorBase<DGR> Parent;
   public:
     typedef DGR Digraph;
@@ -410,5 +410,4 @@
 
     typedef SubDigraphBase Adaptor;
-    typedef DigraphAdaptorBase<DGR> Parent;
   protected:
     NF* _node_filter;
@@ -510,8 +509,9 @@
       : public SubMapExtender<SubDigraphBase<DGR, NF, AF, ch>, 
 	      LEMON_SCOPE_FIX(DigraphAdaptorBase<DGR>, NodeMap<V>)> {
+      typedef SubMapExtender<SubDigraphBase<DGR, NF, AF, ch>,
+	LEMON_SCOPE_FIX(DigraphAdaptorBase<DGR>, NodeMap<V>)> Parent;
+
     public:
       typedef V Value;
-      typedef SubMapExtender<SubDigraphBase<DGR, NF, AF, ch>,
-	    LEMON_SCOPE_FIX(DigraphAdaptorBase<DGR>, NodeMap<V>)> Parent;
 
       NodeMap(const SubDigraphBase<DGR, NF, AF, ch>& adaptor)
@@ -536,8 +536,9 @@
       : public SubMapExtender<SubDigraphBase<DGR, NF, AF, ch>,
 	      LEMON_SCOPE_FIX(DigraphAdaptorBase<DGR>, ArcMap<V>)> {
+      typedef SubMapExtender<SubDigraphBase<DGR, NF, AF, ch>,
+        LEMON_SCOPE_FIX(DigraphAdaptorBase<DGR>, ArcMap<V>)> Parent;
+
     public:
       typedef V Value;
-      typedef SubMapExtender<SubDigraphBase<DGR, NF, AF, ch>,
-        LEMON_SCOPE_FIX(DigraphAdaptorBase<DGR>, ArcMap<V>)> Parent;
 
       ArcMap(const SubDigraphBase<DGR, NF, AF, ch>& adaptor)
@@ -563,4 +564,5 @@
   class SubDigraphBase<DGR, NF, AF, false>
     : public DigraphAdaptorBase<DGR> {
+    typedef DigraphAdaptorBase<DGR> Parent;
   public:
     typedef DGR Digraph;
@@ -569,5 +571,4 @@
 
     typedef SubDigraphBase Adaptor;
-    typedef DigraphAdaptorBase<Digraph> Parent;
   protected:
     NF* _node_filter;
@@ -651,8 +652,9 @@
       : public SubMapExtender<SubDigraphBase<DGR, NF, AF, false>,
           LEMON_SCOPE_FIX(DigraphAdaptorBase<DGR>, NodeMap<V>)> {
+      typedef SubMapExtender<SubDigraphBase<DGR, NF, AF, false>, 
+        LEMON_SCOPE_FIX(DigraphAdaptorBase<DGR>, NodeMap<V>)> Parent;
+
     public:
       typedef V Value;
-      typedef SubMapExtender<SubDigraphBase<DGR, NF, AF, false>, 
-        LEMON_SCOPE_FIX(DigraphAdaptorBase<DGR>, NodeMap<V>)> Parent;
 
       NodeMap(const SubDigraphBase<DGR, NF, AF, false>& adaptor)
@@ -677,8 +679,9 @@
       : public SubMapExtender<SubDigraphBase<DGR, NF, AF, false>,
           LEMON_SCOPE_FIX(DigraphAdaptorBase<DGR>, ArcMap<V>)> {
+      typedef SubMapExtender<SubDigraphBase<DGR, NF, AF, false>,
+        LEMON_SCOPE_FIX(DigraphAdaptorBase<DGR>, ArcMap<V>)> Parent;
+
     public:
       typedef V Value;
-      typedef SubMapExtender<SubDigraphBase<DGR, NF, AF, false>,
-          LEMON_SCOPE_FIX(DigraphAdaptorBase<DGR>, ArcMap<V>)> Parent;
 
       ArcMap(const SubDigraphBase<DGR, NF, AF, false>& adaptor)
@@ -864,4 +867,5 @@
   template <typename GR, typename NF, typename EF, bool ch = true>
   class SubGraphBase : public GraphAdaptorBase<GR> {
+    typedef GraphAdaptorBase<GR> Parent;
   public:
     typedef GR Graph;
@@ -870,5 +874,4 @@
 
     typedef SubGraphBase Adaptor;
-    typedef GraphAdaptorBase<GR> Parent;
   protected:
 
@@ -1017,8 +1020,9 @@
       : public SubMapExtender<SubGraphBase<GR, NF, EF, ch>,
           LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, NodeMap<V>)> {
+      typedef SubMapExtender<SubGraphBase<GR, NF, EF, ch>, 
+        LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, NodeMap<V>)> Parent;
+
     public:
       typedef V Value;
-      typedef SubMapExtender<SubGraphBase<GR, NF, EF, ch>, 
-        LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, NodeMap<V>)> Parent;
 
       NodeMap(const SubGraphBase<GR, NF, EF, ch>& adaptor)
@@ -1043,8 +1047,9 @@
       : public SubMapExtender<SubGraphBase<GR, NF, EF, ch>,
           LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, ArcMap<V>)> {
+      typedef SubMapExtender<SubGraphBase<GR, NF, EF, ch>, 
+        LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, ArcMap<V>)> Parent;
+
     public:
       typedef V Value;
-      typedef SubMapExtender<SubGraphBase<GR, NF, EF, ch>, 
-        LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, ArcMap<V>)> Parent;
 
       ArcMap(const SubGraphBase<GR, NF, EF, ch>& adaptor)
@@ -1069,8 +1074,9 @@
       : public SubMapExtender<SubGraphBase<GR, NF, EF, ch>,
         LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, EdgeMap<V>)> {
+      typedef SubMapExtender<SubGraphBase<GR, NF, EF, ch>, 
+        LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, EdgeMap<V>)> Parent;
+
     public:
       typedef V Value;
-      typedef SubMapExtender<SubGraphBase<GR, NF, EF, ch>, 
-        LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, EdgeMap<V>)> Parent;
 
       EdgeMap(const SubGraphBase<GR, NF, EF, ch>& adaptor)
@@ -1097,4 +1103,5 @@
   class SubGraphBase<GR, NF, EF, false>
     : public GraphAdaptorBase<GR> {
+    typedef GraphAdaptorBase<GR> Parent;
   public:
     typedef GR Graph;
@@ -1103,5 +1110,4 @@
 
     typedef SubGraphBase Adaptor;
-    typedef GraphAdaptorBase<GR> Parent;
   protected:
     NF* _node_filter;
@@ -1212,8 +1218,9 @@
       : public SubMapExtender<SubGraphBase<GR, NF, EF, false>,
           LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, NodeMap<V>)> {
+      typedef SubMapExtender<SubGraphBase<GR, NF, EF, false>, 
+        LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, NodeMap<V>)> Parent;
+
     public:
       typedef V Value;
-      typedef SubMapExtender<SubGraphBase<GR, NF, EF, false>, 
-        LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, NodeMap<V>)> Parent;
 
       NodeMap(const SubGraphBase<GR, NF, EF, false>& adaptor)
@@ -1238,8 +1245,9 @@
       : public SubMapExtender<SubGraphBase<GR, NF, EF, false>,
           LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, ArcMap<V>)> {
+      typedef SubMapExtender<SubGraphBase<GR, NF, EF, false>, 
+        LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, ArcMap<V>)> Parent;
+
     public:
       typedef V Value;
-      typedef SubMapExtender<SubGraphBase<GR, NF, EF, false>, 
-        LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, ArcMap<V>)> Parent;
 
       ArcMap(const SubGraphBase<GR, NF, EF, false>& adaptor)
@@ -1264,8 +1272,9 @@
       : public SubMapExtender<SubGraphBase<GR, NF, EF, false>,
         LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, EdgeMap<V>)> {
+      typedef SubMapExtender<SubGraphBase<GR, NF, EF, false>, 
+	LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, EdgeMap<V>)> Parent;
+
     public:
       typedef V Value;
-      typedef SubMapExtender<SubGraphBase<GR, NF, EF, false>, 
-		  LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, EdgeMap<V>)> Parent;
 
       EdgeMap(const SubGraphBase<GR, NF, EF, false>& adaptor)
@@ -1486,12 +1495,12 @@
                      true> > {
 #endif
-  public:
-
-    typedef GR Digraph;
-    typedef NF NodeFilterMap;
-
     typedef DigraphAdaptorExtender<
       SubDigraphBase<GR, NF, ConstMap<typename GR::Arc, Const<bool, true> >, 
                      true> > Parent;
+
+  public:
+
+    typedef GR Digraph;
+    typedef NF NodeFilterMap;
 
     typedef typename Parent::Node Node;
@@ -1549,12 +1558,15 @@
                    true> > {
 
-  public:
-    typedef GR Graph;
-    typedef NF NodeFilterMap;
     typedef GraphAdaptorExtender<
       SubGraphBase<GR, NF, ConstMap<typename GR::Edge, Const<bool, true> >, 
                    true> > Parent;
 
+  public:
+
+    typedef GR Graph;
+    typedef NF NodeFilterMap;
+
     typedef typename Parent::Node Node;
+
   protected:
     ConstMap<typename GR::Edge, Const<bool, true> > const_true_map;
@@ -1630,13 +1642,14 @@
                      AF, false> > {
 #endif
-  public:
+    typedef DigraphAdaptorExtender<
+      SubDigraphBase<DGR, ConstMap<typename DGR::Node, Const<bool, true> >, 
+                     AF, false> > Parent;
+
+  public:
+
     /// The type of the adapted digraph.
     typedef DGR Digraph;
     /// The type of the arc filter map.
     typedef AF ArcFilterMap;
-
-    typedef DigraphAdaptorExtender<
-      SubDigraphBase<DGR, ConstMap<typename DGR::Node, Const<bool, true> >, 
-                     AF, false> > Parent;
 
     typedef typename Parent::Arc Arc;
@@ -1739,13 +1752,14 @@
                    EF, false> > {
 #endif
-  public:
+    typedef GraphAdaptorExtender<
+      SubGraphBase<GR, ConstMap<typename GR::Node, Const<bool, true > >, 
+                   EF, false> > Parent;
+
+  public:
+
     /// The type of the adapted graph.
     typedef GR Graph;
     /// The type of the edge filter map.
     typedef EF EdgeFilterMap;
-
-    typedef GraphAdaptorExtender<
-      SubGraphBase<GR, ConstMap<typename GR::Node, Const<bool, true > >, 
-                   EF, false> > Parent;
 
     typedef typename Parent::Edge Edge;
@@ -2112,8 +2126,8 @@
     template <typename V>
     class NodeMap : public DGR::template NodeMap<V> {
+      typedef typename DGR::template NodeMap<V> Parent;
+
     public:
-
       typedef V Value;
-      typedef typename DGR::template NodeMap<Value> Parent;
 
       explicit NodeMap(const UndirectorBase<DGR>& adaptor)
@@ -2138,9 +2152,9 @@
     template <typename V>
     class ArcMap
-      : public SubMapExtender<UndirectorBase<DGR>, ArcMapBase<V> >
-    {
+      : public SubMapExtender<UndirectorBase<DGR>, ArcMapBase<V> > {
+      typedef SubMapExtender<UndirectorBase<DGR>, ArcMapBase<V> > Parent;
+
     public:
       typedef V Value;
-      typedef SubMapExtender<Adaptor, ArcMapBase<V> > Parent;
 
       explicit ArcMap(const UndirectorBase<DGR>& adaptor)
@@ -2164,8 +2178,8 @@
     template <typename V>
     class EdgeMap : public Digraph::template ArcMap<V> {
+      typedef typename Digraph::template ArcMap<V> Parent;
+
     public:
-
       typedef V Value;
-      typedef typename Digraph::template ArcMap<V> Parent;
 
       explicit EdgeMap(const UndirectorBase<DGR>& adaptor)
@@ -2239,8 +2253,8 @@
     public GraphAdaptorExtender<UndirectorBase<DGR> > {
 #endif
+    typedef GraphAdaptorExtender<UndirectorBase<DGR> > Parent;
   public:
     /// The type of the adapted digraph.
     typedef DGR Digraph;
-    typedef GraphAdaptorExtender<UndirectorBase<DGR> > Parent;
   protected:
     Undirector() { }
@@ -2450,7 +2464,7 @@
     template <typename V>
     class NodeMap : public GR::template NodeMap<V> {
+      typedef typename GR::template NodeMap<V> Parent;
+
     public:
-
-      typedef typename GR::template NodeMap<V> Parent;
 
       explicit NodeMap(const OrienterBase<GR, DM>& adapter)
@@ -2475,7 +2489,7 @@
     template <typename V>
     class ArcMap : public GR::template EdgeMap<V> {
+      typedef typename Graph::template EdgeMap<V> Parent;
+
     public:
-
-      typedef typename Graph::template EdgeMap<V> Parent;
 
       explicit ArcMap(const OrienterBase<GR, DM>& adapter)
@@ -2547,4 +2561,5 @@
     public DigraphAdaptorExtender<OrienterBase<GR, DM> > {
 #endif
+    typedef DigraphAdaptorExtender<OrienterBase<GR, DM> > Parent;
   public:
 
@@ -2554,8 +2569,9 @@
     typedef DM DirectionMap;
 
-    typedef DigraphAdaptorExtender<OrienterBase<GR, DM> > Parent;
     typedef typename Parent::Arc Arc;
+
   protected:
     Orienter() { }
+
   public:
 
@@ -2867,8 +2883,9 @@
   template <typename DGR>
   class SplitNodesBase {
+    typedef DigraphAdaptorBase<const DGR> Parent;
+
   public:
 
     typedef DGR Digraph;
-    typedef DigraphAdaptorBase<const DGR> Parent;
     typedef SplitNodesBase Adaptor;
 
@@ -3229,9 +3246,9 @@
     template <typename V>
     class NodeMap
-      : public SubMapExtender<SplitNodesBase<DGR>, NodeMapBase<V> >
-    {
+      : public SubMapExtender<SplitNodesBase<DGR>, NodeMapBase<V> > {
+      typedef SubMapExtender<SplitNodesBase<DGR>, NodeMapBase<V> > Parent;
+
     public:
       typedef V Value;
-      typedef SubMapExtender<SplitNodesBase<DGR>, NodeMapBase<Value> > Parent;
 
       NodeMap(const SplitNodesBase<DGR>& adaptor)
@@ -3255,9 +3272,9 @@
     template <typename V>
     class ArcMap
-      : public SubMapExtender<SplitNodesBase<DGR>, ArcMapBase<V> >
-    {
+      : public SubMapExtender<SplitNodesBase<DGR>, ArcMapBase<V> > {
+      typedef SubMapExtender<SplitNodesBase<DGR>, ArcMapBase<V> > Parent;
+
     public:
       typedef V Value;
-      typedef SubMapExtender<SplitNodesBase<DGR>, ArcMapBase<Value> > Parent;
 
       ArcMap(const SplitNodesBase<DGR>& adaptor)
@@ -3325,7 +3342,8 @@
     : public DigraphAdaptorExtender<SplitNodesBase<const DGR> > {
 #endif
+    typedef DigraphAdaptorExtender<SplitNodesBase<const DGR> > Parent;
+
   public:
     typedef DGR Digraph;
-    typedef DigraphAdaptorExtender<SplitNodesBase<const DGR> > Parent;
 
     typedef typename DGR::Node DigraphNode;
Index: lemon/bits/array_map.h
===================================================================
--- lemon/bits/array_map.h	(revision 492)
+++ lemon/bits/array_map.h	(revision 617)
@@ -48,5 +48,5 @@
   public:
     // The graph type.
-    typedef _Graph Graph;
+    typedef _Graph GraphType;
     // The item type.
     typedef _Item Item;
@@ -64,11 +64,15 @@
     typedef _Value& Reference;
 
+    // The map type.
+    typedef ArrayMap Map;
+
     // The notifier type.
     typedef typename ItemSetTraits<_Graph, _Item>::ItemNotifier Notifier;
 
+  private:
+  
     // The MapBase of the Map which imlements the core regisitry function.
     typedef typename Notifier::ObserverBase Parent;
 
-  private:
     typedef std::allocator<Value> Allocator;
 
@@ -78,5 +82,5 @@
     //
     // Graph initialized map constructor.
-    explicit ArrayMap(const Graph& graph) {
+    explicit ArrayMap(const GraphType& graph) {
       Parent::attach(graph.notifier(Item()));
       allocate_memory();
@@ -92,5 +96,5 @@
     //
     // It constructs a map and initialize all of the the map.
-    ArrayMap(const Graph& graph, const Value& value) {
+    ArrayMap(const GraphType& graph, const Value& value) {
       Parent::attach(graph.notifier(Item()));
       allocate_memory();
Index: lemon/bits/base_extender.h
===================================================================
--- lemon/bits/base_extender.h	(revision 440)
+++ lemon/bits/base_extender.h	(revision 617)
@@ -39,8 +39,8 @@
   template <typename Base>
   class UndirDigraphExtender : public Base {
+    typedef Base Parent;
 
   public:
 
-    typedef Base Parent;
     typedef typename Parent::Arc Edge;
     typedef typename Parent::Node Node;
@@ -281,6 +281,7 @@
   template <typename Base>
   class BidirBpGraphExtender : public Base {
+    typedef Base Parent;
+
   public:
-    typedef Base Parent;
     typedef BidirBpGraphExtender Digraph;
 
Index: lemon/bits/default_map.h
===================================================================
--- lemon/bits/default_map.h	(revision 535)
+++ lemon/bits/default_map.h	(revision 617)
@@ -154,13 +154,14 @@
   class DefaultMap
     : public DefaultMapSelector<_Graph, _Item, _Value>::Map {
+    typedef typename DefaultMapSelector<_Graph, _Item, _Value>::Map Parent;
+
   public:
-    typedef typename DefaultMapSelector<_Graph, _Item, _Value>::Map Parent;
     typedef DefaultMap<_Graph, _Item, _Value> Map;
-
-    typedef typename Parent::Graph Graph;
+    
+    typedef typename Parent::GraphType GraphType;
     typedef typename Parent::Value Value;
 
-    explicit DefaultMap(const Graph& graph) : Parent(graph) {}
-    DefaultMap(const Graph& graph, const Value& value)
+    explicit DefaultMap(const GraphType& graph) : Parent(graph) {}
+    DefaultMap(const GraphType& graph, const Value& value)
       : Parent(graph, value) {}
 
Index: lemon/bits/edge_set_extender.h
===================================================================
--- lemon/bits/edge_set_extender.h	(revision 559)
+++ lemon/bits/edge_set_extender.h	(revision 617)
@@ -35,7 +35,8 @@
   template <typename Base>
   class ArcSetExtender : public Base {
+    typedef Base Parent;
+
   public:
 
-    typedef Base Parent;
     typedef ArcSetExtender Digraph;
 
@@ -219,8 +220,7 @@
     class ArcMap 
       : public MapExtender<DefaultMap<Digraph, Arc, _Value> > {
-    public:
-      typedef ArcSetExtender Digraph;
       typedef MapExtender<DefaultMap<Digraph, Arc, _Value> > Parent;
 
+    public:
       explicit ArcMap(const Digraph& _g) 
 	: Parent(_g) {}
@@ -275,14 +275,13 @@
   template <typename Base>
   class EdgeSetExtender : public Base {
+    typedef Base Parent;
 
   public:
 
-    typedef Base Parent;
-    typedef EdgeSetExtender Digraph;
+    typedef EdgeSetExtender Graph;
 
     typedef typename Parent::Node Node;
     typedef typename Parent::Arc Arc;
     typedef typename Parent::Edge Edge;
-
 
     int maxId(Node) const {
@@ -351,5 +350,5 @@
 
     class NodeIt : public Node { 
-      const Digraph* digraph;
+      const Graph* graph;
     public:
 
@@ -358,13 +357,13 @@
       NodeIt(Invalid i) : Node(i) { }
 
-      explicit NodeIt(const Digraph& _graph) : digraph(&_graph) {
+      explicit NodeIt(const Graph& _graph) : graph(&_graph) {
 	_graph.first(static_cast<Node&>(*this));
       }
 
-      NodeIt(const Digraph& _graph, const Node& node) 
-	: Node(node), digraph(&_graph) {}
+      NodeIt(const Graph& _graph, const Node& node) 
+	: Node(node), graph(&_graph) {}
 
       NodeIt& operator++() { 
-	digraph->next(*this);
+	graph->next(*this);
 	return *this; 
       }
@@ -374,5 +373,5 @@
 
     class ArcIt : public Arc { 
-      const Digraph* digraph;
+      const Graph* graph;
     public:
 
@@ -381,13 +380,13 @@
       ArcIt(Invalid i) : Arc(i) { }
 
-      explicit ArcIt(const Digraph& _graph) : digraph(&_graph) {
+      explicit ArcIt(const Graph& _graph) : graph(&_graph) {
 	_graph.first(static_cast<Arc&>(*this));
       }
 
-      ArcIt(const Digraph& _graph, const Arc& e) : 
-	Arc(e), digraph(&_graph) { }
+      ArcIt(const Graph& _graph, const Arc& e) : 
+	Arc(e), graph(&_graph) { }
 
       ArcIt& operator++() { 
-	digraph->next(*this);
+	graph->next(*this);
 	return *this; 
       }
@@ -397,5 +396,5 @@
 
     class OutArcIt : public Arc { 
-      const Digraph* digraph;
+      const Graph* graph;
     public:
 
@@ -404,14 +403,14 @@
       OutArcIt(Invalid i) : Arc(i) { }
 
-      OutArcIt(const Digraph& _graph, const Node& node) 
-	: digraph(&_graph) {
+      OutArcIt(const Graph& _graph, const Node& node) 
+	: graph(&_graph) {
 	_graph.firstOut(*this, node);
       }
 
-      OutArcIt(const Digraph& _graph, const Arc& arc) 
-	: Arc(arc), digraph(&_graph) {}
+      OutArcIt(const Graph& _graph, const Arc& arc) 
+	: Arc(arc), graph(&_graph) {}
 
       OutArcIt& operator++() { 
-	digraph->nextOut(*this);
+	graph->nextOut(*this);
 	return *this; 
       }
@@ -421,5 +420,5 @@
 
     class InArcIt : public Arc { 
-      const Digraph* digraph;
+      const Graph* graph;
     public:
 
@@ -428,14 +427,14 @@
       InArcIt(Invalid i) : Arc(i) { }
 
-      InArcIt(const Digraph& _graph, const Node& node) 
-	: digraph(&_graph) {
+      InArcIt(const Graph& _graph, const Node& node) 
+	: graph(&_graph) {
 	_graph.firstIn(*this, node);
       }
 
-      InArcIt(const Digraph& _graph, const Arc& arc) : 
-	Arc(arc), digraph(&_graph) {}
+      InArcIt(const Graph& _graph, const Arc& arc) : 
+	Arc(arc), graph(&_graph) {}
 
       InArcIt& operator++() { 
-	digraph->nextIn(*this);
+	graph->nextIn(*this);
 	return *this; 
       }
@@ -445,5 +444,5 @@
 
     class EdgeIt : public Parent::Edge { 
-      const Digraph* digraph;
+      const Graph* graph;
     public:
 
@@ -452,13 +451,13 @@
       EdgeIt(Invalid i) : Edge(i) { }
 
-      explicit EdgeIt(const Digraph& _graph) : digraph(&_graph) {
+      explicit EdgeIt(const Graph& _graph) : graph(&_graph) {
 	_graph.first(static_cast<Edge&>(*this));
       }
 
-      EdgeIt(const Digraph& _graph, const Edge& e) : 
-	Edge(e), digraph(&_graph) { }
+      EdgeIt(const Graph& _graph, const Edge& e) : 
+	Edge(e), graph(&_graph) { }
 
       EdgeIt& operator++() { 
-	digraph->next(*this);
+	graph->next(*this);
 	return *this; 
       }
@@ -468,5 +467,5 @@
     class IncEdgeIt : public Parent::Edge {
       friend class EdgeSetExtender;
-      const Digraph* digraph;
+      const Graph* graph;
       bool direction;
     public:
@@ -476,15 +475,15 @@
       IncEdgeIt(Invalid i) : Edge(i), direction(false) { }
 
-      IncEdgeIt(const Digraph& _graph, const Node &n) : digraph(&_graph) {
+      IncEdgeIt(const Graph& _graph, const Node &n) : graph(&_graph) {
 	_graph.firstInc(*this, direction, n);
       }
 
-      IncEdgeIt(const Digraph& _graph, const Edge &ue, const Node &n)
-	: digraph(&_graph), Edge(ue) {
+      IncEdgeIt(const Graph& _graph, const Edge &ue, const Node &n)
+	: graph(&_graph), Edge(ue) {
 	direction = (_graph.source(ue) == n);
       }
 
       IncEdgeIt& operator++() {
-	digraph->nextInc(*this, direction);
+	graph->nextInc(*this, direction);
 	return *this; 
       }
@@ -535,12 +534,11 @@
     template <typename _Value>
     class ArcMap 
-      : public MapExtender<DefaultMap<Digraph, Arc, _Value> > {
-    public:
-      typedef EdgeSetExtender Digraph;
-      typedef MapExtender<DefaultMap<Digraph, Arc, _Value> > Parent;
-
-      ArcMap(const Digraph& _g) 
+      : public MapExtender<DefaultMap<Graph, Arc, _Value> > {
+      typedef MapExtender<DefaultMap<Graph, Arc, _Value> > Parent;
+
+    public:
+      ArcMap(const Graph& _g) 
 	: Parent(_g) {}
-      ArcMap(const Digraph& _g, const _Value& _v) 
+      ArcMap(const Graph& _g, const _Value& _v) 
 	: Parent(_g, _v) {}
 
@@ -560,13 +558,12 @@
     template <typename _Value>
     class EdgeMap 
-      : public MapExtender<DefaultMap<Digraph, Edge, _Value> > {
-    public:
-      typedef EdgeSetExtender Digraph;
-      typedef MapExtender<DefaultMap<Digraph, Edge, _Value> > Parent;
-
-      EdgeMap(const Digraph& _g) 
+      : public MapExtender<DefaultMap<Graph, Edge, _Value> > {
+      typedef MapExtender<DefaultMap<Graph, Edge, _Value> > Parent;
+
+    public:
+      EdgeMap(const Graph& _g) 
 	: Parent(_g) {}
 
-      EdgeMap(const Digraph& _g, const _Value& _v) 
+      EdgeMap(const Graph& _g, const _Value& _v) 
 	: Parent(_g, _v) {}
 
Index: lemon/bits/graph_adaptor_extender.h
===================================================================
--- lemon/bits/graph_adaptor_extender.h	(revision 580)
+++ lemon/bits/graph_adaptor_extender.h	(revision 617)
@@ -27,7 +27,8 @@
   template <typename _Digraph>
   class DigraphAdaptorExtender : public _Digraph {
+    typedef _Digraph Parent;
+
   public:
 
-    typedef _Digraph Parent;
     typedef _Digraph Digraph;
     typedef DigraphAdaptorExtender Adaptor;
@@ -174,7 +175,8 @@
   template <typename _Graph>
   class GraphAdaptorExtender : public _Graph {
+    typedef _Graph Parent;
+
   public:
 
-    typedef _Graph Parent;
     typedef _Graph Graph;
     typedef GraphAdaptorExtender Adaptor;
Index: lemon/bits/graph_extender.h
===================================================================
--- lemon/bits/graph_extender.h	(revision 440)
+++ lemon/bits/graph_extender.h	(revision 617)
@@ -38,7 +38,8 @@
   template <typename Base>
   class DigraphExtender : public Base {
+    typedef Base Parent;
+
   public:
 
-    typedef Base Parent;
     typedef DigraphExtender Digraph;
 
@@ -219,8 +220,7 @@
     class NodeMap
       : public MapExtender<DefaultMap<Digraph, Node, _Value> > {
-    public:
-      typedef DigraphExtender Digraph;
       typedef MapExtender<DefaultMap<Digraph, Node, _Value> > Parent;
 
+    public:
       explicit NodeMap(const Digraph& digraph)
         : Parent(digraph) {}
@@ -244,8 +244,7 @@
     class ArcMap
       : public MapExtender<DefaultMap<Digraph, Arc, _Value> > {
-    public:
-      typedef DigraphExtender Digraph;
       typedef MapExtender<DefaultMap<Digraph, Arc, _Value> > Parent;
 
+    public:
       explicit ArcMap(const Digraph& digraph)
         : Parent(digraph) {}
@@ -331,7 +330,8 @@
   template <typename Base>
   class GraphExtender : public Base {
+    typedef Base Parent;
+
   public:
 
-    typedef Base Parent;
     typedef GraphExtender Graph;
 
@@ -602,8 +602,7 @@
     class NodeMap
       : public MapExtender<DefaultMap<Graph, Node, _Value> > {
-    public:
-      typedef GraphExtender Graph;
       typedef MapExtender<DefaultMap<Graph, Node, _Value> > Parent;
 
+    public:
       NodeMap(const Graph& graph)
         : Parent(graph) {}
@@ -627,8 +626,7 @@
     class ArcMap
       : public MapExtender<DefaultMap<Graph, Arc, _Value> > {
-    public:
-      typedef GraphExtender Graph;
       typedef MapExtender<DefaultMap<Graph, Arc, _Value> > Parent;
 
+    public:
       ArcMap(const Graph& graph)
         : Parent(graph) {}
@@ -652,8 +650,7 @@
     class EdgeMap
       : public MapExtender<DefaultMap<Graph, Edge, _Value> > {
-    public:
-      typedef GraphExtender Graph;
       typedef MapExtender<DefaultMap<Graph, Edge, _Value> > Parent;
 
+    public:
       EdgeMap(const Graph& graph)
         : Parent(graph) {}
Index: lemon/bits/map_extender.h
===================================================================
--- lemon/bits/map_extender.h	(revision 580)
+++ lemon/bits/map_extender.h	(revision 617)
@@ -37,11 +37,10 @@
   template <typename _Map>
   class MapExtender : public _Map {
-  public:
-
     typedef _Map Parent;
+    typedef typename Parent::GraphType GraphType;
+
+  public:
+
     typedef MapExtender Map;
-
-
-    typedef typename Parent::Graph Graph;
     typedef typename Parent::Key Item;
 
@@ -59,8 +58,8 @@
   public:
 
-    MapExtender(const Graph& graph)
+    MapExtender(const GraphType& graph)
       : Parent(graph) {}
 
-    MapExtender(const Graph& graph, const Value& value)
+    MapExtender(const GraphType& graph, const Value& value)
       : Parent(graph, value) {}
 
@@ -78,7 +77,8 @@
   public:
     class MapIt : public Item {
-    public:
-
-      typedef Item Parent;
+      typedef Item Parent;
+
+    public:
+
       typedef typename Map::Value Value;
 
@@ -117,7 +117,7 @@
 
     class ConstMapIt : public Item {
-    public:
-
-      typedef Item Parent;
+      typedef Item Parent;
+
+    public:
 
       typedef typename Map::Value Value;
@@ -148,7 +148,7 @@
 
     class ItemIt : public Item {
-    public:
-
-      typedef Item Parent;
+      typedef Item Parent;
+
+    public:
 
       ItemIt() {}
@@ -179,11 +179,10 @@
   template <typename _Graph, typename _Map>
   class SubMapExtender : public _Map {
-  public:
-
     typedef _Map Parent;
+    typedef _Graph GraphType;
+
+  public:
+
     typedef SubMapExtender Map;
-
-    typedef _Graph Graph;
-
     typedef typename Parent::Key Item;
 
@@ -201,8 +200,8 @@
   public:
 
-    SubMapExtender(const Graph& _graph)
+    SubMapExtender(const GraphType& _graph)
       : Parent(_graph), graph(_graph) {}
 
-    SubMapExtender(const Graph& _graph, const Value& _value)
+    SubMapExtender(const GraphType& _graph, const Value& _value)
       : Parent(_graph, _value), graph(_graph) {}
 
@@ -224,7 +223,7 @@
   public:
     class MapIt : public Item {
-    public:
-
-      typedef Item Parent;
+      typedef Item Parent;
+
+    public:
       typedef typename Map::Value Value;
 
@@ -263,7 +262,7 @@
 
     class ConstMapIt : public Item {
-    public:
-
-      typedef Item Parent;
+      typedef Item Parent;
+
+    public:
 
       typedef typename Map::Value Value;
@@ -294,7 +293,7 @@
 
     class ItemIt : public Item {
-    public:
-
-      typedef Item Parent;
+      typedef Item Parent;
+
+    public:
 
       ItemIt() {}
@@ -321,5 +320,5 @@
   private:
 
-    const Graph& graph;
+    const GraphType& graph;
 
   };
Index: lemon/bits/traits.h
===================================================================
--- lemon/bits/traits.h	(revision 440)
+++ lemon/bits/traits.h	(revision 616)
@@ -30,40 +30,42 @@
   struct InvalidType {};
 
-  template <typename _Graph, typename _Item>
+  template <typename GR, typename _Item>
   class ItemSetTraits {};
 
 
-  template <typename Graph, typename Enable = void>
+  template <typename GR, typename Enable = void>
   struct NodeNotifierIndicator {
     typedef InvalidType Type;
   };
-  template <typename Graph>
+  template <typename GR>
   struct NodeNotifierIndicator<
-    Graph,
-    typename enable_if<typename Graph::NodeNotifier::Notifier, void>::type
-  > {
-    typedef typename Graph::NodeNotifier Type;
-  };
-
-  template <typename _Graph>
-  class ItemSetTraits<_Graph, typename _Graph::Node> {
+    GR,
+    typename enable_if<typename GR::NodeNotifier::Notifier, void>::type
+  > {
+    typedef typename GR::NodeNotifier Type;
+  };
+
+  template <typename GR>
+  class ItemSetTraits<GR, typename GR::Node> {
   public:
 
-    typedef _Graph Graph;
-
-    typedef typename Graph::Node Item;
-    typedef typename Graph::NodeIt ItemIt;
-
-    typedef typename NodeNotifierIndicator<Graph>::Type ItemNotifier;
-
-    template <typename _Value>
-    class Map : public Graph::template NodeMap<_Value> {
+    typedef GR Graph;
+    typedef GR Digraph;
+
+    typedef typename GR::Node Item;
+    typedef typename GR::NodeIt ItemIt;
+
+    typedef typename NodeNotifierIndicator<GR>::Type ItemNotifier;
+
+    template <typename V>
+    class Map : public GR::template NodeMap<V> {
+      typedef typename GR::template NodeMap<V> Parent;
+
     public:
-      typedef typename Graph::template NodeMap<_Value> Parent;
-      typedef typename Graph::template NodeMap<_Value> Type;
+      typedef typename GR::template NodeMap<V> Type;
       typedef typename Parent::Value Value;
 
-      Map(const Graph& _digraph) : Parent(_digraph) {}
-      Map(const Graph& _digraph, const Value& _value)
+      Map(const GR& _digraph) : Parent(_digraph) {}
+      Map(const GR& _digraph, const Value& _value)
         : Parent(_digraph, _value) {}
 
@@ -72,36 +74,38 @@
   };
 
-  template <typename Graph, typename Enable = void>
+  template <typename GR, typename Enable = void>
   struct ArcNotifierIndicator {
     typedef InvalidType Type;
   };
-  template <typename Graph>
+  template <typename GR>
   struct ArcNotifierIndicator<
-    Graph,
-    typename enable_if<typename Graph::ArcNotifier::Notifier, void>::type
-  > {
-    typedef typename Graph::ArcNotifier Type;
-  };
-
-  template <typename _Graph>
-  class ItemSetTraits<_Graph, typename _Graph::Arc> {
+    GR,
+    typename enable_if<typename GR::ArcNotifier::Notifier, void>::type
+  > {
+    typedef typename GR::ArcNotifier Type;
+  };
+
+  template <typename GR>
+  class ItemSetTraits<GR, typename GR::Arc> {
   public:
 
-    typedef _Graph Graph;
-
-    typedef typename Graph::Arc Item;
-    typedef typename Graph::ArcIt ItemIt;
-
-    typedef typename ArcNotifierIndicator<Graph>::Type ItemNotifier;
-
-    template <typename _Value>
-    class Map : public Graph::template ArcMap<_Value> {
+    typedef GR Graph;
+    typedef GR Digraph;
+
+    typedef typename GR::Arc Item;
+    typedef typename GR::ArcIt ItemIt;
+
+    typedef typename ArcNotifierIndicator<GR>::Type ItemNotifier;
+
+    template <typename V>
+    class Map : public GR::template ArcMap<V> {
+      typedef typename GR::template ArcMap<V> Parent;
+
     public:
-      typedef typename Graph::template ArcMap<_Value> Parent;
-      typedef typename Graph::template ArcMap<_Value> Type;
+      typedef typename GR::template ArcMap<V> Type;
       typedef typename Parent::Value Value;
 
-      Map(const Graph& _digraph) : Parent(_digraph) {}
-      Map(const Graph& _digraph, const Value& _value)
+      Map(const GR& _digraph) : Parent(_digraph) {}
+      Map(const GR& _digraph, const Value& _value)
         : Parent(_digraph, _value) {}
     };
@@ -109,36 +113,38 @@
   };
 
-  template <typename Graph, typename Enable = void>
+  template <typename GR, typename Enable = void>
   struct EdgeNotifierIndicator {
     typedef InvalidType Type;
   };
-  template <typename Graph>
+  template <typename GR>
   struct EdgeNotifierIndicator<
-    Graph,
-    typename enable_if<typename Graph::EdgeNotifier::Notifier, void>::type
-  > {
-    typedef typename Graph::EdgeNotifier Type;
-  };
-
-  template <typename _Graph>
-  class ItemSetTraits<_Graph, typename _Graph::Edge> {
+    GR,
+    typename enable_if<typename GR::EdgeNotifier::Notifier, void>::type
+  > {
+    typedef typename GR::EdgeNotifier Type;
+  };
+
+  template <typename GR>
+  class ItemSetTraits<GR, typename GR::Edge> {
   public:
 
-    typedef _Graph Graph;
-
-    typedef typename Graph::Edge Item;
-    typedef typename Graph::EdgeIt ItemIt;
-
-    typedef typename EdgeNotifierIndicator<Graph>::Type ItemNotifier;
-
-    template <typename _Value>
-    class Map : public Graph::template EdgeMap<_Value> {
+    typedef GR Graph;
+    typedef GR Digraph;
+
+    typedef typename GR::Edge Item;
+    typedef typename GR::EdgeIt ItemIt;
+
+    typedef typename EdgeNotifierIndicator<GR>::Type ItemNotifier;
+
+    template <typename V>
+    class Map : public GR::template EdgeMap<V> {
+      typedef typename GR::template EdgeMap<V> Parent;
+
     public:
-      typedef typename Graph::template EdgeMap<_Value> Parent;
-      typedef typename Graph::template EdgeMap<_Value> Type;
+      typedef typename GR::template EdgeMap<V> Type;
       typedef typename Parent::Value Value;
 
-      Map(const Graph& _digraph) : Parent(_digraph) {}
-      Map(const Graph& _digraph, const Value& _value)
+      Map(const GR& _digraph) : Parent(_digraph) {}
+      Map(const GR& _digraph, const Value& _value)
         : Parent(_digraph, _value) {}
     };
@@ -205,91 +211,91 @@
   // Indicators for the tags
 
-  template <typename Graph, typename Enable = void>
+  template <typename GR, typename Enable = void>
   struct NodeNumTagIndicator {
     static const bool value = false;
   };
 
-  template <typename Graph>
+  template <typename GR>
   struct NodeNumTagIndicator<
-    Graph,
-    typename enable_if<typename Graph::NodeNumTag, void>::type
-  > {
-    static const bool value = true;
-  };
-
-  template <typename Graph, typename Enable = void>
+    GR,
+    typename enable_if<typename GR::NodeNumTag, void>::type
+  > {
+    static const bool value = true;
+  };
+
+  template <typename GR, typename Enable = void>
   struct ArcNumTagIndicator {
     static const bool value = false;
   };
 
-  template <typename Graph>
+  template <typename GR>
   struct ArcNumTagIndicator<
-    Graph,
-    typename enable_if<typename Graph::ArcNumTag, void>::type
-  > {
-    static const bool value = true;
-  };
-
-  template <typename Graph, typename Enable = void>
+    GR,
+    typename enable_if<typename GR::ArcNumTag, void>::type
+  > {
+    static const bool value = true;
+  };
+
+  template <typename GR, typename Enable = void>
   struct EdgeNumTagIndicator {
     static const bool value = false;
   };
 
-  template <typename Graph>
+  template <typename GR>
   struct EdgeNumTagIndicator<
-    Graph,
-    typename enable_if<typename Graph::EdgeNumTag, void>::type
-  > {
-    static const bool value = true;
-  };
-
-  template <typename Graph, typename Enable = void>
+    GR,
+    typename enable_if<typename GR::EdgeNumTag, void>::type
+  > {
+    static const bool value = true;
+  };
+
+  template <typename GR, typename Enable = void>
   struct FindArcTagIndicator {
     static const bool value = false;
   };
 
-  template <typename Graph>
+  template <typename GR>
   struct FindArcTagIndicator<
-    Graph,
-    typename enable_if<typename Graph::FindArcTag, void>::type
-  > {
-    static const bool value = true;
-  };
-
-  template <typename Graph, typename Enable = void>
+    GR,
+    typename enable_if<typename GR::FindArcTag, void>::type
+  > {
+    static const bool value = true;
+  };
+
+  template <typename GR, typename Enable = void>
   struct FindEdgeTagIndicator {
     static const bool value = false;
   };
 
-  template <typename Graph>
+  template <typename GR>
   struct FindEdgeTagIndicator<
-    Graph,
-    typename enable_if<typename Graph::FindEdgeTag, void>::type
-  > {
-    static const bool value = true;
-  };
-
-  template <typename Graph, typename Enable = void>
+    GR,
+    typename enable_if<typename GR::FindEdgeTag, void>::type
+  > {
+    static const bool value = true;
+  };
+
+  template <typename GR, typename Enable = void>
   struct UndirectedTagIndicator {
     static const bool value = false;
   };
 
-  template <typename Graph>
+  template <typename GR>
   struct UndirectedTagIndicator<
-    Graph,
-    typename enable_if<typename Graph::UndirectedTag, void>::type
-  > {
-    static const bool value = true;
-  };
-
-  template <typename Graph, typename Enable = void>
+    GR,
+    typename enable_if<typename GR::UndirectedTag, void>::type
+  > {
+    static const bool value = true;
+  };
+
+  template <typename GR, typename Enable = void>
   struct BuildTagIndicator {
     static const bool value = false;
   };
 
-  template <typename Graph>
+  template <typename GR>
   struct BuildTagIndicator<
-    Graph,
-    typename enable_if<typename Graph::BuildTag, void>::type
+    GR,
+    typename enable_if<typename GR::BuildTag, void>::type
   > {
     static const bool value = true;
Index: lemon/bits/vector_map.h
===================================================================
--- lemon/bits/vector_map.h	(revision 492)
+++ lemon/bits/vector_map.h	(revision 617)
@@ -57,5 +57,5 @@
 
     // The graph type of the map.
-    typedef _Graph Graph;
+    typedef _Graph GraphType;
     // The item type of the map.
     typedef _Item Item;
@@ -73,6 +73,4 @@
     // The map type.
     typedef VectorMap Map;
-    // The base class of the map.
-    typedef typename Notifier::ObserverBase Parent;
 
     // The reference type of the map;
@@ -81,4 +79,10 @@
     typedef typename Container::const_reference ConstReference;
 
+  private:
+
+    // The base class of the map.
+    typedef typename Notifier::ObserverBase Parent;
+
+  public:
 
     // \brief Constructor to attach the new map into the notifier.
@@ -86,5 +90,5 @@
     // It constructs a map and attachs it into the notifier.
     // It adds all the items of the graph to the map.
-    VectorMap(const Graph& graph) {
+    VectorMap(const GraphType& graph) {
       Parent::attach(graph.notifier(Item()));
       container.resize(Parent::notifier()->maxId() + 1);
@@ -95,5 +99,5 @@
     // It constructs a map uses a given value to initialize the map.
     // It adds all the items of the graph to the map.
-    VectorMap(const Graph& graph, const Value& value) {
+    VectorMap(const GraphType& graph, const Value& value) {
       Parent::attach(graph.notifier(Item()));
       container.resize(Parent::notifier()->maxId() + 1, value);
Index: lemon/circulation.h
===================================================================
--- lemon/circulation.h	(revision 611)
+++ lemon/circulation.h	(revision 622)
@@ -22,4 +22,5 @@
 #include <lemon/tolerance.h>
 #include <lemon/elevator.h>
+#include <limits>
 
 ///\ingroup max_flow
@@ -120,7 +121,7 @@
 
      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$ denote the lower and
-     upper bounds on the arcs, for which \f$0 \leq lower(uv) \leq upper(uv)\f$
+     Let \f$G=(V,A)\f$ be a digraph, \f$lower: A\rightarrow\mathbf{R}\f$
+     \f$upper: A\rightarrow\mathbf{R}\cup\{\infty\}\f$ denote the lower and
+     upper bounds on the arcs, for which \f$lower(uv) \leq upper(uv)\f$
      holds for all \f$uv\in A\f$, and \f$sup: V\rightarrow\mathbf{R}\f$
      denotes the signed supply values of the nodes.
@@ -128,5 +129,5 @@
      supply, if \f$sup(u)<0\f$, then \f$u\f$ is a demand node with
      \f$-sup(u)\f$ demand.
-     A feasible circulation is an \f$f: A\rightarrow\mathbf{R}^+_0\f$
+     A feasible circulation is an \f$f: A\rightarrow\mathbf{R}\f$
      solution of the following problem.
 
@@ -151,4 +152,8 @@
      the direction of the arcs and taking the negative of the supply values
      (e.g. using \ref ReverseDigraph and \ref NegMap adaptors).
+
+     This algorithm either calculates a feasible circulation, or provides
+     a \ref barrier() "barrier", which prooves that a feasible soultion
+     cannot exist.
 
      Note that this algorithm also provides a feasible solution for the
@@ -338,4 +343,11 @@
   private:
 
+    bool checkBoundMaps() {
+      for (ArcIt e(_g);e!=INVALID;++e) {
+        if (_tol.less((*_up)[e], (*_lo)[e])) return false;
+      }
+      return true;
+    }
+
     void createStructures() {
       _node_num = _el = countNodes(_g);
@@ -381,5 +393,5 @@
     /// Sets the upper bound (capacity) map.
     /// \return <tt>(*this)</tt>
-    Circulation& upperMap(const LowerMap& map) {
+    Circulation& upperMap(const UpperMap& map) {
       _up = &map;
       return *this;
@@ -468,4 +480,7 @@
     void init()
     {
+      LEMON_DEBUG(checkBoundMaps(),
+        "Upper bounds must be greater or equal to the lower bounds");
+
       createStructures();
 
@@ -497,4 +512,7 @@
     void greedyInit()
     {
+      LEMON_DEBUG(checkBoundMaps(),
+        "Upper bounds must be greater or equal to the lower bounds");
+
       createStructures();
 
@@ -504,9 +522,9 @@
 
       for (ArcIt e(_g);e!=INVALID;++e) {
-        if (!_tol.positive((*_excess)[_g.target(e)] + (*_up)[e])) {
+        if (!_tol.less(-(*_excess)[_g.target(e)], (*_up)[e])) {
           _flow->set(e, (*_up)[e]);
           (*_excess)[_g.target(e)] += (*_up)[e];
           (*_excess)[_g.source(e)] -= (*_up)[e];
-        } else if (_tol.positive((*_excess)[_g.target(e)] + (*_lo)[e])) {
+        } else if (_tol.less(-(*_excess)[_g.target(e)], (*_lo)[e])) {
           _flow->set(e, (*_lo)[e]);
           (*_excess)[_g.target(e)] += (*_lo)[e];
@@ -749,4 +767,7 @@
     {
       Flow delta=0;
+      Flow inf_cap = std::numeric_limits<Flow>::has_infinity ?
+        std::numeric_limits<Flow>::infinity() :
+        std::numeric_limits<Flow>::max();
       for(NodeIt n(_g);n!=INVALID;++n)
         if(barrier(n))
@@ -756,5 +777,8 @@
           Node s=_g.source(e);
           Node t=_g.target(e);
-          if(barrier(s)&&!barrier(t)) delta+=(*_up)[e];
+          if(barrier(s)&&!barrier(t)) {
+            if (_tol.less(inf_cap - (*_up)[e], delta)) return false;
+            delta+=(*_up)[e];
+          }
           else if(barrier(t)&&!barrier(s)) delta-=(*_lo)[e];
         }
Index: lemon/concepts/graph_components.h
===================================================================
--- lemon/concepts/graph_components.h	(revision 584)
+++ lemon/concepts/graph_components.h	(revision 617)
@@ -181,4 +181,7 @@
     class BaseGraphComponent : public BaseDigraphComponent {
     public:
+
+      typedef BaseGraphComponent Graph;
+
       typedef BaseDigraphComponent::Node Node;
       typedef BaseDigraphComponent::Arc Arc;
@@ -190,7 +193,7 @@
       /// represented by two opposite directed arcs.
       class Edge : public GraphItem<'e'> {
+        typedef GraphItem<'e'> Parent;
+
       public:
-        typedef GraphItem<'e'> Parent;
-
         /// \brief Default constructor.
         ///
@@ -992,10 +995,8 @@
     template <typename GR, typename K, typename V>
     class GraphMap : public ReferenceMap<K, V, V&, const V&> {
-    public:
-
-      typedef ReadWriteMap<K, V> Parent;
-
-      /// The graph type of the map.
-      typedef GR Graph;
+      typedef ReferenceMap<K, V, V&, const V&> Parent;
+
+    public:
+
       /// The key type of the map.
       typedef K Key;
@@ -1013,9 +1014,9 @@
       ///
       /// Construct a new map for the graph.
-      explicit GraphMap(const Graph&) {}
+      explicit GraphMap(const GR&) {}
       /// \brief Construct a new map with default value.
       ///
       /// Construct a new map for the graph and initalize the values.
-      GraphMap(const Graph&, const Value&) {}
+      GraphMap(const GR&, const Value&) {}
 
     private:
@@ -1058,5 +1059,5 @@
 
         const _Map &m;
-        const Graph &g;
+        const GR &g;
         const typename GraphMap::Value &t;
       };
@@ -1086,7 +1087,7 @@
       template <typename V>
       class NodeMap : public GraphMap<MappableDigraphComponent, Node, V> {
+        typedef GraphMap<MappableDigraphComponent, Node, V> Parent;
+
       public:
-        typedef GraphMap<MappableDigraphComponent, Node, V> Parent;
-
         /// \brief Construct a new map.
         ///
@@ -1124,7 +1125,7 @@
       template <typename V>
       class ArcMap : public GraphMap<MappableDigraphComponent, Arc, V> {
+        typedef GraphMap<MappableDigraphComponent, Arc, V> Parent;
+
       public:
-        typedef GraphMap<MappableDigraphComponent, Arc, V> Parent;
-
         /// \brief Construct a new map.
         ///
@@ -1222,7 +1223,7 @@
       template <typename V>
       class EdgeMap : public GraphMap<MappableGraphComponent, Edge, V> {
+        typedef GraphMap<MappableGraphComponent, Edge, V> Parent;
+
       public:
-        typedef GraphMap<MappableGraphComponent, Edge, V> Parent;
-
         /// \brief Construct a new map.
         ///
Index: lemon/config.h.cmake
===================================================================
--- lemon/config.h.cmake	(revision 621)
+++ lemon/config.h.cmake	(revision 517)
@@ -3,5 +3,2 @@
 #cmakedefine HAVE_MIP 1
 #cmakedefine HAVE_GLPK 1
-#cmakedefine HAVE_CPLEX 1
-#cmakedefine HAVE_CLP 1
-#cmakedefine HAVE_CBC 1
Index: lemon/core.h
===================================================================
--- lemon/core.h	(revision 581)
+++ lemon/core.h	(revision 617)
@@ -1037,11 +1037,10 @@
   template <typename GR>
   class ConArcIt : public GR::Arc {
+    typedef typename GR::Arc Parent;
+
   public:
 
-    typedef GR Graph;
-    typedef typename Graph::Arc Parent;
-
-    typedef typename Graph::Arc Arc;
-    typedef typename Graph::Node Node;
+    typedef typename GR::Arc Arc;
+    typedef typename GR::Node Node;
 
     /// \brief Constructor.
@@ -1049,5 +1048,5 @@
     /// Construct a new ConArcIt iterating on the arcs that
     /// connects nodes \c u and \c v.
-    ConArcIt(const Graph& g, Node u, Node v) : _graph(g) {
+    ConArcIt(const GR& g, Node u, Node v) : _graph(g) {
       Parent::operator=(findArc(_graph, u, v));
     }
@@ -1056,5 +1055,5 @@
     ///
     /// Construct a new ConArcIt that continues the iterating from arc \c a.
-    ConArcIt(const Graph& g, Arc a) : Parent(a), _graph(g) {}
+    ConArcIt(const GR& g, Arc a) : Parent(a), _graph(g) {}
 
     /// \brief Increment operator.
@@ -1067,5 +1066,5 @@
     }
   private:
-    const Graph& _graph;
+    const GR& _graph;
   };
 
@@ -1160,11 +1159,10 @@
   template <typename GR>
   class ConEdgeIt : public GR::Edge {
+    typedef typename GR::Edge Parent;
+
   public:
 
-    typedef GR Graph;
-    typedef typename Graph::Edge Parent;
-
-    typedef typename Graph::Edge Edge;
-    typedef typename Graph::Node Node;
+    typedef typename GR::Edge Edge;
+    typedef typename GR::Node Node;
 
     /// \brief Constructor.
@@ -1172,5 +1170,5 @@
     /// Construct a new ConEdgeIt iterating on the edges that
     /// connects nodes \c u and \c v.
-    ConEdgeIt(const Graph& g, Node u, Node v) : _graph(g), _u(u), _v(v) {
+    ConEdgeIt(const GR& g, Node u, Node v) : _graph(g), _u(u), _v(v) {
       Parent::operator=(findEdge(_graph, _u, _v));
     }
@@ -1179,5 +1177,5 @@
     ///
     /// Construct a new ConEdgeIt that continues iterating from edge \c e.
-    ConEdgeIt(const Graph& g, Edge e) : Parent(e), _graph(g) {}
+    ConEdgeIt(const GR& g, Edge e) : Parent(e), _graph(g) {}
 
     /// \brief Increment operator.
@@ -1189,5 +1187,5 @@
     }
   private:
-    const Graph& _graph;
+    const GR& _graph;
     Node _u, _v;
   };
@@ -1220,9 +1218,12 @@
     : protected ItemSetTraits<GR, typename GR::Arc>::ItemNotifier::ObserverBase
   {
-  public:
     typedef typename ItemSetTraits<GR, typename GR::Arc>
     ::ItemNotifier::ObserverBase Parent;
 
     TEMPLATE_DIGRAPH_TYPEDEFS(GR);
+
+  public:
+
+    /// The Digraph type
     typedef GR Digraph;
 
@@ -1230,7 +1231,7 @@
 
     class AutoNodeMap : public ItemSetTraits<GR, Node>::template Map<Arc>::Type {
+      typedef typename ItemSetTraits<GR, Node>::template Map<Arc>::Type Parent;
+
     public:
-
-      typedef typename ItemSetTraits<GR, Node>::template Map<Arc>::Type Parent;
 
       AutoNodeMap(const GR& digraph) : Parent(digraph, INVALID) {}
@@ -1257,10 +1258,4 @@
       }
     };
-
-    const Digraph &_g;
-    AutoNodeMap _head;
-    typename Digraph::template ArcMap<Arc> _parent;
-    typename Digraph::template ArcMap<Arc> _left;
-    typename Digraph::template ArcMap<Arc> _right;
 
     class ArcLess {
@@ -1273,4 +1268,12 @@
       }
     };
+
+  protected: 
+
+    const Digraph &_g;
+    AutoNodeMap _head;
+    typename Digraph::template ArcMap<Arc> _parent;
+    typename Digraph::template ArcMap<Arc> _left;
+    typename Digraph::template ArcMap<Arc> _right;
 
   public:
@@ -1631,6 +1634,9 @@
   class ArcLookUp
   {
+    TEMPLATE_DIGRAPH_TYPEDEFS(GR);
+
   public:
-    TEMPLATE_DIGRAPH_TYPEDEFS(GR);
+
+    /// The Digraph type
     typedef GR Digraph;
 
@@ -1747,7 +1753,6 @@
 
     TEMPLATE_DIGRAPH_TYPEDEFS(GR);
-    typedef GR Digraph;
-
-    typename Digraph::template ArcMap<Arc> _next;
+
+    typename GR::template ArcMap<Arc> _next;
 
     Arc refreshNext(Arc head,Arc next=INVALID)
@@ -1768,4 +1773,8 @@
 
   public:
+
+    /// The Digraph type
+    typedef GR Digraph;
+
     ///Constructor
 
Index: lemon/edge_set.h
===================================================================
--- lemon/edge_set.h	(revision 559)
+++ lemon/edge_set.h	(revision 617)
@@ -34,5 +34,4 @@
   public:
 
-    typedef GR Graph;
     typedef typename GR::Node Node;
     typedef typename GR::NodeIt NodeIt;
@@ -209,7 +208,7 @@
     template <typename V>
     class NodeMap : public GR::template NodeMap<V> {
+      typedef typename GR::template NodeMap<V> Parent;
+
     public:
-
-      typedef typename GR::template NodeMap<V> Parent;
 
       explicit NodeMap(const ListArcSetBase<GR>& arcset)
@@ -260,14 +259,10 @@
   template <typename GR>
   class ListArcSet : public ArcSetExtender<ListArcSetBase<GR> > {
-
-  public:
-
     typedef ArcSetExtender<ListArcSetBase<GR> > Parent;
+
+  public:
 
     typedef typename Parent::Node Node;
     typedef typename Parent::Arc Arc;
-
-    typedef GR Graph;
-
 
     typedef typename Parent::NodesImplBase NodesImplBase;
@@ -293,7 +288,7 @@
 
     class NodesImpl : public NodesImplBase {
+      typedef NodesImplBase Parent;
+
     public:
-      typedef NodesImplBase Parent;
-
       NodesImpl(const GR& graph, ListArcSet& arcset)
         : Parent(graph), _arcset(arcset) {}
@@ -355,5 +350,4 @@
   public:
 
-    typedef GR Graph;
     typedef typename GR::Node Node;
     typedef typename GR::NodeIt NodeIt;
@@ -638,7 +632,7 @@
     template <typename V>
     class NodeMap : public GR::template NodeMap<V> {
+      typedef typename GR::template NodeMap<V> Parent;
+
     public:
-
-      typedef typename GR::template NodeMap<V> Parent;
 
       explicit NodeMap(const ListEdgeSetBase<GR>& arcset)
@@ -689,15 +683,11 @@
   template <typename GR>
   class ListEdgeSet : public EdgeSetExtender<ListEdgeSetBase<GR> > {
-
-  public:
-
     typedef EdgeSetExtender<ListEdgeSetBase<GR> > Parent;
+
+  public:
 
     typedef typename Parent::Node Node;
     typedef typename Parent::Arc Arc;
     typedef typename Parent::Edge Edge;
-
-    typedef GR Graph;
-
 
     typedef typename Parent::NodesImplBase NodesImplBase;
@@ -718,7 +708,7 @@
 
     class NodesImpl : public NodesImplBase {
+      typedef NodesImplBase Parent;
+
     public:
-      typedef NodesImplBase Parent;
-
       NodesImpl(const GR& graph, ListEdgeSet& arcset)
         : Parent(graph), _arcset(arcset) {}
@@ -780,7 +770,6 @@
   public:
 
-    typedef GR Graph;
-    typedef typename Graph::Node Node;
-    typedef typename Graph::NodeIt NodeIt;
+    typedef typename GR::Node Node;
+    typedef typename GR::NodeIt NodeIt;
 
   protected:
@@ -901,7 +890,7 @@
     template <typename V>
     class NodeMap : public GR::template NodeMap<V> {
+      typedef typename GR::template NodeMap<V> Parent;
+
     public:
-
-      typedef typename GR::template NodeMap<V> Parent;
 
       explicit NodeMap(const SmartArcSetBase<GR>& arcset)
@@ -957,13 +946,10 @@
   template <typename GR>
   class SmartArcSet : public ArcSetExtender<SmartArcSetBase<GR> > {
-
-  public:
-
     typedef ArcSetExtender<SmartArcSetBase<GR> > Parent;
+
+  public:
 
     typedef typename Parent::Node Node;
     typedef typename Parent::Arc Arc;
-
-    typedef GR Graph;
 
   protected:
@@ -984,7 +970,7 @@
 
     class NodesImpl : public NodesImplBase {
+      typedef NodesImplBase Parent;
+
     public:
-      typedef NodesImplBase Parent;
-
       NodesImpl(const GR& graph, SmartArcSet& arcset)
         : Parent(graph), _arcset(arcset) {}
@@ -1063,5 +1049,4 @@
   public:
 
-    typedef GR Graph;
     typedef typename GR::Node Node;
     typedef typename GR::NodeIt NodeIt;
@@ -1250,7 +1235,7 @@
     template <typename V>
     class NodeMap : public GR::template NodeMap<V> {
+      typedef typename GR::template NodeMap<V> Parent;
+
     public:
-
-      typedef typename GR::template NodeMap<V> Parent;
 
       explicit NodeMap(const SmartEdgeSetBase<GR>& arcset)
@@ -1305,8 +1290,7 @@
   template <typename GR>
   class SmartEdgeSet : public EdgeSetExtender<SmartEdgeSetBase<GR> > {
-
-  public:
-
     typedef EdgeSetExtender<SmartEdgeSetBase<GR> > Parent;
+
+  public:
 
     typedef typename Parent::Node Node;
@@ -1314,6 +1298,4 @@
     typedef typename Parent::Edge Edge;
 
-    typedef GR Graph;
-
   protected:
 
@@ -1332,7 +1314,7 @@
 
     class NodesImpl : public NodesImplBase {
+      typedef NodesImplBase Parent;
+
     public:
-      typedef NodesImplBase Parent;
-
       NodesImpl(const GR& graph, SmartEdgeSet& arcset)
         : Parent(graph), _arcset(arcset) {}
Index: lemon/full_graph.h
===================================================================
--- lemon/full_graph.h	(revision 582)
+++ lemon/full_graph.h	(revision 617)
@@ -32,5 +32,5 @@
   public:
 
-    typedef FullDigraphBase Graph;
+    typedef FullDigraphBase Digraph;
 
     class Node;
@@ -170,7 +170,7 @@
   /// \sa FullGraph
   class FullDigraph : public ExtendedFullDigraphBase {
+    typedef ExtendedFullDigraphBase Parent;
+
   public:
-
-    typedef ExtendedFullDigraphBase Parent;
 
     /// \brief Constructor
@@ -227,6 +227,4 @@
 
   class FullGraphBase {
-    int _node_num;
-    int _edge_num;
   public:
 
@@ -238,4 +236,7 @@
 
   protected:
+
+    int _node_num;
+    int _edge_num;
 
     FullGraphBase() {}
@@ -538,7 +539,7 @@
   /// \sa FullDigraph
   class FullGraph : public ExtendedFullGraphBase {
+    typedef ExtendedFullGraphBase Parent;
+
   public:
-
-    typedef ExtendedFullGraphBase Parent;
 
     /// \brief Constructor
Index: lemon/graph_to_eps.h
===================================================================
--- lemon/graph_to_eps.h	(revision 584)
+++ lemon/graph_to_eps.h	(revision 617)
@@ -70,4 +70,5 @@
 {
   typedef GR Graph;
+  typedef GR Digraph;
   typedef typename Graph::Node Node;
   typedef typename Graph::NodeIt NodeIt;
@@ -242,4 +243,5 @@
 
   typedef typename T::Graph Graph;
+  typedef typename T::Digraph Digraph;
   typedef typename Graph::Node Node;
   typedef typename Graph::NodeIt NodeIt;
Index: lemon/grid_graph.h
===================================================================
--- lemon/grid_graph.h	(revision 582)
+++ lemon/grid_graph.h	(revision 617)
@@ -500,7 +500,7 @@
   /// "Graph concept".
   class GridGraph : public ExtendedGridGraphBase {
+    typedef ExtendedGridGraphBase Parent;
+
   public:
-
-    typedef ExtendedGridGraphBase Parent;
 
     /// \brief Map to get the indices of the nodes as dim2::Point<int>.
Index: lemon/hypercube_graph.h
===================================================================
--- lemon/hypercube_graph.h	(revision 582)
+++ lemon/hypercube_graph.h	(revision 617)
@@ -295,7 +295,7 @@
   /// "Graph concept".
   class HypercubeGraph : public ExtendedHypercubeGraphBase {
+    typedef ExtendedHypercubeGraphBase Parent;
+
   public:
-
-    typedef ExtendedHypercubeGraphBase Parent;
 
     /// \brief Constructs a hypercube graph with \c dim dimensions.
Index: lemon/list_graph.h
===================================================================
--- lemon/list_graph.h	(revision 582)
+++ lemon/list_graph.h	(revision 617)
@@ -324,4 +324,6 @@
 
   class ListDigraph : public ExtendedListDigraphBase {
+    typedef ExtendedListDigraphBase Parent;
+
   private:
     ///ListDigraph is \e not copy constructible. Use copyDigraph() instead.
@@ -337,6 +339,4 @@
     void operator=(const ListDigraph &) {}
   public:
-
-    typedef ExtendedListDigraphBase Parent;
 
     /// Constructor
@@ -794,5 +794,5 @@
   public:
 
-    typedef ListGraphBase Digraph;
+    typedef ListGraphBase Graph;
 
     class Node;
@@ -1177,4 +1177,6 @@
 
   class ListGraph : public ExtendedListGraphBase {
+    typedef ExtendedListGraphBase Parent;
+
   private:
     ///ListGraph is \e not copy constructible. Use copyGraph() instead.
@@ -1195,6 +1197,4 @@
     ///
     ListGraph() {}
-
-    typedef ExtendedListGraphBase Parent;
 
     typedef Parent::OutArcIt IncEdgeIt;
Index: lemon/maps.h
===================================================================
--- lemon/maps.h	(revision 584)
+++ lemon/maps.h	(revision 617)
@@ -1839,4 +1839,5 @@
     /// The graph type of IdMap.
     typedef GR Graph;
+    typedef GR Digraph;
     /// The key type of IdMap (\c Node, \c Arc or \c Edge).
     typedef K Item;
@@ -1930,4 +1931,5 @@
     /// The graph type of CrossRefMap.
     typedef GR Graph;
+    typedef GR Digraph;
     /// The key type of CrossRefMap (\c Node, \c Arc or \c Edge).
     typedef K Item;
@@ -2133,4 +2135,5 @@
     /// The graph type of RangeIdMap.
     typedef GR Graph;
+    typedef GR Digraph;
     /// The key type of RangeIdMap (\c Node, \c Arc or \c Edge).
     typedef K Item;
@@ -2495,5 +2498,6 @@
   public:
     
-    /// The digraph type
+    /// The graph type of InDegMap
+    typedef GR Graph;
     typedef GR Digraph;
     /// The key type
@@ -2624,5 +2628,6 @@
   public:
 
-    /// The digraph type
+    /// The graph type of OutDegMap
+    typedef GR Graph;
     typedef GR Digraph;
     /// The key type
Index: lemon/network_simplex.h
===================================================================
--- lemon/network_simplex.h	(revision 609)
+++ lemon/network_simplex.h	(revision 618)
@@ -382,5 +382,6 @@
         const int MIN_BLOCK_SIZE = 10;
 
-        _block_size = std::max( int(BLOCK_SIZE_FACTOR * sqrt(_arc_num)),
+        _block_size = std::max( int(BLOCK_SIZE_FACTOR *
+                                    std::sqrt(double(_arc_num))),
                                 MIN_BLOCK_SIZE );
       }
@@ -458,5 +459,6 @@
         const int MIN_MINOR_LIMIT = 3;
 
-        _list_length = std::max( int(LIST_LENGTH_FACTOR * sqrt(_arc_num)),
+        _list_length = std::max( int(LIST_LENGTH_FACTOR *
+                                     std::sqrt(double(_arc_num))),
                                  MIN_LIST_LENGTH );
         _minor_limit = std::max( int(MINOR_LIMIT_FACTOR * _list_length),
@@ -578,5 +580,6 @@
         const int MIN_HEAD_LENGTH = 3;
 
-        _block_size = std::max( int(BLOCK_SIZE_FACTOR * sqrt(_arc_num)),
+        _block_size = std::max( int(BLOCK_SIZE_FACTOR *
+                                    std::sqrt(double(_arc_num))),
                                 MIN_BLOCK_SIZE );
         _head_length = std::max( int(HEAD_LENGTH_FACTOR * _block_size),
@@ -1145,4 +1148,5 @@
       // Run Circulation to check if a feasible solution exists
       typedef ConstMap<Arc, Flow> ConstArcMap;
+      ConstArcMap zero_arc_map(0), inf_arc_map(inf_cap);
       FlowNodeMap *csup = NULL;
       bool local_csup = false;
@@ -1165,5 +1169,5 @@
           } else {
             Circulation<GR, FlowArcMap, ConstArcMap, FlowNodeMap>
-              circ(_graph, *_plower, ConstArcMap(inf_cap), *csup);
+              circ(_graph, *_plower, inf_arc_map, *csup);
             circ_result = circ.run();
           }
@@ -1171,9 +1175,9 @@
           if (_pupper) {
             Circulation<GR, ConstArcMap, FlowArcMap, FlowNodeMap>
-              circ(_graph, ConstArcMap(0), *_pupper, *csup);
+              circ(_graph, zero_arc_map, *_pupper, *csup);
             circ_result = circ.run();
           } else {
             Circulation<GR, ConstArcMap, ConstArcMap, FlowNodeMap>
-              circ(_graph, ConstArcMap(0), ConstArcMap(inf_cap), *csup);
+              circ(_graph, zero_arc_map, inf_arc_map, *csup);
             circ_result = circ.run();
           }
@@ -1192,5 +1196,5 @@
           } else {
             Circulation<RevGraph, FlowArcMap, ConstArcMap, NegNodeMap>
-              circ(rgraph, *_plower, ConstArcMap(inf_cap), neg_csup);
+              circ(rgraph, *_plower, inf_arc_map, neg_csup);
             circ_result = circ.run();
           }
@@ -1198,9 +1202,9 @@
           if (_pupper) {
             Circulation<RevGraph, ConstArcMap, FlowArcMap, NegNodeMap>
-              circ(rgraph, ConstArcMap(0), *_pupper, neg_csup);
+              circ(rgraph, zero_arc_map, *_pupper, neg_csup);
             circ_result = circ.run();
           } else {
             Circulation<RevGraph, ConstArcMap, ConstArcMap, NegNodeMap>
-              circ(rgraph, ConstArcMap(0), ConstArcMap(inf_cap), neg_csup);
+              circ(rgraph, zero_arc_map, inf_arc_map, neg_csup);
             circ_result = circ.run();
           }
@@ -1226,5 +1230,5 @@
 
       // Store the arcs in a mixed order
-      int k = std::max(int(sqrt(_arc_num)), 10);
+      int k = std::max(int(std::sqrt(double(_arc_num))), 10);
       int i = 0;
       for (ArcIt e(_graph); e != INVALID; ++e) {
Index: lemon/smart_graph.h
===================================================================
--- lemon/smart_graph.h	(revision 582)
+++ lemon/smart_graph.h	(revision 617)
@@ -56,5 +56,5 @@
   public:
 
-    typedef SmartDigraphBase Graph;
+    typedef SmartDigraphBase Digraph;
 
     class Node;
@@ -196,6 +196,4 @@
   ///\sa concepts::Digraph.
   class SmartDigraph : public ExtendedSmartDigraphBase {
-  public:
-
     typedef ExtendedSmartDigraphBase Parent;
 
@@ -421,5 +419,5 @@
   public:
 
-    typedef SmartGraphBase Digraph;
+    typedef SmartGraphBase Graph;
 
     class Node;
@@ -632,4 +630,6 @@
   /// \sa concepts::Graph.
   class SmartGraph : public ExtendedSmartGraphBase {
+    typedef ExtendedSmartGraphBase Parent;
+
   private:
 
@@ -648,6 +648,4 @@
 
   public:
-
-    typedef ExtendedSmartGraphBase Parent;
 
     /// Constructor
Index: test/CMakeLists.txt
===================================================================
--- test/CMakeLists.txt	(revision 621)
+++ test/CMakeLists.txt	(revision 611)
@@ -3,4 +3,8 @@
   ${PROJECT_BINARY_DIR}
 )
+
+IF(HAVE_GLPK)
+  INCLUDE_DIRECTORIES(${GLPK_INCLUDE_DIR})
+ENDIF(HAVE_GLPK)
 
 LINK_DIRECTORIES(${PROJECT_BINARY_DIR}/lemon)
@@ -39,15 +43,7 @@
 IF(HAVE_LP)
   ADD_EXECUTABLE(lp_test lp_test.cc)
-  SET(LP_TEST_LIBS lemon)
   IF(HAVE_GLPK)
-    SET(LP_TEST_LIBS ${LP_TEST_LIBS} ${GLPK_LIBRARIES})
+    TARGET_LINK_LIBRARIES(lp_test lemon ${GLPK_LIBRARIES})
   ENDIF(HAVE_GLPK)
-  IF(HAVE_CPLEX)
-    SET(LP_TEST_LIBS ${LP_TEST_LIBS} ${CPLEX_LIBRARIES})
-  ENDIF(HAVE_CPLEX)
-  IF(HAVE_CLP)
-    SET(LP_TEST_LIBS ${LP_TEST_LIBS} ${COIN_CLP_LIBRARIES})
-  ENDIF(HAVE_CLP)
-  TARGET_LINK_LIBRARIES(lp_test ${LP_TEST_LIBS})
   ADD_TEST(lp_test lp_test)
 
@@ -61,26 +57,11 @@
     )
   ENDIF(WIN32 AND HAVE_GLPK)
-  IF(WIN32 AND HAVE_CPLEX)
-    GET_TARGET_PROPERTY(TARGET_LOC lp_test LOCATION)
-    GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH)
-    ADD_CUSTOM_COMMAND(TARGET lp_test POST_BUILD
-      COMMAND cmake -E copy ${CPLEX_BIN_DIR}/cplex91.dll ${TARGET_PATH}
-    )
-  ENDIF(WIN32 AND HAVE_CPLEX)
 ENDIF(HAVE_LP)
 
 IF(HAVE_MIP)
   ADD_EXECUTABLE(mip_test mip_test.cc)
-  SET(MIP_TEST_LIBS lemon)
   IF(HAVE_GLPK)
-    SET(MIP_TEST_LIBS ${MIP_TEST_LIBS} ${GLPK_LIBRARIES})
+    TARGET_LINK_LIBRARIES(mip_test lemon ${GLPK_LIBRARIES})
   ENDIF(HAVE_GLPK)
-  IF(HAVE_CPLEX)
-    SET(MIP_TEST_LIBS ${MIP_TEST_LIBS} ${CPLEX_LIBRARIES})
-  ENDIF(HAVE_CPLEX)
-  IF(HAVE_CBC)
-    SET(MIP_TEST_LIBS ${MIP_TEST_LIBS} ${COIN_CBC_LIBRARIES})
-  ENDIF(HAVE_CBC)
-  TARGET_LINK_LIBRARIES(mip_test ${MIP_TEST_LIBS})
   ADD_TEST(mip_test mip_test)
 
@@ -94,11 +75,4 @@
     )
   ENDIF(WIN32 AND HAVE_GLPK)
-  IF(WIN32 AND HAVE_CPLEX)
-    GET_TARGET_PROPERTY(TARGET_LOC mip_test LOCATION)
-    GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH)
-    ADD_CUSTOM_COMMAND(TARGET mip_test POST_BUILD
-      COMMAND cmake -E copy ${CPLEX_BIN_DIR}/cplex91.dll ${TARGET_PATH}
-    )
-  ENDIF(WIN32 AND HAVE_CPLEX)
 ENDIF(HAVE_MIP)
 
Index: test/min_cost_flow_test.cc
===================================================================
--- test/min_cost_flow_test.cc	(revision 609)
+++ test/min_cost_flow_test.cc	(revision 615)
@@ -234,10 +234,5 @@
     typedef int Flow;
     typedef int Cost;
-    // TODO: This typedef should be enabled if the standard maps are
-    // reference maps in the graph concepts (See #190).
-/**/
-    //typedef concepts::Digraph GR;
-    typedef ListDigraph GR;
-/**/
+    typedef concepts::Digraph GR;
     checkConcept< McfClassConcept<GR, Flow, Cost>,
                   NetworkSimplex<GR, Flow, Cost> >();
Index: tools/dimacs-solver.cc
===================================================================
--- tools/dimacs-solver.cc	(revision 611)
+++ tools/dimacs-solver.cc	(revision 614)
@@ -94,5 +94,5 @@
 template<class Value>
 void solve_min(ArgParser &ap, std::istream &is, std::ostream &,
-               DimacsDescriptor &desc)
+               Value infty, DimacsDescriptor &desc)
 {
   bool report = !ap.given("q");
@@ -101,15 +101,33 @@
   Digraph::NodeMap<Value> sup(g);
   Timer ti;
-  ti.restart();
-  readDimacsMin(is, g, lower, cap, cost, sup, 0, desc);
+
+  ti.restart();
+  readDimacsMin(is, g, lower, cap, cost, sup, infty, desc);
+  ti.stop();
+  Value sum_sup = 0;
+  for (Digraph::NodeIt n(g); n != INVALID; ++n) {
+    sum_sup += sup[n];
+  }
+  if (report) {
+    std::cerr << "Sum of supply values: " << sum_sup << "\n";
+    if (sum_sup <= 0)
+      std::cerr << "GEQ supply contraints are used for NetworkSimplex\n\n";
+    else
+      std::cerr << "LEQ supply contraints are used for NetworkSimplex\n\n";
+  }
   if (report) std::cerr << "Read the file: " << ti << '\n';
+
   ti.restart();
   NetworkSimplex<Digraph, Value> ns(g);
   ns.lowerMap(lower).capacityMap(cap).costMap(cost).supplyMap(sup);
+  if (sum_sup > 0) ns.problemType(ns.LEQ);
   if (report) std::cerr << "Setup NetworkSimplex class: " << ti << '\n';
   ti.restart();
-  ns.run();
-  if (report) std::cerr << "Run NetworkSimplex: " << ti << '\n';
-  if (report) std::cerr << "\nMin flow cost: " << ns.totalCost() << '\n';
+  bool res = ns.run();
+  if (report) {
+    std::cerr << "Run NetworkSimplex: " << ti << "\n\n";
+    std::cerr << "Feasible flow: " << (res ? "found" : "not found") << '\n';
+    if (res) std::cerr << "Min flow cost: " << ns.totalCost() << '\n';
+  }
 }
 
@@ -152,5 +170,5 @@
     {
     case DimacsDescriptor::MIN:
-      solve_min<Value>(ap,is,os,desc);
+      solve_min<Value>(ap,is,os,infty,desc);
       break;
     case DimacsDescriptor::MAX:
Index: tools/lgf-gen.cc
===================================================================
--- tools/lgf-gen.cc	(revision 584)
+++ tools/lgf-gen.cc	(revision 616)
@@ -66,5 +66,5 @@
   double tlen=0;
   for(EdgeIt e(g);e!=INVALID;++e)
-    tlen+=sqrt((coords[g.v(e)]-coords[g.u(e)]).normSquare());
+    tlen+=std::sqrt((coords[g.v(e)]-coords[g.u(e)]).normSquare());
   return tlen;
 }
@@ -189,5 +189,5 @@
       (r.x * r.x + r.y * r.y) * (p.x * q.y - q.x * p.y);
 
-    return d / (2 * a) + sqrt((d * d + e * e) / (4 * a * a) + f / a);
+    return d / (2 * a) + std::sqrt((d * d + e * e) / (4 * a * a) + f / a);
   }
 
@@ -207,5 +207,5 @@
     double b = (q.x - sx) * p.y - (p.x - sx) * q.y;
     double d = (q.x - sx) * (p.x - sx) * (p - q).normSquare();
-    return (b - sqrt(d)) / a;
+    return (b - std::sqrt(d)) / a;
   }
 
@@ -721,5 +721,5 @@
 
   if (ap["rand"]) {
-    int seed = time(0);
+    int seed = int(time(0));
     std::cout << "Random number seed: " << seed << std::endl;
     rnd = Random(seed);
@@ -814,5 +814,5 @@
   double tlen=0;
   for(EdgeIt e(g);e!=INVALID;++e)
-    tlen+=sqrt((coords[g.v(e)]-coords[g.u(e)]).normSquare());
+    tlen+=std::sqrt((coords[g.v(e)]-coords[g.u(e)]).normSquare());
   std::cout << "Total arc length  : " << tlen << std::endl;
 
