Index: src/include/skeletons/graph.h
===================================================================
--- src/include/skeletons/graph.h	(revision 254)
+++ src/include/skeletons/graph.h	(revision 298)
@@ -1,5 +1,5 @@
 // -*- c++ -*-
-#ifndef HUGO_EMPTYGRAPH_H
-#define HUGO_EMPTYGRAPH_H
+#ifndef HUGO_GRAPH_H
+#define HUGO_GRAPH_H
 
 ///\file
@@ -391,3 +391,3 @@
 // }
 
-#endif // HUGO_EMPTYGRAPH_H
+#endif // HUGO_GRAPH_H
Index: src/work/marci/experiment/bfs_iterator_1.h
===================================================================
--- src/work/marci/experiment/bfs_iterator_1.h	(revision 281)
+++ src/work/marci/experiment/bfs_iterator_1.h	(revision 298)
@@ -631,10 +631,11 @@
 
 
-  template <typename GraphWrapper, /*typename OutEdgeIt,*/ 
-	    typename ReachedMap/*=typename GraphWrapper::NodeMap<bool>*/ >
+  template <typename Graph, /*typename OutEdgeIt,*/ 
+	    typename ReachedMap/*=typename Graph::NodeMap<bool>*/ >
   class BfsIterator5 {
-    typedef typename GraphWrapper::Node Node;
-    typedef typename GraphWrapper::OutEdgeIt OutEdgeIt;
-    const GraphWrapper* g;
+  protected:
+    typedef typename Graph::Node Node;
+    typedef typename Graph::OutEdgeIt OutEdgeIt;
+    const Graph* graph;
     std::queue<Node> bfs_queue;
     ReachedMap& reached;
@@ -643,17 +644,10 @@
     bool own_reached_map;
   public:
-    BfsIterator5(const GraphWrapper& _g, ReachedMap& _reached) : 
-      g(&_g), reached(_reached), 
+    BfsIterator5(const Graph& _graph, ReachedMap& _reached) : 
+      graph(&_graph), reached(_reached), 
       own_reached_map(false) { }
-    BfsIterator5(const GraphWrapper& _g) : 
-      g(&_g), reached(*(new ReachedMap(*g /*, false*/))), 
+    BfsIterator5(const Graph& _graph) : 
+      graph(&_graph), reached(*(new ReachedMap(*graph /*, false*/))), 
       own_reached_map(true) { }
-//     BfsIterator5(const typename GraphWrapper::BaseGraph& _G, 
-// 		 ReachedMap& _reached) : 
-//       G(_G), reached(_reached), 
-//       own_reached_map(false) { }
-//     BfsIterator5(const typename GraphWrapper::BaseGraph& _G) : 
-//       G(_G), reached(*(new ReachedMap(G /*, false*/))), 
-//       own_reached_map(true) { }
     ~BfsIterator5() { if (own_reached_map) delete &reached; }
     void pushAndSetReached(Node s) { 
@@ -661,7 +655,7 @@
       if (bfs_queue.empty()) {
 	bfs_queue.push(s);
-	g->first(actual_edge, s);
-	if (g->valid(actual_edge)) { 
-	  Node w=g->bNode(actual_edge);
+	graph->first(actual_edge, s);
+	if (graph->valid(actual_edge)) { 
+	  Node w=graph->bNode(actual_edge);
 	  if (!reached.get(w)) {
 	    bfs_queue.push(w);
@@ -676,10 +670,10 @@
       }
     }
-    BfsIterator5<GraphWrapper, /*OutEdgeIt,*/ ReachedMap>& 
+    BfsIterator5<Graph, /*OutEdgeIt,*/ ReachedMap>& 
     operator++() { 
-      if (g->valid(actual_edge)) { 
-	g->next(actual_edge);
-	if (g->valid(actual_edge)) {
-	  Node w=g->bNode(actual_edge);
+      if (graph->valid(actual_edge)) { 
+	graph->next(actual_edge);
+	if (graph->valid(actual_edge)) {
+	  Node w=graph->bNode(actual_edge);
 	  if (!reached.get(w)) {
 	    bfs_queue.push(w);
@@ -693,7 +687,7 @@
 	bfs_queue.pop(); 
 	if (!bfs_queue.empty()) {
-	  g->first(actual_edge, bfs_queue.front());
-	  if (g->valid(actual_edge)) {
-	    Node w=g->bNode(actual_edge);
+	  graph->first(actual_edge, bfs_queue.front());
+	  if (graph->valid(actual_edge)) {
+	    Node w=graph->bNode(actual_edge);
 	    if (!reached.get(w)) {
 	      bfs_queue.push(w);
@@ -711,7 +705,7 @@
     operator OutEdgeIt () const { return actual_edge; }
     bool isBNodeNewlyReached() const { return b_node_newly_reached; }
-    bool isANodeExamined() const { return !(g->valid(actual_edge)); }
+    bool isANodeExamined() const { return !(graph->valid(actual_edge)); }
     Node aNode() const { return bfs_queue.front(); }
-    Node bNode() const { return g->bNode(actual_edge); }
+    Node bNode() const { return graph->bNode(actual_edge); }
     const ReachedMap& getReachedMap() const { return reached; }
     const std::queue<Node>& getBfsQueue() const { return bfs_queue; }
@@ -774,10 +768,11 @@
 //   };
 
-  template <typename GraphWrapper, /*typename OutEdgeIt,*/ 
-	    typename ReachedMap/*=typename GraphWrapper::NodeMap<bool>*/ >
+  template <typename Graph, /*typename OutEdgeIt,*/ 
+	    typename ReachedMap/*=typename Graph::NodeMap<bool>*/ >
   class DfsIterator5 {
-    typedef typename GraphWrapper::Node Node;
-    typedef typename GraphWrapper::OutEdgeIt OutEdgeIt;
-    const GraphWrapper* g;
+  protected:
+    typedef typename Graph::Node Node;
+    typedef typename Graph::OutEdgeIt OutEdgeIt;
+    const Graph* graph;
     std::stack<OutEdgeIt> dfs_stack;
     bool b_node_newly_reached;
@@ -787,9 +782,9 @@
     bool own_reached_map;
   public:
-    DfsIterator5(const GraphWrapper& _g, ReachedMap& _reached) : 
-      g(&_g), reached(_reached), 
+    DfsIterator5(const Graph& _graph, ReachedMap& _reached) : 
+      graph(&_graph), reached(_reached), 
       own_reached_map(false) { }
-    DfsIterator5(const GraphWrapper& _g) : 
-      g(&_g), reached(*(new ReachedMap(*g /*, false*/))), 
+    DfsIterator5(const Graph& _graph) : 
+      graph(&_graph), reached(*(new ReachedMap(*graph /*, false*/))), 
       own_reached_map(true) { }
     ~DfsIterator5() { if (own_reached_map) delete &reached; }
@@ -798,23 +793,23 @@
       reached.set(s, true);
       OutEdgeIt e;
-      g->first(e, s);
+      graph->first(e, s);
       dfs_stack.push(e); 
     }
-    DfsIterator5<GraphWrapper, /*OutEdgeIt,*/ ReachedMap>& 
+    DfsIterator5<Graph, /*OutEdgeIt,*/ ReachedMap>& 
     operator++() { 
       actual_edge=dfs_stack.top();
       //actual_node=G.aNode(actual_edge);
-      if (g->valid(actual_edge)/*.valid()*/) { 
-	Node w=g->bNode(actual_edge);
+      if (graph->valid(actual_edge)/*.valid()*/) { 
+	Node w=graph->bNode(actual_edge);
 	actual_node=w;
 	if (!reached.get(w)) {
 	  OutEdgeIt e;
-	  g->first(e, w);
+	  graph->first(e, w);
 	  dfs_stack.push(e);
 	  reached.set(w, true);
 	  b_node_newly_reached=true;
 	} else {
-	  actual_node=g->aNode(actual_edge);
-	  g->next(dfs_stack.top());
+	  actual_node=graph->aNode(actual_edge);
+	  graph->next(dfs_stack.top());
 	  b_node_newly_reached=false;
 	}
@@ -828,5 +823,5 @@
     operator OutEdgeIt () const { return actual_edge; }
     bool isBNodeNewlyReached() const { return b_node_newly_reached; }
-    bool isANodeExamined() const { return !(g->valid(actual_edge)); }
+    bool isANodeExamined() const { return !(graph->valid(actual_edge)); }
     Node aNode() const { return actual_node; /*FIXME*/}
     Node bNode() const { return G.bNode(actual_edge); }
Index: src/work/marci/experiment/edmonds_karp_1.h
===================================================================
--- src/work/marci/experiment/edmonds_karp_1.h	(revision 281)
+++ src/work/marci/experiment/edmonds_karp_1.h	(revision 298)
@@ -249,26 +249,23 @@
 
 
-  template <typename GraphWrapper, typename Number, typename FlowMap, typename CapacityMap>
+  template <typename Graph, typename Number, typename FlowMap, typename CapacityMap>
   class MaxFlow {
   protected:
-    typedef GraphWrapper GW;
-    typedef typename GW::Node Node;
-    typedef typename GW::Edge Edge;
-    typedef typename GW::EdgeIt EdgeIt;
-    typedef typename GW::OutEdgeIt OutEdgeIt;
-    typedef typename GW::InEdgeIt InEdgeIt;
-    //const Graph* G;
-    //GW gw;
-    const GW* g;
+    typedef typename Graph::Node Node;
+    typedef typename Graph::Edge Edge;
+    typedef typename Graph::EdgeIt EdgeIt;
+    typedef typename Graph::OutEdgeIt OutEdgeIt;
+    typedef typename Graph::InEdgeIt InEdgeIt;
+    const Graph* g;
     Node s;
     Node t;
     FlowMap* flow;
     const CapacityMap* capacity;
-    typedef ResGraphWrapper<const GW, Number, FlowMap, CapacityMap > ResGW;
+    typedef ResGraphWrapper<const Graph, Number, FlowMap, CapacityMap > ResGW;
     typedef typename ResGW::OutEdgeIt ResGWOutEdgeIt;
     typedef typename ResGW::Edge ResGWEdge;
   public:
 
-    MaxFlow(const GW& _g, Node _s, Node _t, FlowMap& _flow, const CapacityMap& _capacity) : 
+    MaxFlow(const Graph& _g, Node _s, Node _t, FlowMap& _flow, const CapacityMap& _capacity) : 
       g(&_g), s(_s), t(_t), flow(&_flow), capacity(&_capacity) { }
 
@@ -646,93 +643,4 @@
       return _augment;
     }
-
-//     bool augmentOnBlockingFlow2() {
-//       bool _augment=false;
-
-//       //typedef ErasingResGraphWrapper<Graph, Number, FlowMap, CapacityMap> EAugGraph;
-//       typedef FilterGraphWrapper< ErasingResGraphWrapper<Graph, Number, FlowMap, CapacityMap> > EAugGraph;
-//       typedef typename EAugGraph::OutEdgeIt EAugOutEdgeIt;
-//       typedef typename EAugGraph::Edge EAugEdge;
-
-//       EAugGraph res_graph(*G, *flow, *capacity);
-
-//       //typedef typename EAugGraph::NodeMap<bool> ReachedMap;
-//       BfsIterator5< 
-// 	ErasingResGraphWrapper<Graph, Number, FlowMap, CapacityMap>, 
-// 	/*typename ErasingResGraphWrapper<Graph, Number, FlowMap, CapacityMap>::OutEdgeIt,*/ 
-// 	ErasingResGraphWrapper<Graph, Number, FlowMap, CapacityMap>::NodeMap<bool> > bfs(res_graph);
-      
-//       bfs.pushAndSetReached(s);
-
-//       typename ErasingResGraphWrapper<Graph, Number, FlowMap, CapacityMap>::
-// 	NodeMap<int>& dist=res_graph.dist;
-
-//       while ( !bfs.finished() ) {
-// 	typename ErasingResGraphWrapper<Graph, Number, FlowMap, CapacityMap>::OutEdgeIt e=bfs;
-// 	if (res_graph.valid(e) && bfs.isBNodeNewlyReached()) {
-// 	  dist.set(res_graph.head(e), dist.get(res_graph.tail(e))+1);
-// 	}
-// 	++bfs;	
-//       } //computing distances from s in the residual graph
-
-//       bool __augment=true;
-
-//       while (__augment) {
-
-// 	__augment=false;
-// 	//computing blocking flow with dfs
-// 	typedef typename EAugGraph::NodeMap<bool> BlockingReachedMap;
-// 	DfsIterator5< EAugGraph/*, EAugOutEdgeIt*/, BlockingReachedMap > 
-// 	  dfs(res_graph);
-// 	typename EAugGraph::NodeMap<EAugEdge> pred(res_graph); 
-// 	pred.set(s, EAugEdge(INVALID));
-// 	//invalid iterators for sources
-
-// 	typename EAugGraph::NodeMap<Number> free(res_graph);
-
-// 	dfs.pushAndSetReached(s);
-// 	while (!dfs.finished()) {
-// 	  ++dfs;
-// 	  if (res_graph.valid(EAugOutEdgeIt(dfs))) { 
-// 	    if (dfs.isBNodeNewlyReached()) {
-	  
-// 	      typename EAugGraph::Node v=res_graph.aNode(dfs);
-// 	      typename EAugGraph::Node w=res_graph.bNode(dfs);
-
-// 	      pred.set(w, EAugOutEdgeIt(dfs));
-// 	      if (res_graph.valid(pred.get(v))) {
-// 		free.set(w, std::min(free.get(v), res_graph.free(dfs)));
-// 	      } else {
-// 		free.set(w, res_graph.free(dfs)); 
-// 	      }
-	      
-// 	      if (w==t) { 
-// 		__augment=true; 
-// 		_augment=true;
-// 		break; 
-// 	      }
-// 	    } else {
-// 	      res_graph.erase(dfs);
-// 	    }
-// 	  } 
-
-// 	}
-
-// 	if (__augment) {
-// 	  typename EAugGraph::Node n=t;
-// 	  Number augment_value=free.get(t);
-// 	  while (res_graph.valid(pred.get(n))) { 
-// 	    EAugEdge e=pred.get(n);
-// 	    res_graph.augment(e, augment_value);
-// 	    n=res_graph.tail(e);
-// 	    if (res_graph.free(e)==0)
-// 	      res_graph.erase(e);
-// 	  }
-// 	}
-      
-//       }
-            
-//       return _augment;
-//     }
 
     void run() {
Index: src/work/marci/experiment/graph_wrapper_1.h
===================================================================
--- src/work/marci/experiment/graph_wrapper_1.h	(revision 281)
+++ src/work/marci/experiment/graph_wrapper_1.h	(revision 298)
@@ -14,4 +14,9 @@
   public:
     typedef Graph BaseGraph;
+
+//     TrivGraphWrapper() : graph(0) { }
+    TrivGraphWrapper(Graph& _graph) : graph(&_graph) { }
+//     void setGraph(Graph& _graph) { graph = &_graph; }
+//     Graph& getGraph() const { return *graph; }
 
     typedef typename Graph::Node Node;
@@ -25,5 +30,4 @@
     };
     typedef typename Graph::Edge Edge;
-    //typedef typename Graph::OutEdgeIt OutEdgeIt;
     class OutEdgeIt : public Graph::OutEdgeIt { 
     public:
@@ -34,5 +38,4 @@
 	Graph::OutEdgeIt(*(_G.graph), n) { }
     };
-    //typedef typename Graph::InEdgeIt InEdgeIt;
     class InEdgeIt : public Graph::InEdgeIt { 
     public:
@@ -44,5 +47,4 @@
     };
     //typedef typename Graph::SymEdgeIt SymEdgeIt;
-    //typedef typename Graph::EdgeIt EdgeIt;
     class EdgeIt : public Graph::EdgeIt { 
     public:
@@ -54,10 +56,4 @@
     };
 
-    //TrivGraphWrapper() : graph(0) { }
-    TrivGraphWrapper(Graph& _graph) : graph(&_graph) { }
-
-//    void setGraph(Graph& _graph) { graph = &_graph; }
-//    Graph& getGraph() const { return (*graph); }
-
     NodeIt& first(NodeIt& i) const { 
       i=NodeIt(*this);
@@ -69,5 +65,4 @@
     }
 //     template<typename I> I& first(I& i) const { 
-//       //return graph->first(i); 
 //       i=I(*this);
 //       return i;
@@ -82,5 +77,4 @@
     }
 //     template<typename I, typename P> I& first(I& i, const P& p) const { 
-//       //return graph->first(i, p);
 //       i=I(*this, p);
 //       return i;
@@ -92,14 +86,14 @@
 
     template< typename It > It first() const { 
-      It e; first(e); return e; }
+      It e; this->first(e); return e; }
 
     template< typename It > It first(const Node& v) const { 
-      It e; first(e, v); return e; }
+      It e; this->first(e, v); return e; }
 
     Node head(const Edge& e) const { return graph->head(e); }
     Node tail(const Edge& e) const { return graph->tail(e); }
 
-    template<typename I> bool valid(const I& i) const 
-      { return graph->valid(i); }
+    template<typename I> bool valid(const I& i) const { 
+      return graph->valid(i); }
   
     //template<typename I> void setInvalid(const I &i);
@@ -143,7 +137,5 @@
     public:
       NodeMapWrapper(Map& _map) : map(&_map) { }
-      //template<typename T> 
       void set(Node n, T a) { map->set(n, a); }
-      //template<typename T>
       T get(Node n) const { return map->get(n); }
     };
@@ -154,89 +146,87 @@
     public:
       EdgeMapWrapper(Map& _map) : map(&_map) { }
-      //template<typename T> 
       void set(Edge n, T a) { map->set(n, a); }
-      //template<typename T>
       T get(Edge n) const { return map->get(n); }
     };
   };
 
-  template<typename GraphWrapper>
-  class GraphWrapperSkeleton {
+
+  template<typename Graph>
+  class GraphWrapper {
   protected:
-    GraphWrapper gw;
+    Graph* graph;
   
   public:
-    //typedef typename GraphWrapper::BaseGraph BaseGraph;
-
-//     typedef typename GraphWrapper::Node Node;
-//     typedef typename GraphWrapper::NodeIt NodeIt;
-
-//     typedef typename GraphWrapper::Edge Edge;
-//     typedef typename GraphWrapper::OutEdgeIt OutEdgeIt;
-//     typedef typename GraphWrapper::InEdgeIt InEdgeIt;
-//     //typedef typename GraphWrapper::SymEdgeIt SymEdgeIt;
-//     typedef typename GraphWrapper::EdgeIt EdgeIt;
-
-    typedef typename GraphWrapper::Node Node;
-    class NodeIt : public GraphWrapper::NodeIt { 
+    typedef Graph BaseGraph;
+
+//     GraphWrapper() : graph(0) { }
+    GraphWrapper(Graph& _graph) : graph(&_graph) { }
+//     void setGraph(Graph& _graph) { graph=&_graph; }
+//     Graph& getGraph() const { return *graph; }
+ 
+    typedef typename Graph::Node Node;
+    class NodeIt : public Graph::NodeIt { 
     public:
       NodeIt() { }
-      NodeIt(const typename GraphWrapper::NodeIt& n) : 
-	GraphWrapper::NodeIt(n) { }
-      NodeIt(const Invalid& i) : GraphWrapper::NodeIt(i) { }
-      NodeIt(const GraphWrapperSkeleton<GraphWrapper>& _G) : 
-	GraphWrapper::NodeIt(_G.gw) { }
-    };
-    typedef typename GraphWrapper::Edge Edge;
-    //typedef typename GraphWrapper::OutEdgeIt OutEdgeIt;
-    class OutEdgeIt : public GraphWrapper::OutEdgeIt { 
+      NodeIt(const typename Graph::NodeIt& n) : Graph::NodeIt(n) { }
+      NodeIt(const Invalid& i) : Graph::NodeIt(i) { }
+      NodeIt(const GraphWrapper<Graph>& _G) : 
+	Graph::NodeIt(*(_G.graph)) { }
+    };
+    typedef typename Graph::Edge Edge;
+    class OutEdgeIt : public Graph::OutEdgeIt { 
     public:
       OutEdgeIt() { }
-      OutEdgeIt(const typename GraphWrapper::OutEdgeIt& e) : 
-	GraphWrapper::OutEdgeIt(e) { }
-      OutEdgeIt(const Invalid& i) : GraphWrapper::OutEdgeIt(i) { }
-      OutEdgeIt(const GraphWrapperSkeleton<GraphWrapper>& _G, const Node& n) : 
-	GraphWrapper::OutEdgeIt(_G.gw, n) { }
-    };
-    //typedef typename GraphWrapper::InEdgeIt InEdgeIt;
-    class InEdgeIt : public GraphWrapper::InEdgeIt { 
+      OutEdgeIt(const typename Graph::OutEdgeIt& e) : Graph::OutEdgeIt(e) { }
+      OutEdgeIt(const Invalid& i) : Graph::OutEdgeIt(i) { }
+      OutEdgeIt(const GraphWrapper<Graph>& _G, const Node& n) : 
+	Graph::OutEdgeIt(*(_G.graph), n) { }
+    };
+    class InEdgeIt : public Graph::InEdgeIt { 
     public:
       InEdgeIt() { }
-      InEdgeIt(const typename GraphWrapper::InEdgeIt& e) : 
-	GraphWrapper::InEdgeIt(e) { }
-      InEdgeIt(const Invalid& i) : GraphWrapper::InEdgeIt(i) { }
-      InEdgeIt(const GraphWrapperSkeleton<GraphWrapper>& _G, const Node& n) : 
-	GraphWrapper::InEdgeIt(_G.gw, n) { }
-    };
-    //typedef typename GraphWrapper::SymEdgeIt SymEdgeIt;
-    //typedef typename GraphWrapper::EdgeIt EdgeIt;
-    class EdgeIt : public GraphWrapper::EdgeIt { 
+      InEdgeIt(const typename Graph::InEdgeIt& e) : Graph::InEdgeIt(e) { }
+      InEdgeIt(const Invalid& i) : Graph::InEdgeIt(i) { }
+      InEdgeIt(const GraphWrapper<Graph>& _G, const Node& n) : 
+	Graph::InEdgeIt(*(_G.graph), n) { }
+    };
+    //typedef typename Graph::SymEdgeIt SymEdgeIt;
+    class EdgeIt : public Graph::EdgeIt { 
     public:
       EdgeIt() { }
-      EdgeIt(const typename GraphWrapper::EdgeIt& e) : 
-	GraphWrapper::EdgeIt(e) { }
-      EdgeIt(const Invalid& i) : GraphWrapper::EdgeIt(i) { }
-      EdgeIt(const GraphWrapperSkeleton<GraphWrapper>& _G) : 
-	GraphWrapper::EdgeIt(_G.gw) { }
-    };
-
-
-    //GraphWrapperSkeleton() : gw() { }
-    GraphWrapperSkeleton(GraphWrapper _gw) : gw(_gw) { }
-
-    //void setGraph(BaseGraph& _graph) { gw.setGraph(_graph); }
-    //BaseGraph& getGraph() const { return gw.getGraph(); }
-    
-    template<typename I> I& first(I& i) const {       
-      i=I(*this);
+      EdgeIt(const typename Graph::EdgeIt& e) : Graph::EdgeIt(e) { }
+      EdgeIt(const Invalid& i) : Graph::EdgeIt(i) { }
+      EdgeIt(const GraphWrapper<Graph>& _G) : 
+	Graph::EdgeIt(*(_G.graph)) { }
+    };
+   
+    NodeIt& first(NodeIt& i) const { 
+      i=NodeIt(*this);
       return i;
     }
-    template<typename I, typename P> I& first(I& i, const P& p) const { 
-      i=I(*this, p);
-      return i; 
-    }
-    
-//    template<typename I> I getNext(const I& i) const { return gw.getNext(i); }
-    template<typename I> I& next(I &i) const { gw.next(i); return i; }    
+    EdgeIt& first(EdgeIt& i) const { 
+      i=EdgeIt(*this);
+      return i;
+    }
+//     template<typename I> I& first(I& i) const {       
+//       i=I(*this);
+//       return i;
+//     }
+    OutEdgeIt& first(OutEdgeIt& i, const Node& p) const { 
+      i=OutEdgeIt(*this, p);
+      return i;
+    }
+    InEdgeIt& first(InEdgeIt& i, const Node& p) const { 
+      i=InEdgeIt(*this, p);
+      return i;
+    }
+//     template<typename I, typename P> I& first(I& i, const P& p) const { 
+//       i=I(*this, p);
+//       return i; 
+//     }
+    
+//    template<typename I> I getNext(const I& i) const { 
+//      return gw.getNext(i); }
+    template<typename I> I& next(I &i) const { graph->next(i); return i; }    
 
     template< typename It > It first() const { 
@@ -246,164 +236,43 @@
       It e; this->first(e, v); return e; }
 
-    Node head(const Edge& e) const { return gw.head(e); }
-    Node tail(const Edge& e) const { return gw.tail(e); }
-
-    template<typename I> bool valid(const I& i) const { return gw.valid(i); }
+    Node head(const Edge& e) const { return graph->head(e); }
+    Node tail(const Edge& e) const { return graph->tail(e); }
+
+    template<typename I> bool valid(const I& i) const { 
+      return graph->valid(i); }
   
     //template<typename I> void setInvalid(const I &i);
     //{ return graph->setInvalid(i); }
 
-    int nodeNum() const { return gw.nodeNum(); }
-    int edgeNum() const { return gw.edgeNum(); }
-  
-    template<typename I> Node aNode(const I& e) const { return gw.aNode(e); }
-    template<typename I> Node bNode(const I& e) const { return gw.bNode(e); }
-  
-    Node addNode() const { return gw.addNode(); }
+    int nodeNum() const { return graph->nodeNum(); }
+    int edgeNum() const { return graph->edgeNum(); }
+  
+    template<typename I> Node aNode(const I& e) const { 
+      return graph->aNode(e); }
+    template<typename I> Node bNode(const I& e) const { 
+      return graph->bNode(e); }
+  
+    Node addNode() const { return graph->addNode(); }
     Edge addEdge(const Node& tail, const Node& head) const { 
-      return gw.addEdge(tail, head); }
-  
-    template<typename I> void erase(const I& i) const { gw.erase(i); }
-  
-    void clear() const { gw.clear(); }
-    
-    template<typename T> class NodeMap : public GraphWrapper::NodeMap<T> { 
-    public:
-      NodeMap(const GraphWrapperSkeleton<GraphWrapper>& _G) :  
-	GraphWrapper::NodeMap<T>(_G.gw) { }
-      NodeMap(const GraphWrapperSkeleton<GraphWrapper>& _G, T a) : 
-	GraphWrapper::NodeMap<T>(_G.gw, a) { }
-    };
-
-    template<typename T> class EdgeMap : public GraphWrapper::EdgeMap<T> { 
-    public:
-      EdgeMap(const GraphWrapperSkeleton<GraphWrapper>& _G) :  
-	GraphWrapper::EdgeMap<T>(_G.gw) { }
-      EdgeMap(const GraphWrapperSkeleton<GraphWrapper>& _G, T a) : 
-	GraphWrapper::EdgeMap<T>(_G.gw, a) { }
-    };
-  };
-
-  template<typename GraphWrapper>
-  class GraphWrapperSkeleton1 {
-  protected:
-    GraphWrapper* g;
-  
-  public:
-    //typedef typename GraphWrapper::BaseGraph BaseGraph;
-
-//     typedef typename GraphWrapper::Node Node;
-//     typedef typename GraphWrapper::NodeIt NodeIt;
-
-//     typedef typename GraphWrapper::Edge Edge;
-//     typedef typename GraphWrapper::OutEdgeIt OutEdgeIt;
-//     typedef typename GraphWrapper::InEdgeIt InEdgeIt;
-//     //typedef typename GraphWrapper::SymEdgeIt SymEdgeIt;
-//     typedef typename GraphWrapper::EdgeIt EdgeIt;
-
-    typedef typename GraphWrapper::Node Node;
-    class NodeIt : public GraphWrapper::NodeIt { 
-    public:
-      NodeIt() { }
-      NodeIt(const typename GraphWrapper::NodeIt& n) : 
-	GraphWrapper::NodeIt(n) { }
-      NodeIt(const Invalid& i) : GraphWrapper::NodeIt(i) { }
-      NodeIt(const GraphWrapperSkeleton1<GraphWrapper>& _G) : 
-	GraphWrapper::NodeIt(*(_G.g)) { }
-    };
-    typedef typename GraphWrapper::Edge Edge;
-    //typedef typename GraphWrapper::OutEdgeIt OutEdgeIt;
-    class OutEdgeIt : public GraphWrapper::OutEdgeIt { 
-    public:
-      OutEdgeIt() { }
-      OutEdgeIt(const typename GraphWrapper::OutEdgeIt& e) : 
-	GraphWrapper::OutEdgeIt(e) { }
-      OutEdgeIt(const Invalid& i) : GraphWrapper::OutEdgeIt(i) { }
-      OutEdgeIt(const GraphWrapperSkeleton1<GraphWrapper>& _G, const Node& n) : 
-	GraphWrapper::OutEdgeIt(*(_G.g), n) { }
-    };
-    //typedef typename GraphWrapper::InEdgeIt InEdgeIt;
-    class InEdgeIt : public GraphWrapper::InEdgeIt { 
-    public:
-      InEdgeIt() { }
-      InEdgeIt(const typename GraphWrapper::InEdgeIt& e) : 
-	GraphWrapper::InEdgeIt(e) { }
-      InEdgeIt(const Invalid& i) : GraphWrapper::InEdgeIt(i) { }
-      InEdgeIt(const GraphWrapperSkeleton1<GraphWrapper>& _G, const Node& n) : 
-	GraphWrapper::InEdgeIt(*(_G.g), n) { }
-    };
-    //typedef typename GraphWrapper::SymEdgeIt SymEdgeIt;
-    //typedef typename GraphWrapper::EdgeIt EdgeIt;
-    class EdgeIt : public GraphWrapper::EdgeIt { 
-    public:
-      EdgeIt() { }
-      EdgeIt(const typename GraphWrapper::EdgeIt& e) : 
-	GraphWrapper::EdgeIt(e) { }
-      EdgeIt(const Invalid& i) : GraphWrapper::EdgeIt(i) { }
-      EdgeIt(const GraphWrapperSkeleton1<GraphWrapper>& _G) : 
-	GraphWrapper::EdgeIt(*(_G.g)) { }
-    };
-
-
-    //GraphWrapperSkeleton() : gw() { }
-    GraphWrapperSkeleton1(GraphWrapper& _gw) : g(&_gw) { }
-
-    //void setGraph(BaseGraph& _graph) { gw.setGraph(_graph); }
-    //BaseGraph& getGraph() const { return gw.getGraph(); }
-    
-    template<typename I> I& first(I& i) const {       
-      i=I(*this);
-      return i;
-    }
-    template<typename I, typename P> I& first(I& i, const P& p) const { 
-      i=I(*this, p);
-      return i; 
-    }
-    
-//    template<typename I> I getNext(const I& i) const { return gw.getNext(i); }
-    template<typename I> I& next(I &i) const { g->next(i); return i; }    
-
-    template< typename It > It first() const { 
-      It e; this->first(e); return e; }
-
-    template< typename It > It first(const Node& v) const { 
-      It e; this->first(e, v); return e; }
-
-    Node head(const Edge& e) const { return g->head(e); }
-    Node tail(const Edge& e) const { return g->tail(e); }
-
-    template<typename I> bool valid(const I& i) const { return g->valid(i); }
-  
-    //template<typename I> void setInvalid(const I &i);
-    //{ return graph->setInvalid(i); }
-
-    int nodeNum() const { return g->nodeNum(); }
-    int edgeNum() const { return g->edgeNum(); }
-  
-    template<typename I> Node aNode(const I& e) const { return g->aNode(e); }
-    template<typename I> Node bNode(const I& e) const { return g->bNode(e); }
-  
-    Node addNode() const { return g->addNode(); }
-    Edge addEdge(const Node& tail, const Node& head) const { 
-      return g->addEdge(tail, head); }
-  
-    template<typename I> void erase(const I& i) const { g->erase(i); }
-  
-    void clear() const { g->clear(); }
-    
-    template<typename T> class NodeMap : public GraphWrapper::NodeMap<T> { 
-    public:
-      NodeMap(const GraphWrapperSkeleton1<GraphWrapper>& _G) :  
-	GraphWrapper::NodeMap<T>(*(_G.g)) { }
-      NodeMap(const GraphWrapperSkeleton1<GraphWrapper>& _G, T a) : 
-	GraphWrapper::NodeMap<T>(*(_G.g), a) { }
-    };
-
-    template<typename T> class EdgeMap : public GraphWrapper::EdgeMap<T> { 
-    public:
-      EdgeMap(const GraphWrapperSkeleton1<GraphWrapper>& _G) :  
-	GraphWrapper::EdgeMap<T>(*(_G.g)) { }
-      EdgeMap(const GraphWrapperSkeleton1<GraphWrapper>& _G, T a) : 
-	GraphWrapper::EdgeMap<T>(*(_G.g), a) { }
+      return graph->addEdge(tail, head); }
+  
+    template<typename I> void erase(const I& i) const { graph->erase(i); }
+  
+    void clear() const { graph->clear(); }
+    
+    template<typename T> class NodeMap : public Graph::NodeMap<T> { 
+    public:
+      NodeMap(const GraphWrapper<Graph>& _G) :  
+	Graph::NodeMap<T>(*(_G.graph)) { }
+      NodeMap(const GraphWrapper<Graph>& _G, T a) : 
+	Graph::NodeMap<T>(*(_G.graph), a) { }
+    };
+
+    template<typename T> class EdgeMap : public Graph::EdgeMap<T> { 
+    public:
+      EdgeMap(const GraphWrapper<Graph>& _G) :  
+	Graph::EdgeMap<T>(*(_G.graph)) { }
+      EdgeMap(const GraphWrapper<Graph>& _G, T a) : 
+	Graph::EdgeMap<T>(*(_G.graph), a) { }
     };
   };
@@ -490,95 +359,12 @@
 //   };
 
-//   template<typename /*Graph*/GraphWrapper
-//   /*=typename GraphWrapperSkeleton< TrivGraphWrapper<Graph>*/ >
-//   class RevGraphWrapper : 
-//     public GraphWrapper/*GraphWrapperSkeleton< TrivGraphWrapper<Graph> >*/ {
-//   protected:
-//     //Graph* graph;
-    
-//   public:
-//     //typedef Graph BaseGraph;
-
-//     //typedef typename Graph::Node Node;    
-//     //typedef typename Graph::NodeIt NodeIt;
-  
-//     //typedef typename Graph::Edge Edge;
-//     typedef typename GraphWrapper/*typename GraphWrapperSkeleton< TrivGraphWrapper<Graph> >*/::OutEdgeIt InEdgeIt;
-//     typedef typename GraphWrapper/*typename GraphWrapperSkeleton< TrivGraphWrapper<Graph> >*/::InEdgeIt OutEdgeIt;
-//     //typedef typename Graph::SymEdgeIt SymEdgeIt;
-//     //typedef typename Graph::EdgeIt EdgeIt;
-
-//     //RevGraphWrapper() : graph(0) { }
-//     RevGraphWrapper(GraphWrapper _gw/*BaseGraph& _graph*/) : GraphWrapper/*GraphWrapperSkeleton< TrivGraphWrapper<Graph> >*/(_gw/*TrivGraphWrapper<Graph>(_graph)*/) { }
-    
-//     //void setGraph(Graph& _graph) { graph = &_graph; }
-//     //Graph& getGraph() const { return (*graph); }
-    
-//     //template<typename I> I& first(I& i) const { return graph->first(i); }
-//     //template<typename I, typename P> I& first(I& i, const P& p) const { 
-//     //  return graph->first(i, p); }
-
-//     //template<typename I> I getNext(const I& i) const { 
-//     //  return graph->getNext(i); }
-//     //template<typename I> I& next(I &i) const { return graph->next(i); }    
-
-//     //template< typename It > It first() const { 
-//     //  It e; first(e); return e; }
-
-//     //template< typename It > It first(const Node& v) const { 
-//     //  It e; first(e, v); return e; }
-
-//     //Node head(const Edge& e) const { return graph->tail(e); }
-//     //Node tail(const Edge& e) const { return graph->head(e); }
-  
-//     //template<typename I> bool valid(const I& i) const 
-//     //  { return graph->valid(i); }
-  
-//     //template<typename I> void setInvalid(const I &i);
-//     //{ return graph->setInvalid(i); }
-  
-//     //template<typename I> Node aNode(const I& e) const { 
-//     //  return graph->aNode(e); }
-//     //template<typename I> Node bNode(const I& e) const { 
-//     //  return graph->bNode(e); }
-
-//     //Node addNode() const { return graph->addNode(); }
-//     //Edge addEdge(const Node& tail, const Node& head) const { 
-//     //  return graph->addEdge(tail, head); }
-  
-//     //int nodeNum() const { return graph->nodeNum(); }
-//     //int edgeNum() const { return graph->edgeNum(); }
-  
-//     //template<typename I> void erase(const I& i) const { graph->erase(i); }
-  
-//     //void clear() const { graph->clear(); }
-
-//     template<typename T> class NodeMap : 
-//       public GraphWrapper/*Skeleton< TrivGraphWrapper<Graph> >*/::NodeMap<T> 
-//     { 
-//     public:
-//       NodeMap(const RevGraphWrapper<GraphWrapper>& _gw) : 
-// 	GraphWrapper/*Skeleton< TrivGraphWrapper<Graph> >*/::NodeMap<T>(_gw) { }
-//       NodeMap(const RevGraphWrapper<GraphWrapper>& _gw, T a) : 
-// 	GraphWrapper/*Skeleton< TrivGraphWrapper<Graph> >*/::NodeMap<T>(_gw, a) { }
-//     };
-    
-//     template<typename T> class EdgeMap : 
-//       public GraphWrapper/*Skeleton< TrivGraphWrapper<Graph> >*/::EdgeMap<T> { 
-//     public:
-//       EdgeMap(const RevGraphWrapper<GraphWrapper>& _gw) : 
-// 	GraphWrapper/*Skeleton< TrivGraphWrapper<Graph> >*/::EdgeMap<T>(_gw) { }
-//       EdgeMap(const RevGraphWrapper<GraphWrapper>& _gw, T a) : 
-// 	GraphWrapper/*Skeleton< TrivGraphWrapper<Graph> >*/::EdgeMap<T>(_gw, a) { }
-//     };
-//   };
-
-  template<typename GraphWrapper>
-  class RevGraphWrapper : public GraphWrapperSkeleton1<GraphWrapper> {
+
+  template<typename Graph>
+  class RevGraphWrapper : public GraphWrapper<Graph> {
   public:
-    typedef typename GraphWrapperSkeleton1<GraphWrapper>::Node Node;
-    typedef typename GraphWrapperSkeleton1<GraphWrapper>::Edge Edge;
+    typedef typename GraphWrapper<Graph>::Node Node;
+    typedef typename GraphWrapper<Graph>::Edge Edge;
     //FIXME 
-    //If GraphWrapper::OutEdgeIt is not defined
+    //If Graph::OutEdgeIt is not defined
     //and we do not want to use RevGraphWrapper::InEdgeIt,
     //this won't work, because of typedef
@@ -587,40 +373,41 @@
     //Unfortunately all the typedefs are instantiated in templates, 
     //unlike other stuff
-    typedef typename GraphWrapperSkeleton1<GraphWrapper>::OutEdgeIt InEdgeIt;
-    typedef typename GraphWrapperSkeleton1<GraphWrapper>::InEdgeIt OutEdgeIt;
-
-    RevGraphWrapper(GraphWrapper& _gw) : 
-      GraphWrapperSkeleton1<GraphWrapper>(_gw) { }  
+    typedef typename GraphWrapper<Graph>::OutEdgeIt InEdgeIt;
+    typedef typename GraphWrapper<Graph>::InEdgeIt OutEdgeIt;
+
+//     RevGraphWrapper() : GraphWrapper<Graph>() { }
+    RevGraphWrapper(Graph& _graph) : GraphWrapper<Graph>(_graph) { }  
 
     Node head(const Edge& e) const 
-      { return GraphWrapperSkeleton1<GraphWrapper>::tail(e); }
+      { return GraphWrapper<Graph>::tail(e); }
     Node tail(const Edge& e) const 
-      { return GraphWrapperSkeleton1<GraphWrapper>::head(e); }
+      { return GraphWrapper<Graph>::head(e); }
   };
 
   //Subgraph on the same node-set and partial edge-set
-  template<typename GraphWrapper, typename EdgeFilterMap>
-  class SubGraphWrapper : public GraphWrapperSkeleton1<GraphWrapper> {
+  template<typename Graph, typename EdgeFilterMap>
+  class SubGraphWrapper : public GraphWrapper<Graph> {
   protected:
     EdgeFilterMap* filter_map;
   public:
-    typedef typename GraphWrapperSkeleton1<GraphWrapper>::Node Node;
-    typedef typename GraphWrapperSkeleton1<GraphWrapper>::NodeIt NodeIt;
-    typedef typename GraphWrapperSkeleton1<GraphWrapper>::Edge Edge;
-    typedef typename GraphWrapperSkeleton1<GraphWrapper>::EdgeIt EdgeIt;
-    typedef typename GraphWrapperSkeleton1<GraphWrapper>::InEdgeIt InEdgeIt;
-    typedef typename GraphWrapperSkeleton1<GraphWrapper>::OutEdgeIt OutEdgeIt;
-
-    SubGraphWrapper(GraphWrapper& _gw, EdgeFilterMap& _filter_map) : 
-      GraphWrapperSkeleton1<GraphWrapper>(_gw), filter_map(&_filter_map) { }  
+    typedef typename GraphWrapper<Graph>::Node Node;
+    typedef typename GraphWrapper<Graph>::NodeIt NodeIt;
+    typedef typename GraphWrapper<Graph>::Edge Edge;
+    typedef typename GraphWrapper<Graph>::EdgeIt EdgeIt;
+    typedef typename GraphWrapper<Graph>::InEdgeIt InEdgeIt;
+    typedef typename GraphWrapper<Graph>::OutEdgeIt OutEdgeIt;
+
+//     SubGraphWrapper() : GraphWrapper<Graph>(), filter_map(0) { }
+    SubGraphWrapper(Graph& _graph, EdgeFilterMap& _filter_map) : 
+      GraphWrapper<Graph>(_graph), filter_map(&_filter_map) { }  
 
     template<typename I> I& first(I& i) const { 
-      g->first(i); 
-      while (g->valid(i) && !filter_map->get(i)) { g->next(i); }
+      graph->first(i); 
+      while (graph->valid(i) && !filter_map->get(i)) { graph->next(i); }
       return i;
     }
     template<typename I, typename P> I& first(I& i, const P& p) const { 
-      g->first(i, p); 
-      while (g->valid(i) && !filter_map->get(i)) { g->next(i); }
+      graph->first(i, p); 
+      while (graph->valid(i) && !filter_map->get(i)) { graph->next(i); }
       return i;
     }
@@ -630,6 +417,6 @@
     //}
     template<typename I> I& next(I &i) const { 
-      g->next(i); 
-      while (g->valid(i) && !filter_map->get(i)) { g->next(i); }
+      graph->next(i); 
+      while (graph->valid(i) && !filter_map->get(i)) { graph->next(i); }
       return i;
     }
@@ -802,37 +589,19 @@
 
 
-  template<typename GraphWrapper>
-  class UndirGraphWrapper : public GraphWrapperSkeleton1<GraphWrapper> {
+  template<typename Graph>
+  class UndirGraphWrapper : public GraphWrapper<Graph> {
   protected:
-//    GraphWrapper gw;
-
+    typedef typename Graph::Edge GraphEdge;
+    typedef typename Graph::OutEdgeIt GraphOutEdgeIt;
+    typedef typename Graph::InEdgeIt GraphInEdgeIt;    
   public:
-    //typedef GraphWrapper BaseGraph;
-
-    typedef typename GraphWrapperSkeleton1<GraphWrapper>::Node Node;
-    typedef typename GraphWrapperSkeleton1<GraphWrapper>::NodeIt NodeIt;
-
-    //private:
-    //FIXME ezeknek valojaban a GraphWrapper megfelelo dolgai kellene hogy 
-    //legyenek, at kell irni
-    typedef typename /*GraphWrapperSkeleton<GraphWrapper>*/
-    GraphWrapper::Edge GraphEdge;
-    typedef typename /*GraphWrapperSkeleton<GraphWrapper>*/ 
-    GraphWrapper::OutEdgeIt GraphOutEdgeIt;
-    typedef typename /*GraphWrapperSkeleton<GraphWrapper>*/ 
-    GraphWrapper::InEdgeIt GraphInEdgeIt;
-    //public:
-
-    //UndirGraphWrapper() : graph(0) { }
-    UndirGraphWrapper(GraphWrapper& _gw) : 
-      GraphWrapperSkeleton1<GraphWrapper>(_gw) { }  
-
-    //UndirGraphWrapper(GraphWrapper _gw) : gw(_gw) { }
-
-    //void setGraph(Graph& _graph) { graph = &_graph; }
-    //Graph& getGraph() const { return (*graph); }
-  
+    typedef typename GraphWrapper<Graph>::Node Node;
+    typedef typename GraphWrapper<Graph>::NodeIt NodeIt;
+
+//     UndirGraphWrapper() : GraphWrapper<Graph>() { }
+    UndirGraphWrapper(Graph& _graph) : GraphWrapper<Graph>(_graph) { }  
+
     class Edge {
-      friend class UndirGraphWrapper<GraphWrapper>;
+      friend class UndirGraphWrapper<Graph>;
     protected:
       bool out_or_in; //true iff out
@@ -867,12 +636,12 @@
 
     class OutEdgeIt : public Edge {
-      friend class UndirGraphWrapper<GraphWrapper>;
+      friend class UndirGraphWrapper<Graph>;
     public:
       OutEdgeIt() : Edge() { }
       OutEdgeIt(const Invalid& i) : Edge(i) { }
-      OutEdgeIt(const UndirGraphWrapper<GraphWrapper>& _G, const Node& n) 
+      OutEdgeIt(const UndirGraphWrapper<Graph>& _G, const Node& n) 
 	: Edge() { 
-	out_or_in=true; _G.g->first(out, n);
-	if (!(_G.g->valid(out))) { out_or_in=false; _G.g->first(in, n);	}
+	out_or_in=true; _G.graph->first(out, n);
+	if (!(_G.graph->valid(out))) { out_or_in=false; _G.graph->first(in, n);	}
       }
     };
@@ -881,5 +650,5 @@
 
     class EdgeIt : public Edge {
-      friend class UndirGraphWrapper<GraphWrapper>;
+      friend class UndirGraphWrapper<Graph>;
     protected:
       NodeIt v;
@@ -887,13 +656,13 @@
       EdgeIt() : Edge() { }
       EdgeIt(const Invalid& i) : Edge(i) { }
-      EdgeIt(const UndirGraphWrapper<GraphWrapper>& _G) 
+      EdgeIt(const UndirGraphWrapper<Graph>& _G) 
 	: Edge() { 
 	out_or_in=true;
 	//Node v;
 	_G.first(v);
-	if (_G.valid(v)) _G.g->first(out); else out=INVALID;
-	while (_G.valid(v) && !_G.g->valid(out)) { 
-	  _G.g->next(v); 
-	  if (_G.valid(v)) _G.g->first(out); 
+	if (_G.valid(v)) _G.graph->first(out); else out=INVALID;
+	while (_G.valid(v) && !_G.graph->valid(out)) { 
+	  _G.graph->next(v); 
+	  if (_G.valid(v)) _G.graph->first(out); 
 	}
       }
@@ -901,6 +670,6 @@
 
     OutEdgeIt& first(OutEdgeIt& e, const Node& n) const {
-      e.out_or_in=true; g->first(e.out, n);
-      if (!(g->valid(e.out))) { e.out_or_in=false; g->first(e.in, n); }
+      e.out_or_in=true; graph->first(e.out, n);
+      if (!(graph->valid(e.out))) { e.out_or_in=false; graph->first(e.in, n); }
       return e;
     }
@@ -910,23 +679,23 @@
       //NodeIt v;
       first(e.v);
-      if (valid(e.v)) g->first(e.out, e.v); else e.out=INVALID;
-      while (valid(e.v) && !g->valid(e.out)) { 
-	g->next(e.v); 
-	if (valid(e.v)) g->first(e.out, e.v); 
+      if (valid(e.v)) graph->first(e.out, e.v); else e.out=INVALID;
+      while (valid(e.v) && !graph->valid(e.out)) { 
+	graph->next(e.v); 
+	if (valid(e.v)) graph->first(e.out, e.v); 
       }
       return e;
     }
 
-    template<typename I> I& first(I& i) const { g->first(i); return i; }
+    template<typename I> I& first(I& i) const { graph->first(i); return i; }
     template<typename I, typename P> I& first(I& i, const P& p) const { 
-      g->first(i, p); return i; }
+      graph->first(i, p); return i; }
 
     OutEdgeIt& next(OutEdgeIt& e) const {
       if (e.out_or_in) {
-	Node n=g->tail(e.out);
-	g->next(e.out);
-	if (!g->valid(e.out)) { e.out_or_in=false; g->first(e.in, n); }
+	Node n=graph->tail(e.out);
+	graph->next(e.out);
+	if (!graph->valid(e.out)) { e.out_or_in=false; graph->first(e.in, n); }
       } else {
-	g->next(e.in);
+	graph->next(e.in);
       }
       return e;
@@ -935,20 +704,20 @@
     EdgeIt& next(EdgeIt& e) const {
       //NodeIt v=tail(e);
-      g->next(e.out);
-      while (valid(e.v) && !g->valid(e.out)) { 
+      graph->next(e.out);
+      while (valid(e.v) && !graph->valid(e.out)) { 
 	next(e.v); 
-	if (valid(e.v)) g->first(e.out, e.v); 
+	if (valid(e.v)) graph->first(e.out, e.v); 
       }
       return e;
     }
 
-    template<typename I> I& next(I &i) const { return g->next(i); }    
+    template<typename I> I& next(I &i) const { return graph->next(i); }    
 //    template<typename I> I getNext(const I& i) const { return gw.getNext(i); }
 
     template< typename It > It first() const { 
-      It e; first(e); return e; }
+      It e; this->first(e); return e; }
 
     template< typename It > It first(const Node& v) const { 
-      It e; first(e, v); return e; }
+      It e; this->first(e, v); return e; }
 
 //    Node head(const Edge& e) const { return gw.head(e); }
@@ -967,7 +736,7 @@
 
     Node aNode(const OutEdgeIt& e) const { 
-      if (e.out_or_in) return g->tail(e); else return g->head(e); }
+      if (e.out_or_in) return graph->tail(e); else return graph->head(e); }
     Node bNode(const OutEdgeIt& e) const { 
-      if (e.out_or_in) return g->head(e); else return g->tail(e); }
+      if (e.out_or_in) return graph->head(e); else return graph->tail(e); }
   
 //    Node addNode() const { return gw.addNode(); }
@@ -981,19 +750,19 @@
 //    void clear() const { gw.clear(); }
     
-//     template<typename T> class NodeMap : public GraphWrapper::NodeMap<T> { 
+//     template<typename T> class NodeMap : public Graph::NodeMap<T> { 
 //     public:
-//       NodeMap(const UndirGraphWrapper<GraphWrapper>& _G) : 
-// 	GraphWrapper::NodeMap<T>(_G.gw) { }
-//       NodeMap(const UndirGraphWrapper<GraphWrapper>& _G, T a) : 
-// 	GraphWrapper::NodeMap<T>(_G.gw, a) { }
+//       NodeMap(const UndirGraphWrapper<Graph>& _G) : 
+// 	Graph::NodeMap<T>(_G.gw) { }
+//       NodeMap(const UndirGraphWrapper<Graph>& _G, T a) : 
+// 	Graph::NodeMap<T>(_G.gw, a) { }
 //     };
 
 //     template<typename T> class EdgeMap : 
-//       public GraphWrapperSkeleton<GraphWrapper>::EdgeMap<T> { 
+//       public GraphWrapperSkeleton<Graph>::EdgeMap<T> { 
 //     public:
-//       EdgeMap(const UndirGraphWrapper<GraphWrapper>& _G) : 
-// 	GraphWrapperSkeleton<GraphWrapper>::EdgeMap<T>(_G.gw) { }
-//       EdgeMap(const UndirGraphWrapper<GraphWrapper>& _G, T a) : 
-// 	GraphWrapper::EdgeMap<T>(_G.gw, a) { }
+//       EdgeMap(const UndirGraphWrapper<Graph>& _G) : 
+// 	GraphWrapperSkeleton<Graph>::EdgeMap<T>(_G.gw) { }
+//       EdgeMap(const UndirGraphWrapper<Graph>& _G, T a) : 
+// 	Graph::EdgeMap<T>(_G.gw, a) { }
 //     };
    };
@@ -1072,30 +841,19 @@
 
 
-  template<typename GraphWrapper, typename Number, typename FlowMap, typename CapacityMap>
-  class ResGraphWrapper : public GraphWrapperSkeleton1<GraphWrapper>{
+  template<typename Graph, typename Number, typename FlowMap, typename CapacityMap>
+  class ResGraphWrapper : public GraphWrapper<Graph>{
   public:
-    //typedef Graph BaseGraph;
-    //typedef TrivGraphWrapper<const Graph> GraphWrapper;
-    typedef typename GraphWrapperSkeleton1<GraphWrapper>::Node Node;
-    typedef typename GraphWrapperSkeleton1<GraphWrapper>::NodeIt NodeIt;
-  private:
-    typedef typename /*GraphWrapperSkeleton<GraphWrapper>*/
-    GraphWrapper::OutEdgeIt OldOutEdgeIt;
-    typedef typename /*GraphWrapperSkeleton<GraphWrapper>*/
-    GraphWrapper::InEdgeIt OldInEdgeIt;
+    typedef typename GraphWrapper<Graph>::Node Node;
+    typedef typename GraphWrapper<Graph>::NodeIt NodeIt;
   protected:
-    //const Graph* graph;
-    //GraphWrapper gw;
+    typedef typename Graph::OutEdgeIt OldOutEdgeIt;
+    typedef typename Graph::InEdgeIt OldInEdgeIt;
     FlowMap* flow;
     const CapacityMap* capacity;
   public:
 
-    ResGraphWrapper(GraphWrapper& _gw, FlowMap& _flow, 
+    ResGraphWrapper(Graph& _graph, FlowMap& _flow, 
 		    const CapacityMap& _capacity) : 
-      GraphWrapperSkeleton1<GraphWrapper>(_gw), 
-      flow(&_flow), capacity(&_capacity) { }
-
-    //void setGraph(const Graph& _graph) { graph = &_graph; }
-    //const Graph& getGraph() const { return (*graph); }
+      GraphWrapper<Graph>(_graph), flow(&_flow), capacity(&_capacity) { }
 
     class Edge; 
@@ -1105,5 +863,5 @@
 
     class Edge {
-      friend class ResGraphWrapper<GraphWrapper, Number, FlowMap, CapacityMap>;
+      friend class ResGraphWrapper<Graph, Number, FlowMap, CapacityMap>;
     protected:
       bool out_or_in; //true, iff out
@@ -1131,5 +889,5 @@
 
     class OutEdgeIt : public Edge {
-      friend class ResGraphWrapper<GraphWrapper, Number, FlowMap, CapacityMap>;
+      friend class ResGraphWrapper<Graph, Number, FlowMap, CapacityMap>;
     public:
       OutEdgeIt() { }
@@ -1138,11 +896,11 @@
       OutEdgeIt(const Invalid& i) : Edge(i) { }
     protected:
-      OutEdgeIt(const ResGraphWrapper<GraphWrapper, Number, FlowMap, CapacityMap>& resG, Node v) : Edge() { 
-	resG.g->first(out, v);
-	while( resG.g->valid(out) && !(resG.resCap(out)>0) ) { resG.g->next(out); }
-	if (!resG.g->valid(out)) {
+      OutEdgeIt(const ResGraphWrapper<Graph, Number, FlowMap, CapacityMap>& resG, Node v) : Edge() { 
+	resG.graph->first(out, v);
+	while( resG.graph->valid(out) && !(resG.resCap(out)>0) ) { resG.graph->next(out); }
+	if (!resG.graph->valid(out)) {
 	  out_or_in=0;
-	  resG.g->first(in, v);
-	  while( resG.g->valid(in) && !(resG.resCap(in)>0) ) { resG.g->next(in); }
+	  resG.graph->first(in, v);
+	  while( resG.graph->valid(in) && !(resG.resCap(in)>0) ) { resG.graph->next(in); }
 	}
       }
@@ -1170,5 +928,5 @@
 
     class EdgeIt : public Edge {
-      friend class ResGraphWrapper<GraphWrapper, Number, FlowMap, CapacityMap>;
+      friend class ResGraphWrapper<Graph, Number, FlowMap, CapacityMap>;
       NodeIt v; 
     public:
@@ -1176,22 +934,22 @@
       //EdgeIt(const EdgeIt& e) : Edge(e), v(e.v) { }
       EdgeIt(const Invalid& i) : Edge(i) { }
-      EdgeIt(const ResGraphWrapper<GraphWrapper, Number, FlowMap, CapacityMap>& resG) : Edge() { 
-	resG.g->first(v);
-	if (resG.g->valid(v)) resG.g->first(out, v); else out=INVALID;
-	while (resG.g->valid(out) && !(resG.resCap(out)>0) ) { resG.g->next(out); }
-	while (resG.g->valid(v) && !resG.g->valid(out)) { 
-	  resG.g->next(v); 
-	  if (resG.g->valid(v)) resG.g->first(out, v); 
-	  while (resG.g->valid(out) && !(resG.resCap(out)>0) ) { resG.g->next(out); }
+      EdgeIt(const ResGraphWrapper<Graph, Number, FlowMap, CapacityMap>& resG) : Edge() { 
+	resG.graph->first(v);
+	if (resG.graph->valid(v)) resG.graph->first(out, v); else out=INVALID;
+	while (resG.graph->valid(out) && !(resG.resCap(out)>0) ) { resG.graph->next(out); }
+	while (resG.graph->valid(v) && !resG.graph->valid(out)) { 
+	  resG.graph->next(v); 
+	  if (resG.graph->valid(v)) resG.graph->first(out, v); 
+	  while (resG.graph->valid(out) && !(resG.resCap(out)>0) ) { resG.graph->next(out); }
 	}
-	if (!resG.g->valid(out)) {
+	if (!resG.graph->valid(out)) {
 	  out_or_in=0;
-	  resG.g->first(v);
-	  if (resG.g->valid(v)) resG.g->first(in, v); else in=INVALID;
-	  while (resG.g->valid(in) && !(resG.resCap(in)>0) ) { resG.g->next(in); }
-	  while (resG.g->valid(v) && !resG.g->valid(in)) { 
-	    resG.g->next(v); 
-	    if (resG.g->valid(v)) resG.g->first(in, v); 
-	    while (resG.g->valid(in) && !(resG.resCap(in)>0) ) { resG.g->next(in); }
+	  resG.graph->first(v);
+	  if (resG.graph->valid(v)) resG.graph->first(in, v); else in=INVALID;
+	  while (resG.graph->valid(in) && !(resG.resCap(in)>0) ) { resG.graph->next(in); }
+	  while (resG.graph->valid(v) && !resG.graph->valid(in)) { 
+	    resG.graph->next(v); 
+	    if (resG.graph->valid(v)) resG.graph->first(in, v); 
+	    while (resG.graph->valid(in) && !(resG.resCap(in)>0) ) { resG.graph->next(in); }
 	  }
 	}
@@ -1230,5 +988,5 @@
     };
 
-    NodeIt& first(NodeIt& v) const { g->first(v); return v; }
+    NodeIt& first(NodeIt& v) const { graph->first(v); return v; }
     OutEdgeIt& first(OutEdgeIt& e, Node v) const { 
       e=OutEdgeIt(*this, v); 
@@ -1240,19 +998,19 @@
     }
    
-    NodeIt& next(NodeIt& n) const { return g->next(n); }
+    NodeIt& next(NodeIt& n) const { return graph->next(n); }
 
     OutEdgeIt& next(OutEdgeIt& e) const { 
       if (e.out_or_in) {
-	Node v=g->aNode(e.out);
-	g->next(e.out);
-	while( g->valid(e.out) && !(resCap(e.out)>0) ) { g->next(e.out); }
-	if (!g->valid(e.out)) {
+	Node v=graph->aNode(e.out);
+	graph->next(e.out);
+	while( graph->valid(e.out) && !(resCap(e.out)>0) ) { graph->next(e.out); }
+	if (!graph->valid(e.out)) {
 	  e.out_or_in=0;
-	  g->first(e.in, v); 
-	  while( g->valid(e.in) && !(resCap(e.in)>0) ) { g->next(e.in); }
+	  graph->first(e.in, v); 
+	  while( graph->valid(e.in) && !(resCap(e.in)>0) ) { graph->next(e.in); }
 	}
       } else {
-	g->next(e.in);
-	while( g->valid(e.in) && !(resCap(e.in)>0) ) { g->next(e.in); } 
+	graph->next(e.in);
+	while( graph->valid(e.in) && !(resCap(e.in)>0) ) { graph->next(e.in); } 
       }
       return e;
@@ -1261,29 +1019,29 @@
     EdgeIt& next(EdgeIt& e) const { 
       if (e.out_or_in) {
-	g->next(e.out);
-	while (g->valid(e.out) && !(resCap(e.out)>0) ) { g->next(e.out); }
-	  while (g->valid(e.v) && !g->valid(e.out)) { 
-	    g->next(e.v); 
-	    if (g->valid(e.v)) g->first(e.out, e.v); 
-	    while (g->valid(e.out) && !(resCap(e.out)>0) ) { g->next(e.out); }
+	graph->next(e.out);
+	while (graph->valid(e.out) && !(resCap(e.out)>0) ) { graph->next(e.out); }
+	  while (graph->valid(e.v) && !graph->valid(e.out)) { 
+	    graph->next(e.v); 
+	    if (graph->valid(e.v)) graph->first(e.out, e.v); 
+	    while (graph->valid(e.out) && !(resCap(e.out)>0) ) { graph->next(e.out); }
 	  }
-	  if (!g->valid(e.out)) {
+	  if (!graph->valid(e.out)) {
 	    e.out_or_in=0;
-	    g->first(e.v);
-	    if (g->valid(e.v)) g->first(e.in, e.v); else e.in=INVALID;
-	    while (g->valid(e.in) && !(resCap(e.in)>0) ) { g->next(e.in); }
-	    while (g->valid(e.v) && !g->valid(e.in)) { 
-	      g->next(e.v); 
-	      if (g->valid(e.v)) g->first(e.in, e.v); 
-	      while (g->valid(e.in) && !(resCap(e.in)>0) ) { g->next(e.in); }
+	    graph->first(e.v);
+	    if (graph->valid(e.v)) graph->first(e.in, e.v); else e.in=INVALID;
+	    while (graph->valid(e.in) && !(resCap(e.in)>0) ) { graph->next(e.in); }
+	    while (graph->valid(e.v) && !graph->valid(e.in)) { 
+	      graph->next(e.v); 
+	      if (graph->valid(e.v)) graph->first(e.in, e.v); 
+	      while (graph->valid(e.in) && !(resCap(e.in)>0) ) { graph->next(e.in); }
 	    }  
 	  }
 	} else {
-	  g->next(e.in);
-	  while (g->valid(e.in) && !(resCap(e.in)>0) ) { g->next(e.in); }
-	  while (g->valid(e.v) && !g->valid(e.in)) { 
-	    g->next(e.v); 
-	    if (g->valid(e.v)) g->first(e.in, e.v); 
-	    while (g->valid(e.in) && !(resCap(e.in)>0) ) { g->next(e.in); }
+	  graph->next(e.in);
+	  while (graph->valid(e.in) && !(resCap(e.in)>0) ) { graph->next(e.in); }
+	  while (graph->valid(e.v) && !graph->valid(e.in)) { 
+	    graph->next(e.v); 
+	    if (graph->valid(e.v)) graph->first(e.in, e.v); 
+	    while (graph->valid(e.in) && !(resCap(e.in)>0) ) { graph->next(e.in); }
 	  }
 	}
@@ -1307,23 +1065,23 @@
 
     Node tail(Edge e) const { 
-      return ((e.out_or_in) ? g->aNode(e.out) : g->aNode(e.in)); }
+      return ((e.out_or_in) ? graph->aNode(e.out) : graph->aNode(e.in)); }
     Node head(Edge e) const { 
-      return ((e.out_or_in) ? g->bNode(e.out) : g->bNode(e.in)); }
+      return ((e.out_or_in) ? graph->bNode(e.out) : graph->bNode(e.in)); }
 
     Node aNode(OutEdgeIt e) const { 
-      return ((e.out_or_in) ? g->aNode(e.out) : g->aNode(e.in)); }
+      return ((e.out_or_in) ? graph->aNode(e.out) : graph->aNode(e.in)); }
     Node bNode(OutEdgeIt e) const { 
-      return ((e.out_or_in) ? g->bNode(e.out) : g->bNode(e.in)); }
-
-    int nodeNum() const { return g->nodeNum(); }
+      return ((e.out_or_in) ? graph->bNode(e.out) : graph->bNode(e.in)); }
+
+    int nodeNum() const { return graph->nodeNum(); }
     //FIXME
-    //int edgeNum() const { return g->edgeNum(); }
-
-
-    int id(Node v) const { return g->id(v); }
-
-    bool valid(Node n) const { return g->valid(n); }
+    //int edgeNum() const { return graph->edgeNum(); }
+
+
+    int id(Node v) const { return graph->id(v); }
+
+    bool valid(Node n) const { return graph->valid(n); }
     bool valid(Edge e) const { 
-      return e.out_or_in ? g->valid(e.out) : g->valid(e.in); }
+      return e.out_or_in ? graph->valid(e.out) : graph->valid(e.in); }
 
     void augment(const Edge& e, Number a) const {
@@ -1349,10 +1107,10 @@
     }
 
-//     template<typename T> class NodeMap : public GraphWrapper::NodeMap<T> { 
+//     template<typename T> class NodeMap : public Graph::NodeMap<T> { 
 //     public:
-//       NodeMap(const ResGraphWrapper<GraphWrapper, Number, FlowMap, CapacityMap>& _G) 
-// 	: GraphWrapper::NodeMap<T>(_G.gw) { }
-//       NodeMap(const ResGraphWrapper<GraphWrapper, Number, FlowMap, CapacityMap>& _G, 
-// 	      T a) : GraphWrapper::NodeMap<T>(_G.gw, a) { }
+//       NodeMap(const ResGraphWrapper<Graph, Number, FlowMap, CapacityMap>& _G) 
+// 	: Graph::NodeMap<T>(_G.gw) { }
+//       NodeMap(const ResGraphWrapper<Graph, Number, FlowMap, CapacityMap>& _G, 
+// 	      T a) : Graph::NodeMap<T>(_G.gw, a) { }
 //     };
 
@@ -1369,8 +1127,8 @@
     template <typename T>
     class EdgeMap {
-      typename GraphWrapper::EdgeMap<T> forward_map, backward_map; 
-    public:
-      EdgeMap(const ResGraphWrapper<GraphWrapper, Number, FlowMap, CapacityMap>& _G) : forward_map(_G.gw), backward_map(_G.gw) { }
-      EdgeMap(const ResGraphWrapper<GraphWrapper, Number, FlowMap, CapacityMap>& _G, T a) : forward_map(_G.gw, a), backward_map(_G.gw, a) { }
+      typename Graph::EdgeMap<T> forward_map, backward_map; 
+    public:
+      EdgeMap(const ResGraphWrapper<Graph, Number, FlowMap, CapacityMap>& _G) : forward_map(*(_G.graph)), backward_map(*(_G.graph)) { }
+      EdgeMap(const ResGraphWrapper<Graph, Number, FlowMap, CapacityMap>& _G, T a) : forward_map(*(_G.graph), a), backward_map(*(_G.graph), a) { }
       void set(Edge e, T a) { 
 	if (e.out_or_in) 
@@ -1388,23 +1146,23 @@
   };
 
-  //Subgraph on the same node-set and partial edge-set
-  template<typename GraphWrapper, typename FirstOutEdgesMap>
-  class ErasingFirstGraphWrapper : public GraphWrapperSkeleton1<GraphWrapper> {
+  //ErasingFirstGraphWrapper for blocking flows
+  template<typename Graph, typename FirstOutEdgesMap>
+  class ErasingFirstGraphWrapper : public GraphWrapper<Graph> {
   protected:
     FirstOutEdgesMap* first_out_edges;
   public:
-    typedef typename GraphWrapperSkeleton1<GraphWrapper>::Node Node;
-    typedef typename GraphWrapperSkeleton1<GraphWrapper>::NodeIt NodeIt;
-    typedef typename GraphWrapperSkeleton1<GraphWrapper>::Edge Edge;
-    typedef typename GraphWrapperSkeleton1<GraphWrapper>::EdgeIt EdgeIt;
-    typedef typename GraphWrapperSkeleton1<GraphWrapper>::InEdgeIt InEdgeIt;
-    typedef typename GraphWrapperSkeleton1<GraphWrapper>::OutEdgeIt OutEdgeIt;
-
-    ErasingFirstGraphWrapper(GraphWrapper& _gw, FirstOutEdgesMap& _first_out_edges) : 
-      GraphWrapperSkeleton1<GraphWrapper>(_gw), first_out_edges(&_first_out_edges) { }  
+    typedef typename GraphWrapper<Graph>::Node Node;
+    typedef typename GraphWrapper<Graph>::NodeIt NodeIt;
+    typedef typename GraphWrapper<Graph>::Edge Edge;
+    typedef typename GraphWrapper<Graph>::EdgeIt EdgeIt;
+    typedef typename GraphWrapper<Graph>::InEdgeIt InEdgeIt;
+    typedef typename GraphWrapper<Graph>::OutEdgeIt OutEdgeIt;
+
+    ErasingFirstGraphWrapper(Graph& _graph, 
+			     FirstOutEdgesMap& _first_out_edges) : 
+      GraphWrapper<Graph>(_graph), first_out_edges(&_first_out_edges) { }  
 
     template<typename I> I& first(I& i) const { 
-      g->first(i); 
-      //while (gw.valid(i) && !filter_map->get(i)) { gw.next(i); }
+      graph->first(i); 
       return i;
     }
@@ -1414,6 +1172,5 @@
     }
     template<typename I, typename P> I& first(I& i, const P& p) const { 
-      g->first(i, p); 
-      //while (gw.valid(i) && !filter_map->get(i)) { gw.next(i); }
+      graph->first(i, p); 
       return i;
     }
@@ -1423,6 +1180,5 @@
     //}
     template<typename I> I& next(I &i) const { 
-      g->next(i); 
-      //while (gw.valid(i) && !filter_map->get(i)) { gw.next(i); }
+      graph->next(i); 
       return i;
     }
@@ -1440,244 +1196,4 @@
     }
   };
-
-//   template<typename Graph, typename Number, typename FlowMap, typename CapacityMap>
-//   class ErasingResGraphWrapper : public ResGraphWrapper<Graph, Number, FlowMap, CapacityMap> {
-//   protected:
-//     ResGraphWrapper<Graph, Number, FlowMap, CapacityMap>::NodeMap<typename ResGraphWrapper<Graph, Number, FlowMap, CapacityMap>::OutEdgeIt> first_out_edges;
-//     //ResGraphWrapper<Graph, Number, FlowMap, CapacityMap>::NodeMap<int> dist;
-//   public:
-//     ErasingResGraphWrapper(const Graph& _G, FlowMap& _flow, 
-// 			   const CapacityMap& _capacity) : 
-//       ResGraphWrapper<Graph, Number, FlowMap, CapacityMap>(_G, _flow, _capacity), 
-//       first_out_edges(*this) /*, dist(*this)*/ { 
-//       for(NodeIt n=this->template first<NodeIt>(); this->valid(n); this->next(n)) {
-// 	OutEdgeIt e;
-// 	ResGraphWrapper<Graph, Number, FlowMap, CapacityMap>::first(e, n);
-// 	first_out_edges.set(n, e);
-//       }
-//     }
-
-//     //void setGraph(Graph& _graph) { graph = &_graph; }
-//     //Graph& getGraph() const { return (*graph); }
-  
-//     //TrivGraphWrapper() : graph(0) { }
-//     //ErasingResGraphWrapper(Graph& _graph) : graph(&_graph) { }
-
-//     //typedef Graph BaseGraph;
-
-//     //typedef typename Graph::Node Node;
-//     //typedef typename Graph::NodeIt NodeIt;
-
-//     //typedef typename Graph::Edge Edge;
-//     //typedef typename Graph::OutEdgeIt OutEdgeIt;
-//     //typedef typename Graph::InEdgeIt InEdgeIt;
-//     //typedef typename Graph::SymEdgeIt SymEdgeIt;
-//     //typedef typename Graph::EdgeIt EdgeIt;
-
-//     typedef typename ResGraphWrapper<Graph, Number, FlowMap, CapacityMap>::Node Node;
-//     typedef typename ResGraphWrapper<Graph, Number, FlowMap, CapacityMap>::NodeIt NodeIt;
-
-//     typedef typename ResGraphWrapper<Graph, Number, FlowMap, CapacityMap>::Edge Edge;
-//     typedef typename ResGraphWrapper<Graph, Number, FlowMap, CapacityMap>::OutEdgeIt OutEdgeIt;
-//     //typedef typename ResGraphWrapper<Graph, Number, FlowMap, CapacityMap>::InEdgeIt InEdgeIt;
-//     //typedef typename Graph::SymEdgeIt SymEdgeIt;
-//     //typedef typename ResGraphWrapper<Graph, Number, FlowMap, CapacityMap>::EdgeIt EdgeIt;
-
-//     NodeIt& first(NodeIt& n) const { 
-//       return ResGraphWrapper<Graph, Number, FlowMap, CapacityMap>::first(n);
-//     }
-
-//     OutEdgeIt& first(OutEdgeIt& e, const Node& n) const { 
-//       e=first_out_edges.get(n);
-//       return e;
-//     }
-    
-//     //ROSSZ template<typename I> I& first(I& i) const { return first(i); }
-//     //ROSSZ template<typename I, typename P> I& first(I& i, const P& p) const { 
-//     //  return first(i, p); }
-    
-//     //template<typename I> I getNext(const I& i) const { 
-//     //  return gw.getNext(i); }
-//     //template<typename I> I& next(I &i) const { return gw.next(i); }    
-
-//     template< typename It > It first() const { 
-//       It e; first(e); return e; }
-
-//     template< typename It > It first(const Node& v) const { 
-//       It e; first(e, v); return e; }
-
-//     //Node head(const Edge& e) const { return gw.head(e); }
-//     //Node tail(const Edge& e) const { return gw.tail(e); }
-
-//     //template<typename I> bool valid(const I& i) const 
-//     //  { return gw.valid(i); }
-  
-//     //int nodeNum() const { return gw.nodeNum(); }
-//     //int edgeNum() const { return gw.edgeNum(); }
-  
-//     //template<typename I> Node aNode(const I& e) const { 
-//     //  return gw.aNode(e); }
-//     //template<typename I> Node bNode(const I& e) const { 
-//     //  return gw.bNode(e); }
-  
-//     //Node addNode() const { return gw.addNode(); }
-//     //Edge addEdge(const Node& tail, const Node& head) const { 
-//     //  return gw.addEdge(tail, head); }
-  
-//     //void erase(const OutEdgeIt& e) {
-//     //  first_out_edge(this->tail(e))=e;
-//     //}
-//     void erase(const Edge& e) {
-//       OutEdgeIt f(e);
-//       next(f);
-//       first_out_edges.set(this->tail(e), f);
-//     }
-//     //template<typename I> void erase(const I& i) const { gw.erase(i); }
-  
-//     //void clear() const { gw.clear(); }
-    
-//     template<typename T> class NodeMap : public ResGraphWrapper<Graph, Number, FlowMap, CapacityMap>::NodeMap<T> { 
-//     public:
-//       NodeMap(const ErasingResGraphWrapper<Graph, Number, FlowMap, CapacityMap>& _G) : 
-// 	ResGraphWrapper<Graph, Number, FlowMap, CapacityMap>::NodeMap<T>(_G /*_G.getGraph()*/) { }
-//       NodeMap(const ErasingResGraphWrapper<Graph, Number, FlowMap, CapacityMap>& _G, T a) : 
-// 	ResGraphWrapper<Graph, Number, FlowMap, CapacityMap>::NodeMap<T>(_G /*_G.getGraph()*/, a) { }
-//     };
-
-//     template<typename T> class EdgeMap : public ResGraphWrapper<Graph, Number, FlowMap, CapacityMap>::EdgeMap<T> { 
-//     public:
-//       EdgeMap(const ErasingResGraphWrapper<Graph, Number, FlowMap, CapacityMap>& _G) : 
-// 	ResGraphWrapper<Graph, Number, FlowMap, CapacityMap>::EdgeMap<T>(_G /*_G.getGraph()*/) { }
-//       EdgeMap(const ErasingResGraphWrapper<Graph, Number, FlowMap, CapacityMap>& _G, T a) : 
-// 	ResGraphWrapper<Graph, Number, FlowMap, CapacityMap>::EdgeMap<T>(_G /*_G.getGraph()*/, a) { }
-//     };
-//   };
-
-//   template<typename GraphWrapper> 
-//   class FilterGraphWrapper {
-//   };
-
-//   template<typename Graph, typename Number, typename FlowMap, typename CapacityMap>
-//   class FilterGraphWrapper<ErasingResGraphWrapper<Graph, Number, FlowMap, CapacityMap> > : public ErasingResGraphWrapper<Graph, Number, FlowMap, CapacityMap> {
-
-//     //Graph* graph;
-  
-//   public:
-//     //typedef Graph BaseGraph;
-
-//     typedef typename ErasingResGraphWrapper<Graph, Number, FlowMap, CapacityMap>::Node Node;
-//     typedef typename ErasingResGraphWrapper<Graph, Number, FlowMap, CapacityMap>::NodeIt NodeIt;
-
-//     typedef typename ErasingResGraphWrapper<Graph, Number, FlowMap, CapacityMap>::Edge Edge;
-//     typedef typename ErasingResGraphWrapper<Graph, Number, FlowMap, CapacityMap>::OutEdgeIt OutEdgeIt;
-//     //typedef typename ErasingResGraphWrapper<Graph, Number, FlowMap, CapacityMap>::InEdgeIt InEdgeIt;
-//     //typedef typename Graph::SymEdgeIt SymEdgeIt;
-//     typedef typename ErasingResGraphWrapper<Graph, Number, FlowMap, CapacityMap>::EdgeIt EdgeIt;
-
-//     //FilterGraphWrapper<Graph, Number, FlowMap, CapacityMap>::NodeMap<typename ResGraphWrapper<Graph, Number, FlowMap, CapacityMap>::OutEdgeIt> first_out_edges;
-    
-//   public:
-//     FilterGraphWrapper(const Graph& _G, FlowMap& _flow, 
-// 			   const CapacityMap& _capacity) : 
-//       ErasingResGraphWrapper<Graph, Number, FlowMap, CapacityMap>(_G, _flow, _capacity), dist(*this, gw.nodeNum()) { 
-//     }
-
-//     OutEdgeIt& first(OutEdgeIt& e, const Node& n) const {
-//       ErasingResGraphWrapper<Graph, Number, FlowMap, CapacityMap>::first(e, n);
-//       while (valid(e) && (dist.get(tail(e))/*+1!=*/>=dist.get(head(e)))) 
-// 	ErasingResGraphWrapper<Graph, Number, FlowMap, CapacityMap>::next(e);
-//       return e;
-//     }
-
-//     NodeIt& next(NodeIt& e) const {
-//       return ErasingResGraphWrapper<Graph, Number, FlowMap, CapacityMap>::next(e);
-//     }
-
-//     OutEdgeIt& next(OutEdgeIt& e) const {
-//       ErasingResGraphWrapper<Graph, Number, FlowMap, CapacityMap>::next(e);
-//       while (valid(e) && (dist.get(tail(e))/*+1!*/>=dist.get(head(e)))) 
-// 	ErasingResGraphWrapper<Graph, Number, FlowMap, CapacityMap>::next(e);
-//       return e;
-//     }
-
-//     NodeIt& first(NodeIt& n) const {
-//       return ErasingResGraphWrapper<Graph, Number, FlowMap, CapacityMap>::first(n);
-//     }
-
-//     void erase(const Edge& e) {
-//       OutEdgeIt f(e);
-//       ErasingResGraphWrapper<Graph, Number, FlowMap, CapacityMap>::next(f);
-//       while (valid(f) && (dist.get(tail(f))/*+1!=*/>=dist.get(head(f)))) 
-// 	ErasingResGraphWrapper<Graph, Number, FlowMap, CapacityMap>::next(f);
-//       first_out_edges.set(this->tail(e), f);
-//     }
-
-//     //TrivGraphWrapper() : graph(0) { }
-//     //TrivGraphWrapper(Graph& _graph) : graph(&_graph) { }
-
-//     //void setGraph(Graph& _graph) { graph = &_graph; }
-//     //Graph& getGraph() const { return (*graph); }
-    
-//     //template<typename I> I& first(I& i) const { return gw.first(i); }
-//     //template<typename I, typename P> I& first(I& i, const P& p) const { 
-//     //  return gw.first(i, p); }
-    
-//     //template<typename I> I getNext(const I& i) const { 
-//     //  return gw.getNext(i); }
-//     //template<typename I> I& next(I &i) const { return gw.next(i); }    
-
-//     template< typename It > It first() const { 
-//       It e; first(e); return e; }
-
-//     template< typename It > It first(const Node& v) const { 
-//       It e; first(e, v); return e; }
-
-//     //Node head(const Edge& e) const { return gw.head(e); }
-//     //Node tail(const Edge& e) const { return gw.tail(e); }
-
-//     //template<typename I> bool valid(const I& i) const 
-//     //  { return gw.valid(i); }
-  
-//     //template<typename I> void setInvalid(const I &i);
-//     //{ return gw.setInvalid(i); }
-
-//     //int nodeNum() const { return gw.nodeNum(); }
-//     //int edgeNum() const { return gw.edgeNum(); }
-  
-//     //template<typename I> Node aNode(const I& e) const { 
-//     //  return gw.aNode(e); }
-//     //template<typename I> Node bNode(const I& e) const { 
-//     //  return gw.bNode(e); }
-  
-//     //Node addNode() const { return gw.addNode(); }
-//     //Edge addEdge(const Node& tail, const Node& head) const { 
-//     //  return gw.addEdge(tail, head); }
-  
-//     //template<typename I> void erase(const I& i) const { gw.erase(i); }
-  
-//     //void clear() const { gw.clear(); }
-    
-//     template<typename T> class NodeMap : public ErasingResGraphWrapper<Graph, Number, FlowMap, CapacityMap>::NodeMap<T> { 
-//     public:
-//       NodeMap(const FilterGraphWrapper<ErasingResGraphWrapper<Graph, Number, FlowMap, CapacityMap> >& _G) : 
-// 	ErasingResGraphWrapper<Graph, Number, FlowMap, CapacityMap>::NodeMap<T>(_G /*_G.getGraph()*/) { }
-//       NodeMap(const FilterGraphWrapper<ErasingResGraphWrapper<Graph, Number, FlowMap, CapacityMap> >& _G, T a) : 
-// 	ErasingResGraphWrapper<Graph, Number, FlowMap, CapacityMap>::NodeMap<T>(_G /*_G.getGraph()*/, a) { }
-//     };
-
-//     template<typename T> class EdgeMap : public ErasingResGraphWrapper<Graph, Number, FlowMap, CapacityMap>::EdgeMap<T> { 
-//     public:
-//       EdgeMap(const FilterGraphWrapper<ErasingResGraphWrapper<Graph, Number, FlowMap, CapacityMap> >& _G) : 
-// 	ErasingResGraphWrapper<Graph, Number, FlowMap, CapacityMap>::EdgeMap<T>(_G /*_G.getGraph()*/) { }
-//       EdgeMap(const FilterGraphWrapper<ErasingResGraphWrapper<Graph, Number, FlowMap, CapacityMap> >& _G, T a) : 
-// 	ErasingResGraphWrapper<Graph, Number, FlowMap, CapacityMap>::EdgeMap<T>(_G /*_G.getGraph()*/, a) { }
-//     };
-
-//   public:
-//     ErasingResGraphWrapper<Graph, Number, FlowMap, CapacityMap>::NodeMap<int> dist;
-
-//   };
-
-
 
 // // FIXME: comparison should be made better!!!
