Index: src/lemon/graph_wrapper.h
===================================================================
--- src/lemon/graph_wrapper.h	(revision 987)
+++ src/lemon/graph_wrapper.h	(revision 992)
@@ -28,4 +28,5 @@
 #include <lemon/invalid.h>
 #include <lemon/maps.h>
+#include <lemon/iterable_graph_extender.h>
 #include <lemon/map_defines.h>
 #include <iostream>
@@ -124,5 +125,5 @@
   public:
     GraphWrapperBase(Graph& _graph) : graph(&_graph) { }
-    GraphWrapperBase(const GraphWrapperBase<_Graph>& gw) : graph(gw.graph) { }
+//     GraphWrapperBase(const GraphWrapperBase<_Graph>& gw) : graph(gw.graph) { }
  
     typedef typename Graph::Node Node;
@@ -300,5 +301,116 @@
   };
 
-
+  
+  template <typename _Graph, typename NodeFilterMap, typename EdgeFilterMap>
+  class SubGraphWrapperBase : public GraphWrapperBase<_Graph> {
+  public:
+    typedef _Graph Graph;
+    typedef GraphWrapperBase<_Graph> Parent;
+  protected:
+    NodeFilterMap* node_filter_map;
+    EdgeFilterMap* edge_filter_map;
+    SubGraphWrapperBase() : Parent(), 
+			    node_filter_map(0), edge_filter_map(0) { }
+
+    void setNodeFilterMap(NodeFilterMap& _node_filter_map) {
+      node_filter_map=&_node_filter_map;
+    }
+    void setEdgeFilterMap(EdgeFilterMap& _edge_filter_map) {
+      edge_filter_map=&_edge_filter_map;
+    }
+
+  public:
+//     SubGraphWrapperBase(Graph& _graph, 
+// 			NodeFilterMap& _node_filter_map, 
+// 			EdgeFilterMap& _edge_filter_map) : 
+//       Parent(&_graph), 
+//       node_filter_map(&node_filter_map), 
+//       edge_filter_map(&edge_filter_map) { }
+
+    typedef typename Parent::Node Node;
+    typedef typename Parent::Edge Edge;
+
+    void first(Node& i) const { 
+      Parent::first(i); 
+      while (i!=INVALID && !(*node_filter_map)[i]) Parent::next(i); 
+    }
+    void first(Edge& i) const { 
+      Parent::first(i); 
+      while (i!=INVALID && !(*edge_filter_map)[i]) Parent::next(i); 
+    }
+    void firstIn(Edge& i, const Node& n) const { 
+      Parent::firstIn(i, n); 
+      while (i!=INVALID && !(*edge_filter_map)[i]) Parent::nextIn(i); 
+    }
+    void firstOut(Edge& i, const Node& n) const { 
+      Parent::firstOut(i, n); 
+      while (i!=INVALID && !(*edge_filter_map)[i]) Parent::nextOut(i); 
+    }
+
+    void next(Node& i) const { 
+      Parent::next(i); 
+      while (i!=INVALID && !(*node_filter_map)[i]) Parent::next(i); 
+    }
+    void next(Edge& i) const { 
+      Parent::next(i); 
+      while (i!=INVALID && !(*edge_filter_map)[i]) Parent::next(i); 
+    }
+    void nextIn(Edge& i) const { 
+      Parent::nextIn(i); 
+      while (i!=INVALID && !(*edge_filter_map)[i]) Parent::nextIn(i); 
+    }
+    void nextOut(Edge& i) const { 
+      Parent::nextOut(i); 
+      while (i!=INVALID && !(*edge_filter_map)[i]) Parent::nextOut(i); 
+    }
+
+    /// This function hides \c n in the graph, i.e. the iteration 
+    /// jumps over it. This is done by simply setting the value of \c n  
+    /// to be false in the corresponding node-map.
+    void hide(const Node& n) const { node_filter_map->set(n, false); }
+
+    /// This function hides \c e in the graph, i.e. the iteration 
+    /// jumps over it. This is done by simply setting the value of \c e  
+    /// to be false in the corresponding edge-map.
+    void hide(const Edge& e) const { edge_filter_map->set(e, false); }
+
+    /// The value of \c n is set to be true in the node-map which stores 
+    /// hide information. If \c n was hidden previuosly, then it is shown 
+    /// again
+     void unHide(const Node& n) const { node_filter_map->set(n, true); }
+
+    /// The value of \c e is set to be true in the edge-map which stores 
+    /// hide information. If \c e was hidden previuosly, then it is shown 
+    /// again
+    void unHide(const Edge& e) const { edge_filter_map->set(e, true); }
+
+    /// Returns true if \c n is hidden.
+    bool hidden(const Node& n) const { return !(*node_filter_map)[n]; }
+
+    /// Returns true if \c n is hidden.
+    bool hidden(const Edge& e) const { return !(*edge_filter_map)[e]; }
+
+    /// \warning This is a linear time operation and works only if s
+    /// \c Graph::NodeIt is defined.
+    /// \todo assign tags.
+    int nodeNum() const { 
+      int i=0;
+      Node n;
+      for (first(n); n!=INVALID; next(n)) ++i;
+      return i; 
+    }
+
+    /// \warning This is a linear time operation and works only if 
+    /// \c Graph::EdgeIt is defined.
+    /// \todo assign tags.
+    int edgeNum() const { 
+      int i=0;
+      Edge e;
+      for (first(e); e!=INVALID; next(e)) ++i;
+      return i; 
+    }
+
+
+  };
 
   /*! \brief A graph wrapper for hiding nodes and edges from a graph.
@@ -348,193 +460,213 @@
   \author Marton Makai
   */
-  template<typename Graph, typename NodeFilterMap, 
+  template<typename _Graph, typename NodeFilterMap, 
 	   typename EdgeFilterMap>
-  class SubGraphWrapper : public GraphWrapper<Graph> {
-  public:
-    typedef GraphWrapper<Graph> Parent;
+  class SubGraphWrapper : 
+    public IterableGraphExtender<
+    SubGraphWrapperBase<_Graph, NodeFilterMap, EdgeFilterMap> > {
+  public:
+    typedef _Graph Graph;
+    typedef IterableGraphExtender<
+      SubGraphWrapperBase<_Graph, NodeFilterMap, EdgeFilterMap> > Parent;
   protected:
-    NodeFilterMap* node_filter_map;
-    EdgeFilterMap* edge_filter_map;
-
-    SubGraphWrapper() : GraphWrapper<Graph>(), 
-			node_filter_map(0), edge_filter_map(0) { }
-    void setNodeFilterMap(NodeFilterMap& _node_filter_map) {
-      node_filter_map=&_node_filter_map;
-    }
-    void setEdgeFilterMap(EdgeFilterMap& _edge_filter_map) {
-      edge_filter_map=&_edge_filter_map;
-    }
+    SubGraphWrapper() { }
+  public:
+    SubGraphWrapper(_Graph& _graph, NodeFilterMap& _node_filter_map, 
+		    EdgeFilterMap& _edge_filter_map) { 
+      setGraph(_graph);
+      setNodeFilterMap(_node_filter_map);
+      setEdgeFilterMap(_edge_filter_map);
+    }
+  };
+
+//   template<typename Graph, typename NodeFilterMap, 
+// 	   typename EdgeFilterMap>
+//   class SubGraphWrapper : public GraphWrapper<Graph> {
+//   public:
+//     typedef GraphWrapper<Graph> Parent;
+//   protected:
+//     NodeFilterMap* node_filter_map;
+//     EdgeFilterMap* edge_filter_map;
+
+//     SubGraphWrapper() : GraphWrapper<Graph>(), 
+// 			node_filter_map(0), edge_filter_map(0) { }
+//     void setNodeFilterMap(NodeFilterMap& _node_filter_map) {
+//       node_filter_map=&_node_filter_map;
+//     }
+//     void setEdgeFilterMap(EdgeFilterMap& _edge_filter_map) {
+//       edge_filter_map=&_edge_filter_map;
+//     }
     
-  public:
-    SubGraphWrapper(Graph& _graph, NodeFilterMap& _node_filter_map, 
-		    EdgeFilterMap& _edge_filter_map) : 
-      GraphWrapper<Graph>(_graph), node_filter_map(&_node_filter_map), 
-      edge_filter_map(&_edge_filter_map) { }  
-
-    typedef typename GraphWrapper<Graph>::Node Node;
-    class NodeIt : public Node { 
-      const SubGraphWrapper<Graph, NodeFilterMap, EdgeFilterMap>* gw;
-      friend class SubGraphWrapper<Graph, NodeFilterMap, EdgeFilterMap>;
-    public:
-      NodeIt() { }
-      NodeIt(Invalid i) : Node(i) { }
-      NodeIt(const SubGraphWrapper<Graph, NodeFilterMap, EdgeFilterMap>& _gw) : 
-	Node(typename Graph::NodeIt(*(_gw.graph))), gw(&_gw) { 
-	while (*static_cast<Node*>(this)!=INVALID && 
-	       !(*(gw->node_filter_map))[*this]) 
-	  *(static_cast<Node*>(this))=
-	    ++(typename Graph::NodeIt(*(gw->graph), *this));
-      }
-      NodeIt(const SubGraphWrapper<Graph, NodeFilterMap, EdgeFilterMap>& _gw, 
-	     const Node& n) : 
-	Node(n), gw(&_gw) { }
-      NodeIt& operator++() { 
-	*(static_cast<Node*>(this))=
-	  ++(typename Graph::NodeIt(*(gw->graph), *this));
-	while (*static_cast<Node*>(this)!=INVALID && 
-	       !(*(gw->node_filter_map))[*this]) 
-	  *(static_cast<Node*>(this))=
-	    ++(typename Graph::NodeIt(*(gw->graph), *this));
-	return *this; 
-      }
-    };
-    typedef typename GraphWrapper<Graph>::Edge Edge;
-    class OutEdgeIt : public Edge { 
-      const SubGraphWrapper<Graph, NodeFilterMap, EdgeFilterMap>* gw;
-      friend class SubGraphWrapper<Graph, NodeFilterMap, EdgeFilterMap>;
-    public:
-      OutEdgeIt() { }
-      OutEdgeIt(Invalid i) : Edge(i) { }
-      OutEdgeIt(const SubGraphWrapper<Graph, NodeFilterMap, EdgeFilterMap>& _gw, const Node& n) : 
-	Edge(typename Graph::OutEdgeIt(*(_gw.graph), n)), gw(&_gw) { 
-	while (*static_cast<Edge*>(this)!=INVALID && 
-	       !(*(gw->edge_filter_map))[*this]) 
-	  *(static_cast<Edge*>(this))=
-	    ++(typename Graph::OutEdgeIt(*(gw->graph), *this));
-      }
-      OutEdgeIt(const SubGraphWrapper<Graph, NodeFilterMap, EdgeFilterMap>& _gw, 
-	     const Edge& e) : 
-	Edge(e), gw(&_gw) { }
-      OutEdgeIt& operator++() { 
-	*(static_cast<Edge*>(this))=
-	  ++(typename Graph::OutEdgeIt(*(gw->graph), *this));
-	while (*static_cast<Edge*>(this)!=INVALID && 
-	       !(*(gw->edge_filter_map))[*this]) 
-	  *(static_cast<Edge*>(this))=
-	    ++(typename Graph::OutEdgeIt(*(gw->graph), *this));
-	return *this; 
-      }
-    };
-    class InEdgeIt : public Edge { 
-      const SubGraphWrapper<Graph, NodeFilterMap, EdgeFilterMap>* gw;
-      friend class SubGraphWrapper<Graph, NodeFilterMap, EdgeFilterMap>;
-    public:
-      InEdgeIt() { }
-      //      InEdgeIt(const InEdgeIt& e) : Edge(e), gw(e.gw) { }
-      InEdgeIt(Invalid i) : Edge(i) { }
-      InEdgeIt(const SubGraphWrapper<Graph, NodeFilterMap, EdgeFilterMap>& _gw, const Node& n) : 
-	Edge(typename Graph::InEdgeIt(*(_gw.graph), n)), gw(&_gw) { 
-	while (*static_cast<Edge*>(this)!=INVALID && 
-	       !(*(gw->edge_filter_map))[*this]) 
-	  *(static_cast<Edge*>(this))=
-	    ++(typename Graph::InEdgeIt(*(gw->graph), *this));
-      }
-      InEdgeIt(const SubGraphWrapper<Graph, NodeFilterMap, EdgeFilterMap>& _gw, 
-	     const Edge& e) : 
-	Edge(e), gw(&_gw) { }
-      InEdgeIt& operator++() { 
-	*(static_cast<Edge*>(this))=
-	  ++(typename Graph::InEdgeIt(*(gw->graph), *this));
-	while (*static_cast<Edge*>(this)!=INVALID && 
-	       !(*(gw->edge_filter_map))[*this]) 
-	  *(static_cast<Edge*>(this))=
-	    ++(typename Graph::InEdgeIt(*(gw->graph), *this));
-	return *this; 
-      }
-    };
-    class EdgeIt : public Edge { 
-      const SubGraphWrapper<Graph, NodeFilterMap, EdgeFilterMap>* gw;
-      friend class SubGraphWrapper<Graph, NodeFilterMap, EdgeFilterMap>;
-    public:
-      EdgeIt() { }
-      EdgeIt(Invalid i) : Edge(i) { }
-      EdgeIt(const SubGraphWrapper<Graph, NodeFilterMap, EdgeFilterMap>& _gw) : 
-	Edge(typename Graph::EdgeIt(*(_gw.graph))), gw(&_gw) { 
-	while (*static_cast<Edge*>(this)!=INVALID && 
-	       !(*(gw->edge_filter_map))[*this]) 
-	  *(static_cast<Edge*>(this))=
-	    ++(typename Graph::EdgeIt(*(gw->graph), *this));
-      }
-      EdgeIt(const SubGraphWrapper<Graph, NodeFilterMap, EdgeFilterMap>& _gw, 
-	     const Edge& e) : 
-	Edge(e), gw(&_gw) { }
-      EdgeIt& operator++() { 
-	*(static_cast<Edge*>(this))=
-	  ++(typename Graph::EdgeIt(*(gw->graph), *this));
-	while (*static_cast<Edge*>(this)!=INVALID && 
-	       !(*(gw->edge_filter_map))[*this]) 
-	  *(static_cast<Edge*>(this))=
-	    ++(typename Graph::EdgeIt(*(gw->graph), *this));
-	return *this; 
-      }
-    };
-
-    NodeIt& first(NodeIt& i) const { 
-      i=NodeIt(*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;
-    }
-    EdgeIt& first(EdgeIt& i) const { 
-      i=EdgeIt(*this); return i;
-    }
+//   public:
+//     SubGraphWrapper(Graph& _graph, NodeFilterMap& _node_filter_map, 
+// 		    EdgeFilterMap& _edge_filter_map) : 
+//       GraphWrapper<Graph>(_graph), node_filter_map(&_node_filter_map), 
+//       edge_filter_map(&_edge_filter_map) { }  
+
+//     typedef typename GraphWrapper<Graph>::Node Node;
+//     class NodeIt : public Node { 
+//       const SubGraphWrapper<Graph, NodeFilterMap, EdgeFilterMap>* gw;
+//       friend class SubGraphWrapper<Graph, NodeFilterMap, EdgeFilterMap>;
+//     public:
+//       NodeIt() { }
+//       NodeIt(Invalid i) : Node(i) { }
+//       NodeIt(const SubGraphWrapper<Graph, NodeFilterMap, EdgeFilterMap>& _gw) : 
+// 	Node(typename Graph::NodeIt(*(_gw.graph))), gw(&_gw) { 
+// 	while (*static_cast<Node*>(this)!=INVALID && 
+// 	       !(*(gw->node_filter_map))[*this]) 
+// 	  *(static_cast<Node*>(this))=
+// 	    ++(typename Graph::NodeIt(*(gw->graph), *this));
+//       }
+//       NodeIt(const SubGraphWrapper<Graph, NodeFilterMap, EdgeFilterMap>& _gw, 
+// 	     const Node& n) : 
+// 	Node(n), gw(&_gw) { }
+//       NodeIt& operator++() { 
+// 	*(static_cast<Node*>(this))=
+// 	  ++(typename Graph::NodeIt(*(gw->graph), *this));
+// 	while (*static_cast<Node*>(this)!=INVALID && 
+// 	       !(*(gw->node_filter_map))[*this]) 
+// 	  *(static_cast<Node*>(this))=
+// 	    ++(typename Graph::NodeIt(*(gw->graph), *this));
+// 	return *this; 
+//       }
+//     };
+//     typedef typename GraphWrapper<Graph>::Edge Edge;
+//     class OutEdgeIt : public Edge { 
+//       const SubGraphWrapper<Graph, NodeFilterMap, EdgeFilterMap>* gw;
+//       friend class SubGraphWrapper<Graph, NodeFilterMap, EdgeFilterMap>;
+//     public:
+//       OutEdgeIt() { }
+//       OutEdgeIt(Invalid i) : Edge(i) { }
+//       OutEdgeIt(const SubGraphWrapper<Graph, NodeFilterMap, EdgeFilterMap>& _gw, const Node& n) : 
+// 	Edge(typename Graph::OutEdgeIt(*(_gw.graph), n)), gw(&_gw) { 
+// 	while (*static_cast<Edge*>(this)!=INVALID && 
+// 	       !(*(gw->edge_filter_map))[*this]) 
+// 	  *(static_cast<Edge*>(this))=
+// 	    ++(typename Graph::OutEdgeIt(*(gw->graph), *this));
+//       }
+//       OutEdgeIt(const SubGraphWrapper<Graph, NodeFilterMap, EdgeFilterMap>& _gw, 
+// 	     const Edge& e) : 
+// 	Edge(e), gw(&_gw) { }
+//       OutEdgeIt& operator++() { 
+// 	*(static_cast<Edge*>(this))=
+// 	  ++(typename Graph::OutEdgeIt(*(gw->graph), *this));
+// 	while (*static_cast<Edge*>(this)!=INVALID && 
+// 	       !(*(gw->edge_filter_map))[*this]) 
+// 	  *(static_cast<Edge*>(this))=
+// 	    ++(typename Graph::OutEdgeIt(*(gw->graph), *this));
+// 	return *this; 
+//       }
+//     };
+//     class InEdgeIt : public Edge { 
+//       const SubGraphWrapper<Graph, NodeFilterMap, EdgeFilterMap>* gw;
+//       friend class SubGraphWrapper<Graph, NodeFilterMap, EdgeFilterMap>;
+//     public:
+//       InEdgeIt() { }
+//       //      InEdgeIt(const InEdgeIt& e) : Edge(e), gw(e.gw) { }
+//       InEdgeIt(Invalid i) : Edge(i) { }
+//       InEdgeIt(const SubGraphWrapper<Graph, NodeFilterMap, EdgeFilterMap>& _gw, const Node& n) : 
+// 	Edge(typename Graph::InEdgeIt(*(_gw.graph), n)), gw(&_gw) { 
+// 	while (*static_cast<Edge*>(this)!=INVALID && 
+// 	       !(*(gw->edge_filter_map))[*this]) 
+// 	  *(static_cast<Edge*>(this))=
+// 	    ++(typename Graph::InEdgeIt(*(gw->graph), *this));
+//       }
+//       InEdgeIt(const SubGraphWrapper<Graph, NodeFilterMap, EdgeFilterMap>& _gw, 
+// 	     const Edge& e) : 
+// 	Edge(e), gw(&_gw) { }
+//       InEdgeIt& operator++() { 
+// 	*(static_cast<Edge*>(this))=
+// 	  ++(typename Graph::InEdgeIt(*(gw->graph), *this));
+// 	while (*static_cast<Edge*>(this)!=INVALID && 
+// 	       !(*(gw->edge_filter_map))[*this]) 
+// 	  *(static_cast<Edge*>(this))=
+// 	    ++(typename Graph::InEdgeIt(*(gw->graph), *this));
+// 	return *this; 
+//       }
+//     };
+//     class EdgeIt : public Edge { 
+//       const SubGraphWrapper<Graph, NodeFilterMap, EdgeFilterMap>* gw;
+//       friend class SubGraphWrapper<Graph, NodeFilterMap, EdgeFilterMap>;
+//     public:
+//       EdgeIt() { }
+//       EdgeIt(Invalid i) : Edge(i) { }
+//       EdgeIt(const SubGraphWrapper<Graph, NodeFilterMap, EdgeFilterMap>& _gw) : 
+// 	Edge(typename Graph::EdgeIt(*(_gw.graph))), gw(&_gw) { 
+// 	while (*static_cast<Edge*>(this)!=INVALID && 
+// 	       !(*(gw->edge_filter_map))[*this]) 
+// 	  *(static_cast<Edge*>(this))=
+// 	    ++(typename Graph::EdgeIt(*(gw->graph), *this));
+//       }
+//       EdgeIt(const SubGraphWrapper<Graph, NodeFilterMap, EdgeFilterMap>& _gw, 
+// 	     const Edge& e) : 
+// 	Edge(e), gw(&_gw) { }
+//       EdgeIt& operator++() { 
+// 	*(static_cast<Edge*>(this))=
+// 	  ++(typename Graph::EdgeIt(*(gw->graph), *this));
+// 	while (*static_cast<Edge*>(this)!=INVALID && 
+// 	       !(*(gw->edge_filter_map))[*this]) 
+// 	  *(static_cast<Edge*>(this))=
+// 	    ++(typename Graph::EdgeIt(*(gw->graph), *this));
+// 	return *this; 
+//       }
+//     };
+
+//     NodeIt& first(NodeIt& i) const { 
+//       i=NodeIt(*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;
+//     }
+//     EdgeIt& first(EdgeIt& i) const { 
+//       i=EdgeIt(*this); return i;
+//     }
     
-    /// This function hides \c n in the graph, i.e. the iteration 
-    /// jumps over it. This is done by simply setting the value of \c n  
-    /// to be false in the corresponding node-map.
-    void hide(const Node& n) const { node_filter_map->set(n, false); }
-
-    /// This function hides \c e in the graph, i.e. the iteration 
-    /// jumps over it. This is done by simply setting the value of \c e  
-    /// to be false in the corresponding edge-map.
-    void hide(const Edge& e) const { edge_filter_map->set(e, false); }
-
-    /// The value of \c n is set to be true in the node-map which stores 
-    /// hide information. If \c n was hidden previuosly, then it is shown 
-    /// again
-     void unHide(const Node& n) const { node_filter_map->set(n, true); }
-
-    /// The value of \c e is set to be true in the edge-map which stores 
-    /// hide information. If \c e was hidden previuosly, then it is shown 
-    /// again
-    void unHide(const Edge& e) const { edge_filter_map->set(e, true); }
-
-    /// Returns true if \c n is hidden.
-    bool hidden(const Node& n) const { return !(*node_filter_map)[n]; }
-
-    /// Returns true if \c n is hidden.
-    bool hidden(const Edge& e) const { return !(*edge_filter_map)[e]; }
-
-    /// \warning This is a linear time operation and works only if 
-    /// \c Graph::NodeIt is defined.
-    int nodeNum() const { 
-      int i=0;
-      for (NodeIt n(*this); n!=INVALID; ++n) ++i;
-      return i; 
-    }
-
-    /// \warning This is a linear time operation and works only if 
-    /// \c Graph::EdgeIt is defined.
-    int edgeNum() const { 
-      int i=0;
-      for (EdgeIt e(*this); e!=INVALID; ++e) ++i;
-      return i; 
-    }
-
-    //    KEEP_MAPS(Parent, SubGraphWrapper);
-  };
+//     /// This function hides \c n in the graph, i.e. the iteration 
+//     /// jumps over it. This is done by simply setting the value of \c n  
+//     /// to be false in the corresponding node-map.
+//     void hide(const Node& n) const { node_filter_map->set(n, false); }
+
+//     /// This function hides \c e in the graph, i.e. the iteration 
+//     /// jumps over it. This is done by simply setting the value of \c e  
+//     /// to be false in the corresponding edge-map.
+//     void hide(const Edge& e) const { edge_filter_map->set(e, false); }
+
+//     /// The value of \c n is set to be true in the node-map which stores 
+//     /// hide information. If \c n was hidden previuosly, then it is shown 
+//     /// again
+//      void unHide(const Node& n) const { node_filter_map->set(n, true); }
+
+//     /// The value of \c e is set to be true in the edge-map which stores 
+//     /// hide information. If \c e was hidden previuosly, then it is shown 
+//     /// again
+//     void unHide(const Edge& e) const { edge_filter_map->set(e, true); }
+
+//     /// Returns true if \c n is hidden.
+//     bool hidden(const Node& n) const { return !(*node_filter_map)[n]; }
+
+//     /// Returns true if \c n is hidden.
+//     bool hidden(const Edge& e) const { return !(*edge_filter_map)[e]; }
+
+//     /// \warning This is a linear time operation and works only if 
+//     /// \c Graph::NodeIt is defined.
+//     int nodeNum() const { 
+//       int i=0;
+//       for (NodeIt n(*this); n!=INVALID; ++n) ++i;
+//       return i; 
+//     }
+
+//     /// \warning This is a linear time operation and works only if 
+//     /// \c Graph::EdgeIt is defined.
+//     int edgeNum() const { 
+//       int i=0;
+//       for (EdgeIt e(*this); e!=INVALID; ++e) ++i;
+//       return i; 
+//     }
+
+//     //    KEEP_MAPS(Parent, SubGraphWrapper);
+//   };
 
 
@@ -800,4 +932,253 @@
   };
 
+  
+  template <typename _Graph, 
+	    typename ForwardFilterMap, typename BackwardFilterMap>
+  class SubBidirGraphWrapperBase : public GraphWrapperBase<_Graph> {
+  public:
+    typedef _Graph Graph;
+    typedef GraphWrapperBase<_Graph> Parent;
+  protected:
+    ForwardFilterMap* forward_filter;
+    BackwardFilterMap* backward_filter;
+    SubBidirGraphWrapperBase() : Parent(), 
+				 forward_filter(0), backward_filter(0) { }
+
+    void setForwardFilterMap(ForwardFilterMap& _forward_filter) {
+      forward_filter=&_forward_filter;
+    }
+    void setBackwardFilterMap(BackwardFilterMap& _backward_filter) {
+      backward_filter=&_backward_filter;
+    }
+
+  public:
+//     SubGraphWrapperBase(Graph& _graph, 
+// 			NodeFilterMap& _node_filter_map, 
+// 			EdgeFilterMap& _edge_filter_map) : 
+//       Parent(&_graph), 
+//       node_filter_map(&node_filter_map), 
+//       edge_filter_map(&edge_filter_map) { }
+
+    typedef typename Parent::Node Node;
+    typedef typename _Graph::Edge GraphEdge;
+    template <typename T> class EdgeMap;
+    /// SubBidirGraphWrapperBase<..., ..., ...>::Edge is inherited from 
+    /// _Graph::Edge. It contains an extra bool flag which is true 
+    /// if and only if the 
+    /// edge is the backward version of the original edge.
+    class Edge : public _Graph::Edge {
+      friend class SubBidirGraphWrapperBase<
+	Graph, ForwardFilterMap, BackwardFilterMap>;
+      template<typename T> friend class EdgeMap;
+    protected:
+      bool backward; //true, iff backward
+    public:
+      Edge() { }
+      /// \todo =false is needed, or causes problems?
+      /// If \c _backward is false, then we get an edge corresponding to the 
+      /// original one, otherwise its oppositely directed pair is obtained.
+      Edge(const typename _Graph::Edge& e, bool _backward/*=false*/) : 
+	_Graph::Edge(e), backward(_backward) { }
+      Edge(Invalid i) : _Graph::Edge(i), backward(true) { }
+      bool operator==(const Edge& v) const { 
+	return (this->backward==v.backward && 
+		static_cast<typename _Graph::Edge>(*this)==
+		static_cast<typename _Graph::Edge>(v));
+      } 
+      bool operator!=(const Edge& v) const { 
+	return (this->backward!=v.backward || 
+		static_cast<typename _Graph::Edge>(*this)!=
+		static_cast<typename _Graph::Edge>(v));
+      }
+    };
+
+    void first(Node& i) const { 
+      Parent::first(i); 
+    }
+
+    void first(Edge& i) const { 
+      Parent::first(i); 
+      i.backward=false;
+      while (*static_cast<GraphEdge*>(&i)!=INVALID && 
+	     !(*forward_filter)[i]) Parent::next(i);
+      if (*static_cast<GraphEdge*>(&i)==INVALID) {
+	Parent::first(i); 
+	i.backward=true;
+	while (*static_cast<GraphEdge*>(&i)!=INVALID && 
+	       !(*backward_filter)[i]) Parent::next(i);
+      }
+    }
+
+    void firstIn(Edge& i, const Node& n) const { 
+      Parent::firstIn(i, n); 
+      i.backward=false;
+      while (*static_cast<GraphEdge*>(&i)!=INVALID && 
+	     !(*forward_filter)[i]) Parent::nextOut(i);
+      if (*static_cast<GraphEdge*>(&i)==INVALID) {
+	Parent::firstOut(i, n); 
+	i.backward=true;
+	while (*static_cast<GraphEdge*>(&i)!=INVALID && 
+	       !(*backward_filter)[i]) Parent::nextOut(i);
+      }
+    }
+
+    void firstOut(Edge& i, const Node& n) const { 
+      Parent::firstOut(i, n); 
+      i.backward=false;
+      while (*static_cast<GraphEdge*>(&i)!=INVALID && 
+	     !(*forward_filter)[i]) Parent::nextOut(i);
+      if (*static_cast<GraphEdge*>(&i)==INVALID) {
+	Parent::firstIn(i, n); 
+	i.backward=true;
+	while (*static_cast<GraphEdge*>(&i)!=INVALID && 
+	       !(*backward_filter)[i]) Parent::nextIn(i);
+      }
+    }
+
+    void next(Node& i) const { 
+      Parent::next(i); 
+    }
+
+    void next(Edge& i) const { 
+      if (!(i.backward)) {
+	Parent::next(i);
+	while (*static_cast<GraphEdge*>(&i)!=INVALID && 
+	       !(*forward_filter)[i]) Parent::next(i);
+	if (*static_cast<GraphEdge*>(&i)==INVALID) {
+	  Parent::first(i); 
+	  i.backward=true;
+	  while (*static_cast<GraphEdge*>(&i)!=INVALID && 
+		 !(*backward_filter)[i]) Parent::next(i);
+	}
+      } else {
+	Parent::next(i);
+	while (*static_cast<GraphEdge*>(&i)!=INVALID && 
+	       !(*backward_filter)[i]) Parent::next(i);
+      }
+    }
+
+    void nextIn(Edge& i) const { 
+      if (!(i.backward)) {
+	Node n=Parent::target(i);
+	Parent::nextIn(i);
+	while (*static_cast<GraphEdge*>(&i)!=INVALID && 
+	       !(*forward_filter)[i]) Parent::nextIn(i);
+	if (*static_cast<GraphEdge*>(&i)==INVALID) {
+	  Parent::firstOut(i, n); 
+	  i.backward=true;
+	  while (*static_cast<GraphEdge*>(&i)!=INVALID && 
+		 !(*backward_filter)[i]) Parent::nextOut(i);
+	}
+      } else {
+	Parent::nextOut(i);
+	while (*static_cast<GraphEdge*>(&i)!=INVALID && 
+	       !(*backward_filter)[i]) Parent::nextOut(i);
+      }
+    }
+
+    void nextOut(Edge& i) const { 
+      if (!(i.backward)) {
+	Node n=Parent::source(i);
+	Parent::nextOut(i);
+	while (*static_cast<GraphEdge*>(&i)!=INVALID && 
+	       !(*forward_filter)[i]) Parent::nextOut(i);
+	if (*static_cast<GraphEdge*>(&i)==INVALID) {
+	  Parent::firstIn(i, n); 
+	  i.backward=true;
+	  while (*static_cast<GraphEdge*>(&i)!=INVALID && 
+		 !(*backward_filter)[i]) Parent::nextIn(i);
+	}
+      } else {
+	Parent::nextIn(i);
+	while (*static_cast<GraphEdge*>(&i)!=INVALID && 
+	       !(*backward_filter)[i]) Parent::nextIn(i);
+      }
+    }
+
+    Node source(Edge e) const { 
+      return ((!e.backward) ? this->graph->source(e) : this->graph->target(e)); }
+    Node target(Edge e) const { 
+      return ((!e.backward) ? this->graph->target(e) : this->graph->source(e)); }
+
+    /// Gives back the opposite edge.
+    Edge opposite(const Edge& e) const { 
+      Edge f=e;
+      f.backward=!f.backward;
+      return f;
+    }
+
+    /// \warning This is a linear time operation and works only if 
+    /// \c Graph::EdgeIt is defined.
+    /// \todo hmm
+    int edgeNum() const { 
+      int i=0;
+      Edge e;
+      for (first(e); e!=INVALID; next(e)) ++i;
+      return i; 
+    }
+
+    bool forward(const Edge& e) const { return !e.backward; }
+    bool backward(const Edge& e) const { return e.backward; }
+
+    template <typename T>
+    /// \c SubBidirGraphWrapperBase<..., ..., ...>::EdgeMap contains two 
+    /// _Graph::EdgeMap one for the forward edges and 
+    /// one for the backward edges.
+    class EdgeMap {
+      template <typename TT> friend class EdgeMap;
+      typename _Graph::template EdgeMap<T> forward_map, backward_map; 
+    public:
+      typedef T Value;
+      typedef Edge Key;
+
+      EdgeMap(const SubBidirGraphWrapperBase<_Graph, 
+	      ForwardFilterMap, BackwardFilterMap>& g) : 
+	forward_map(*(g.graph)), backward_map(*(g.graph)) { }
+
+      EdgeMap(const SubBidirGraphWrapperBase<_Graph, 
+	      ForwardFilterMap, BackwardFilterMap>& g, T a) : 
+	forward_map(*(g.graph), a), backward_map(*(g.graph), a) { }
+
+//       template <typename TT>
+//       EdgeMap(const EdgeMap<TT>& copy) 
+// 	: forward_map(copy.forward_map), backward_map(copy.backward_map) {}
+
+//       template <typename TT>
+//       EdgeMap& operator=(const EdgeMap<TT>& copy) {
+// 	forward_map = copy.forward_map;
+// 	backward_map = copy.backward_map;
+// 	return *this;
+//       }
+      
+      void set(Edge e, T a) { 
+	if (!e.backward) 
+	  forward_map.set(e, a); 
+	else 
+	  backward_map.set(e, a); 
+      }
+
+//       typename _Graph::template EdgeMap<T>::ConstReference 
+//       operator[](Edge e) const { 
+// 	if (!e.backward) 
+// 	  return forward_map[e]; 
+// 	else 
+// 	  return backward_map[e]; 
+//       }
+
+//      typename _Graph::template EdgeMap<T>::Reference 
+      T operator[](Edge e) { 
+	if (!e.backward) 
+	  return forward_map[e]; 
+	else 
+	  return backward_map[e]; 
+      }
+
+      void update() { 
+	forward_map.update(); 
+	backward_map.update();
+      }
+    };
+
+  };
 
 
@@ -839,342 +1220,363 @@
   /// above mentioned graph structure without its physical storage, 
   /// that is the whole stuff is stored in constant memory. 
-  template<typename Graph, 
+  template<typename _Graph, 
 	   typename ForwardFilterMap, typename BackwardFilterMap>
-  class SubBidirGraphWrapper : public GraphWrapper<Graph> {
-  public:
-    typedef GraphWrapper<Graph> Parent; 
+  class SubBidirGraphWrapper : 
+    public IterableGraphExtender<
+    SubBidirGraphWrapperBase<_Graph, ForwardFilterMap, BackwardFilterMap> > {
+  public:
+    typedef _Graph Graph;
+    typedef IterableGraphExtender<
+      SubBidirGraphWrapperBase<
+      _Graph, ForwardFilterMap, BackwardFilterMap> > Parent;
   protected:
-    ForwardFilterMap* forward_filter;
-    BackwardFilterMap* backward_filter;
-
-    SubBidirGraphWrapper() : GraphWrapper<Graph>() { }
-    void setForwardFilterMap(ForwardFilterMap& _forward_filter) {
-      forward_filter=&_forward_filter;
-    }
-    void setBackwardFilterMap(BackwardFilterMap& _backward_filter) {
-      backward_filter=&_backward_filter;
-    }
-
-  public:
-
-    SubBidirGraphWrapper(Graph& _graph, ForwardFilterMap& _forward_filter, 
-			 BackwardFilterMap& _backward_filter) : 
-      GraphWrapper<Graph>(_graph), 
-      forward_filter(&_forward_filter), backward_filter(&_backward_filter) { }
-    SubBidirGraphWrapper(const SubBidirGraphWrapper<Graph, 
-			 ForwardFilterMap, BackwardFilterMap>& gw) : 
-      Parent(gw), 
-      forward_filter(gw.forward_filter), 
-      backward_filter(gw.backward_filter) { }
-
-    class Edge; 
-    class OutEdgeIt; 
-    friend class Edge; 
-    friend class OutEdgeIt; 
-
-    template<typename T> class EdgeMap;
-
-    typedef typename GraphWrapper<Graph>::Node Node;
-
-    typedef typename Graph::Edge GraphEdge;
-    /// SubBidirGraphWrapper<..., ..., ...>::Edge is inherited from 
-    /// Graph::Edge. It contains an extra bool flag which is true 
-    /// if and only if the 
-    /// edge is the backward version of the original edge.
-    class Edge : public Graph::Edge {
-      friend class SubBidirGraphWrapper<Graph, 
-					ForwardFilterMap, BackwardFilterMap>;
-      template<typename T> friend class EdgeMap;
-    protected:
-      bool backward; //true, iff backward
-    public:
-      Edge() { }
-      /// \todo =false is needed, or causes problems?
-      /// If \c _backward is false, then we get an edge corresponding to the 
-      /// original one, otherwise its oppositely directed pair is obtained.
-      Edge(const typename Graph::Edge& e, bool _backward/*=false*/) : 
-	Graph::Edge(e), backward(_backward) { }
-      Edge(Invalid i) : Graph::Edge(i), backward(true) { }
-      bool operator==(const Edge& v) const { 
-	return (this->backward==v.backward && 
-		static_cast<typename Graph::Edge>(*this)==
-		static_cast<typename Graph::Edge>(v));
-      } 
-      bool operator!=(const Edge& v) const { 
-	return (this->backward!=v.backward || 
-		static_cast<typename Graph::Edge>(*this)!=
-		static_cast<typename Graph::Edge>(v));
-      }
-    };
-
-    class OutEdgeIt : public Edge {
-      friend class SubBidirGraphWrapper<Graph, 
-					ForwardFilterMap, BackwardFilterMap>;
-    protected:
-      const SubBidirGraphWrapper<Graph, 
-				 ForwardFilterMap, BackwardFilterMap>* gw;
-    public:
-      OutEdgeIt() { }
-      OutEdgeIt(Invalid i) : Edge(i) { }
-      OutEdgeIt(const SubBidirGraphWrapper<Graph, 
-		ForwardFilterMap, BackwardFilterMap>& _gw, const Node& n) : 
-	Edge(typename Graph::OutEdgeIt(*(_gw.graph), n), false), gw(&_gw) { 
-	while (*static_cast<GraphEdge*>(this)!=INVALID && 
-	       !(*(gw->forward_filter))[*this]) 
-	  *(static_cast<GraphEdge*>(this))=
-	    ++(typename Graph::OutEdgeIt(*(gw->graph), *this));
-	if (*static_cast<GraphEdge*>(this)==INVALID) {
-	  *static_cast<Edge*>(this)=
-	    Edge(typename Graph::InEdgeIt(*(_gw.graph), n), true);
-	  while (*static_cast<GraphEdge*>(this)!=INVALID && 
-		 !(*(gw->backward_filter))[*this]) 
-	    *(static_cast<GraphEdge*>(this))=
-	      ++(typename Graph::InEdgeIt(*(gw->graph), *this));
-	}
-      }
-      OutEdgeIt(const SubBidirGraphWrapper<Graph, 
-		ForwardFilterMap, BackwardFilterMap>& _gw, const Edge& e) : 
-	Edge(e), gw(&_gw) { }
-      OutEdgeIt& operator++() { 
-	if (!this->backward) {
-	  Node n=gw->source(*this);
-	  *(static_cast<GraphEdge*>(this))=
-	    ++(typename Graph::OutEdgeIt(*(gw->graph), *this));
-	  while (*static_cast<GraphEdge*>(this)!=INVALID && 
-		 !(*(gw->forward_filter))[*this]) 
-	    *(static_cast<GraphEdge*>(this))=
-	      ++(typename Graph::OutEdgeIt(*(gw->graph), *this));
-	  if (*static_cast<GraphEdge*>(this)==INVALID) {
-	    *static_cast<Edge*>(this)=
-	      Edge(typename Graph::InEdgeIt(*(gw->graph), n), true);
-	    while (*static_cast<GraphEdge*>(this)!=INVALID && 
-		   !(*(gw->backward_filter))[*this]) 
-	      *(static_cast<GraphEdge*>(this))=
-		++(typename Graph::InEdgeIt(*(gw->graph), *this));
-	  }
-	} else {
-	  *(static_cast<GraphEdge*>(this))=
-	    ++(typename Graph::InEdgeIt(*(gw->graph), *this));
-	  while (*static_cast<GraphEdge*>(this)!=INVALID && 
-		 !(*(gw->backward_filter))[*this]) 
-	    *(static_cast<GraphEdge*>(this))=
-	      ++(typename Graph::InEdgeIt(*(gw->graph), *this));
-	}
-	return *this;
-      }
-    };
-
-    class InEdgeIt : public Edge {
-      friend class SubBidirGraphWrapper<Graph, 
-					ForwardFilterMap, BackwardFilterMap>;
-    protected:
-      const SubBidirGraphWrapper<Graph, 
-				 ForwardFilterMap, BackwardFilterMap>* gw;
-    public:
-      InEdgeIt() { }
-      InEdgeIt(Invalid i) : Edge(i) { }
-      InEdgeIt(const SubBidirGraphWrapper<Graph, 
-	       ForwardFilterMap, BackwardFilterMap>& _gw, const Node& n) : 
-	Edge(typename Graph::InEdgeIt(*(_gw.graph), n), false), gw(&_gw) { 
-	while (*static_cast<GraphEdge*>(this)!=INVALID && 
-	       !(*(gw->forward_filter))[*this]) 
-	  *(static_cast<GraphEdge*>(this))=
-	    ++(typename Graph::InEdgeIt(*(gw->graph), *this));
-	if (*static_cast<GraphEdge*>(this)==INVALID) {
-	  *static_cast<Edge*>(this)=
-	    Edge(typename Graph::OutEdgeIt(*(_gw.graph), n), true);
-	  while (*static_cast<GraphEdge*>(this)!=INVALID && 
-		 !(*(gw->backward_filter))[*this]) 
-	    *(static_cast<GraphEdge*>(this))=
-	      ++(typename Graph::OutEdgeIt(*(gw->graph), *this));
-	}
-      }
-      InEdgeIt(const SubBidirGraphWrapper<Graph, 
-	       ForwardFilterMap, BackwardFilterMap>& _gw, const Edge& e) : 
-	Edge(e), gw(&_gw) { }
-      InEdgeIt& operator++() { 
-	if (!this->backward) {
-	  Node n=gw->source(*this);
-	  *(static_cast<GraphEdge*>(this))=
-	    ++(typename Graph::InEdgeIt(*(gw->graph), *this));
-	  while (*static_cast<GraphEdge*>(this)!=INVALID && 
-		 !(*(gw->forward_filter))[*this]) 
-	    *(static_cast<GraphEdge*>(this))=
-	      ++(typename Graph::InEdgeIt(*(gw->graph), *this));
-	  if (*static_cast<GraphEdge*>(this)==INVALID) {
-	    *static_cast<Edge*>(this)=
-	      Edge(typename Graph::OutEdgeIt(*(gw->graph), n), true);
-	    while (*static_cast<GraphEdge*>(this)!=INVALID && 
-		   !(*(gw->backward_filter))[*this]) 
-	      *(static_cast<GraphEdge*>(this))=
-		++(typename Graph::OutEdgeIt(*(gw->graph), *this));
-	  }
-	} else {
-	  *(static_cast<GraphEdge*>(this))=
-	    ++(typename Graph::OutEdgeIt(*(gw->graph), *this));
-	  while (*static_cast<GraphEdge*>(this)!=INVALID && 
-		 !(*(gw->backward_filter))[*this]) 
-	    *(static_cast<GraphEdge*>(this))=
-	      ++(typename Graph::OutEdgeIt(*(gw->graph), *this));
-	}
-	return *this;
-      }
-    };
-
-    class EdgeIt : public Edge {
-      friend class SubBidirGraphWrapper<Graph, 
-					ForwardFilterMap, BackwardFilterMap>;
-    protected:
-      const SubBidirGraphWrapper<Graph, 
-				 ForwardFilterMap, BackwardFilterMap>* gw;
-    public:
-      EdgeIt() { }
-      EdgeIt(Invalid i) : Edge(i) { }
-      EdgeIt(const SubBidirGraphWrapper<Graph, 
-	     ForwardFilterMap, BackwardFilterMap>& _gw) : 
-	Edge(typename Graph::EdgeIt(*(_gw.graph)), false), gw(&_gw) { 
-	while (*static_cast<GraphEdge*>(this)!=INVALID && 
-	       !(*(gw->forward_filter))[*this]) 
-	  *(static_cast<GraphEdge*>(this))=
-	    ++(typename Graph::EdgeIt(*(gw->graph), *this));
-	if (*static_cast<GraphEdge*>(this)==INVALID) {
-	  *static_cast<Edge*>(this)=
-	    Edge(typename Graph::EdgeIt(*(_gw.graph)), true);
-	  while (*static_cast<GraphEdge*>(this)!=INVALID && 
-		 !(*(gw->backward_filter))[*this]) 
-	    *(static_cast<GraphEdge*>(this))=
-	      ++(typename Graph::EdgeIt(*(gw->graph), *this));
-	}
-      }
-      EdgeIt(const SubBidirGraphWrapper<Graph, 
-	     ForwardFilterMap, BackwardFilterMap>& _gw, const Edge& e) : 
-	Edge(e), gw(&_gw) { }
-      EdgeIt& operator++() { 
-	if (!this->backward) {
-	  *(static_cast<GraphEdge*>(this))=
-	    ++(typename Graph::EdgeIt(*(gw->graph), *this));
-	  while (*static_cast<GraphEdge*>(this)!=INVALID && 
-		 !(*(gw->forward_filter))[*this]) 
-	    *(static_cast<GraphEdge*>(this))=
-	      ++(typename Graph::EdgeIt(*(gw->graph), *this));
-	  if (*static_cast<GraphEdge*>(this)==INVALID) {
-	    *static_cast<Edge*>(this)=
-	      Edge(typename Graph::EdgeIt(*(gw->graph)), true);
-	    while (*static_cast<GraphEdge*>(this)!=INVALID && 
-		   !(*(gw->backward_filter))[*this]) 
-	      *(static_cast<GraphEdge*>(this))=
-		++(typename Graph::EdgeIt(*(gw->graph), *this));
-	  }
-	} else {
-	  *(static_cast<GraphEdge*>(this))=
-	    ++(typename Graph::EdgeIt(*(gw->graph), *this));
-	  while (*static_cast<GraphEdge*>(this)!=INVALID && 
-		 !(*(gw->backward_filter))[*this]) 
-	    *(static_cast<GraphEdge*>(this))=
-	      ++(typename Graph::EdgeIt(*(gw->graph), *this));
-	}
-	return *this;
-      }
-    };
-
-//     using GraphWrapper<Graph>::first;
-//     OutEdgeIt& first(OutEdgeIt& i, const Node& p) const { 
-//       i=OutEdgeIt(*this, p); return i;
+    SubBidirGraphWrapper() { }
+  public:
+    SubBidirGraphWrapper(_Graph& _graph, ForwardFilterMap& _forward_filter, 
+			 BackwardFilterMap& _backward_filter) { 
+      setGraph(_graph);
+      setForwardFilterMap(_forward_filter);
+      setBackwardFilterMap(_backward_filter);
+    }
+  };
+
+//   template<typename Graph, 
+// 	   typename ForwardFilterMap, typename BackwardFilterMap>
+//   class SubBidirGraphWrapper : public GraphWrapper<Graph> {
+//   public:
+//     typedef GraphWrapper<Graph> Parent; 
+//   protected:
+//     ForwardFilterMap* forward_filter;
+//     BackwardFilterMap* backward_filter;
+
+//     SubBidirGraphWrapper() : GraphWrapper<Graph>() { }
+//     void setForwardFilterMap(ForwardFilterMap& _forward_filter) {
+//       forward_filter=&_forward_filter;
 //     }
-//     InEdgeIt& first(InEdgeIt& i, const Node& p) const { 
-//       i=InEdgeIt(*this, p); return i;
+//     void setBackwardFilterMap(BackwardFilterMap& _backward_filter) {
+//       backward_filter=&_backward_filter;
 //     }
-//     EdgeIt& first(EdgeIt& i) const { 
-//       i=EdgeIt(*this); return i;
+
+//   public:
+
+//     SubBidirGraphWrapper(Graph& _graph, ForwardFilterMap& _forward_filter, 
+// 			 BackwardFilterMap& _backward_filter) : 
+//       GraphWrapper<Graph>(_graph), 
+//       forward_filter(&_forward_filter), backward_filter(&_backward_filter) { }
+//     SubBidirGraphWrapper(const SubBidirGraphWrapper<Graph, 
+// 			 ForwardFilterMap, BackwardFilterMap>& gw) : 
+//       Parent(gw), 
+//       forward_filter(gw.forward_filter), 
+//       backward_filter(gw.backward_filter) { }
+
+//     class Edge; 
+//     class OutEdgeIt; 
+//     friend class Edge; 
+//     friend class OutEdgeIt; 
+
+//     template<typename T> class EdgeMap;
+
+//     typedef typename GraphWrapper<Graph>::Node Node;
+
+//     typedef typename Graph::Edge GraphEdge;
+//     /// SubBidirGraphWrapper<..., ..., ...>::Edge is inherited from 
+//     /// Graph::Edge. It contains an extra bool flag which is true 
+//     /// if and only if the 
+//     /// edge is the backward version of the original edge.
+//     class Edge : public Graph::Edge {
+//       friend class SubBidirGraphWrapper<Graph, 
+// 					ForwardFilterMap, BackwardFilterMap>;
+//       template<typename T> friend class EdgeMap;
+//     protected:
+//       bool backward; //true, iff backward
+//     public:
+//       Edge() { }
+//       /// \todo =false is needed, or causes problems?
+//       /// If \c _backward is false, then we get an edge corresponding to the 
+//       /// original one, otherwise its oppositely directed pair is obtained.
+//       Edge(const typename Graph::Edge& e, bool _backward/*=false*/) : 
+// 	Graph::Edge(e), backward(_backward) { }
+//       Edge(Invalid i) : Graph::Edge(i), backward(true) { }
+//       bool operator==(const Edge& v) const { 
+// 	return (this->backward==v.backward && 
+// 		static_cast<typename Graph::Edge>(*this)==
+// 		static_cast<typename Graph::Edge>(v));
+//       } 
+//       bool operator!=(const Edge& v) const { 
+// 	return (this->backward!=v.backward || 
+// 		static_cast<typename Graph::Edge>(*this)!=
+// 		static_cast<typename Graph::Edge>(v));
+//       }
+//     };
+
+//     class OutEdgeIt : public Edge {
+//       friend class SubBidirGraphWrapper<Graph, 
+// 					ForwardFilterMap, BackwardFilterMap>;
+//     protected:
+//       const SubBidirGraphWrapper<Graph, 
+// 				 ForwardFilterMap, BackwardFilterMap>* gw;
+//     public:
+//       OutEdgeIt() { }
+//       OutEdgeIt(Invalid i) : Edge(i) { }
+//       OutEdgeIt(const SubBidirGraphWrapper<Graph, 
+// 		ForwardFilterMap, BackwardFilterMap>& _gw, const Node& n) : 
+// 	Edge(typename Graph::OutEdgeIt(*(_gw.graph), n), false), gw(&_gw) { 
+// 	while (*static_cast<GraphEdge*>(this)!=INVALID && 
+// 	       !(*(gw->forward_filter))[*this]) 
+// 	  *(static_cast<GraphEdge*>(this))=
+// 	    ++(typename Graph::OutEdgeIt(*(gw->graph), *this));
+// 	if (*static_cast<GraphEdge*>(this)==INVALID) {
+// 	  *static_cast<Edge*>(this)=
+// 	    Edge(typename Graph::InEdgeIt(*(_gw.graph), n), true);
+// 	  while (*static_cast<GraphEdge*>(this)!=INVALID && 
+// 		 !(*(gw->backward_filter))[*this]) 
+// 	    *(static_cast<GraphEdge*>(this))=
+// 	      ++(typename Graph::InEdgeIt(*(gw->graph), *this));
+// 	}
+//       }
+//       OutEdgeIt(const SubBidirGraphWrapper<Graph, 
+// 		ForwardFilterMap, BackwardFilterMap>& _gw, const Edge& e) : 
+// 	Edge(e), gw(&_gw) { }
+//       OutEdgeIt& operator++() { 
+// 	if (!this->backward) {
+// 	  Node n=gw->source(*this);
+// 	  *(static_cast<GraphEdge*>(this))=
+// 	    ++(typename Graph::OutEdgeIt(*(gw->graph), *this));
+// 	  while (*static_cast<GraphEdge*>(this)!=INVALID && 
+// 		 !(*(gw->forward_filter))[*this]) 
+// 	    *(static_cast<GraphEdge*>(this))=
+// 	      ++(typename Graph::OutEdgeIt(*(gw->graph), *this));
+// 	  if (*static_cast<GraphEdge*>(this)==INVALID) {
+// 	    *static_cast<Edge*>(this)=
+// 	      Edge(typename Graph::InEdgeIt(*(gw->graph), n), true);
+// 	    while (*static_cast<GraphEdge*>(this)!=INVALID && 
+// 		   !(*(gw->backward_filter))[*this]) 
+// 	      *(static_cast<GraphEdge*>(this))=
+// 		++(typename Graph::InEdgeIt(*(gw->graph), *this));
+// 	  }
+// 	} else {
+// 	  *(static_cast<GraphEdge*>(this))=
+// 	    ++(typename Graph::InEdgeIt(*(gw->graph), *this));
+// 	  while (*static_cast<GraphEdge*>(this)!=INVALID && 
+// 		 !(*(gw->backward_filter))[*this]) 
+// 	    *(static_cast<GraphEdge*>(this))=
+// 	      ++(typename Graph::InEdgeIt(*(gw->graph), *this));
+// 	}
+// 	return *this;
+//       }
+//     };
+
+//     class InEdgeIt : public Edge {
+//       friend class SubBidirGraphWrapper<Graph, 
+// 					ForwardFilterMap, BackwardFilterMap>;
+//     protected:
+//       const SubBidirGraphWrapper<Graph, 
+// 				 ForwardFilterMap, BackwardFilterMap>* gw;
+//     public:
+//       InEdgeIt() { }
+//       InEdgeIt(Invalid i) : Edge(i) { }
+//       InEdgeIt(const SubBidirGraphWrapper<Graph, 
+// 	       ForwardFilterMap, BackwardFilterMap>& _gw, const Node& n) : 
+// 	Edge(typename Graph::InEdgeIt(*(_gw.graph), n), false), gw(&_gw) { 
+// 	while (*static_cast<GraphEdge*>(this)!=INVALID && 
+// 	       !(*(gw->forward_filter))[*this]) 
+// 	  *(static_cast<GraphEdge*>(this))=
+// 	    ++(typename Graph::InEdgeIt(*(gw->graph), *this));
+// 	if (*static_cast<GraphEdge*>(this)==INVALID) {
+// 	  *static_cast<Edge*>(this)=
+// 	    Edge(typename Graph::OutEdgeIt(*(_gw.graph), n), true);
+// 	  while (*static_cast<GraphEdge*>(this)!=INVALID && 
+// 		 !(*(gw->backward_filter))[*this]) 
+// 	    *(static_cast<GraphEdge*>(this))=
+// 	      ++(typename Graph::OutEdgeIt(*(gw->graph), *this));
+// 	}
+//       }
+//       InEdgeIt(const SubBidirGraphWrapper<Graph, 
+// 	       ForwardFilterMap, BackwardFilterMap>& _gw, const Edge& e) : 
+// 	Edge(e), gw(&_gw) { }
+//       InEdgeIt& operator++() { 
+// 	if (!this->backward) {
+// 	  Node n=gw->source(*this);
+// 	  *(static_cast<GraphEdge*>(this))=
+// 	    ++(typename Graph::InEdgeIt(*(gw->graph), *this));
+// 	  while (*static_cast<GraphEdge*>(this)!=INVALID && 
+// 		 !(*(gw->forward_filter))[*this]) 
+// 	    *(static_cast<GraphEdge*>(this))=
+// 	      ++(typename Graph::InEdgeIt(*(gw->graph), *this));
+// 	  if (*static_cast<GraphEdge*>(this)==INVALID) {
+// 	    *static_cast<Edge*>(this)=
+// 	      Edge(typename Graph::OutEdgeIt(*(gw->graph), n), true);
+// 	    while (*static_cast<GraphEdge*>(this)!=INVALID && 
+// 		   !(*(gw->backward_filter))[*this]) 
+// 	      *(static_cast<GraphEdge*>(this))=
+// 		++(typename Graph::OutEdgeIt(*(gw->graph), *this));
+// 	  }
+// 	} else {
+// 	  *(static_cast<GraphEdge*>(this))=
+// 	    ++(typename Graph::OutEdgeIt(*(gw->graph), *this));
+// 	  while (*static_cast<GraphEdge*>(this)!=INVALID && 
+// 		 !(*(gw->backward_filter))[*this]) 
+// 	    *(static_cast<GraphEdge*>(this))=
+// 	      ++(typename Graph::OutEdgeIt(*(gw->graph), *this));
+// 	}
+// 	return *this;
+//       }
+//     };
+
+//     class EdgeIt : public Edge {
+//       friend class SubBidirGraphWrapper<Graph, 
+// 					ForwardFilterMap, BackwardFilterMap>;
+//     protected:
+//       const SubBidirGraphWrapper<Graph, 
+// 				 ForwardFilterMap, BackwardFilterMap>* gw;
+//     public:
+//       EdgeIt() { }
+//       EdgeIt(Invalid i) : Edge(i) { }
+//       EdgeIt(const SubBidirGraphWrapper<Graph, 
+// 	     ForwardFilterMap, BackwardFilterMap>& _gw) : 
+// 	Edge(typename Graph::EdgeIt(*(_gw.graph)), false), gw(&_gw) { 
+// 	while (*static_cast<GraphEdge*>(this)!=INVALID && 
+// 	       !(*(gw->forward_filter))[*this]) 
+// 	  *(static_cast<GraphEdge*>(this))=
+// 	    ++(typename Graph::EdgeIt(*(gw->graph), *this));
+// 	if (*static_cast<GraphEdge*>(this)==INVALID) {
+// 	  *static_cast<Edge*>(this)=
+// 	    Edge(typename Graph::EdgeIt(*(_gw.graph)), true);
+// 	  while (*static_cast<GraphEdge*>(this)!=INVALID && 
+// 		 !(*(gw->backward_filter))[*this]) 
+// 	    *(static_cast<GraphEdge*>(this))=
+// 	      ++(typename Graph::EdgeIt(*(gw->graph), *this));
+// 	}
+//       }
+//       EdgeIt(const SubBidirGraphWrapper<Graph, 
+// 	     ForwardFilterMap, BackwardFilterMap>& _gw, const Edge& e) : 
+// 	Edge(e), gw(&_gw) { }
+//       EdgeIt& operator++() { 
+// 	if (!this->backward) {
+// 	  *(static_cast<GraphEdge*>(this))=
+// 	    ++(typename Graph::EdgeIt(*(gw->graph), *this));
+// 	  while (*static_cast<GraphEdge*>(this)!=INVALID && 
+// 		 !(*(gw->forward_filter))[*this]) 
+// 	    *(static_cast<GraphEdge*>(this))=
+// 	      ++(typename Graph::EdgeIt(*(gw->graph), *this));
+// 	  if (*static_cast<GraphEdge*>(this)==INVALID) {
+// 	    *static_cast<Edge*>(this)=
+// 	      Edge(typename Graph::EdgeIt(*(gw->graph)), true);
+// 	    while (*static_cast<GraphEdge*>(this)!=INVALID && 
+// 		   !(*(gw->backward_filter))[*this]) 
+// 	      *(static_cast<GraphEdge*>(this))=
+// 		++(typename Graph::EdgeIt(*(gw->graph), *this));
+// 	  }
+// 	} else {
+// 	  *(static_cast<GraphEdge*>(this))=
+// 	    ++(typename Graph::EdgeIt(*(gw->graph), *this));
+// 	  while (*static_cast<GraphEdge*>(this)!=INVALID && 
+// 		 !(*(gw->backward_filter))[*this]) 
+// 	    *(static_cast<GraphEdge*>(this))=
+// 	      ++(typename Graph::EdgeIt(*(gw->graph), *this));
+// 	}
+// 	return *this;
+//       }
+//     };
+
+// //     using GraphWrapper<Graph>::first;
+// //     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;
+// //     }
+// //     EdgeIt& first(EdgeIt& i) const { 
+// //       i=EdgeIt(*this); return i;
+// //     }
+  
+
+//     Node source(Edge e) const { 
+//       return ((!e.backward) ? this->graph->source(e) : this->graph->target(e)); }
+//     Node target(Edge e) const { 
+//       return ((!e.backward) ? this->graph->target(e) : this->graph->source(e)); }
+
+//     /// Gives back the opposite edge.
+//     Edge opposite(const Edge& e) const { 
+//       Edge f=e;
+//       f.backward=!f.backward;
+//       return f;
 //     }
-  
-
-    Node source(Edge e) const { 
-      return ((!e.backward) ? this->graph->source(e) : this->graph->target(e)); }
-    Node target(Edge e) const { 
-      return ((!e.backward) ? this->graph->target(e) : this->graph->source(e)); }
-
-    /// Gives back the opposite edge.
-    Edge opposite(const Edge& e) const { 
-      Edge f=e;
-      f.backward=!f.backward;
-      return f;
-    }
-
-    /// \warning This is a linear time operation and works only if 
-    /// \c Graph::EdgeIt is defined.
-    int edgeNum() const { 
-      int i=0;
-      for (EdgeIt e(*this); e!=INVALID; ++e) ++i;
-      return i; 
-    }
-
-    bool forward(const Edge& e) const { return !e.backward; }
-    bool backward(const Edge& e) const { return e.backward; }
-
-
-    template <typename T>
-    /// \c SubBidirGraphWrapper<..., ..., ...>::EdgeMap contains two 
-    /// Graph::EdgeMap one for the forward edges and 
-    /// one for the backward edges.
-    class EdgeMap {
-      template <typename TT> friend class EdgeMap;
-      typename Graph::template EdgeMap<T> forward_map, backward_map; 
-    public:
-      typedef T Value;
-      typedef Edge Key;
-
-      EdgeMap(const SubBidirGraphWrapper<Graph, 
-	      ForwardFilterMap, BackwardFilterMap>& g) : 
-	forward_map(*(g.graph)), backward_map(*(g.graph)) { }
-
-      EdgeMap(const SubBidirGraphWrapper<Graph, 
-	      ForwardFilterMap, BackwardFilterMap>& g, T a) : 
-	forward_map(*(g.graph), a), backward_map(*(g.graph), a) { }
-
-      template <typename TT>
-      EdgeMap(const EdgeMap<TT>& copy) 
-	: forward_map(copy.forward_map), backward_map(copy.backward_map) {}
-
-      template <typename TT>
-      EdgeMap& operator=(const EdgeMap<TT>& copy) {
-	forward_map = copy.forward_map;
-	backward_map = copy.backward_map;
-	return *this;
-      }
+
+//     /// \warning This is a linear time operation and works only if 
+//     /// \c Graph::EdgeIt is defined.
+//     int edgeNum() const { 
+//       int i=0;
+//       for (EdgeIt e(*this); e!=INVALID; ++e) ++i;
+//       return i; 
+//     }
+
+//     bool forward(const Edge& e) const { return !e.backward; }
+//     bool backward(const Edge& e) const { return e.backward; }
+
+
+//     template <typename T>
+//     /// \c SubBidirGraphWrapper<..., ..., ...>::EdgeMap contains two 
+//     /// Graph::EdgeMap one for the forward edges and 
+//     /// one for the backward edges.
+//     class EdgeMap {
+//       template <typename TT> friend class EdgeMap;
+//       typename Graph::template EdgeMap<T> forward_map, backward_map; 
+//     public:
+//       typedef T Value;
+//       typedef Edge Key;
+
+//       EdgeMap(const SubBidirGraphWrapper<Graph, 
+// 	      ForwardFilterMap, BackwardFilterMap>& g) : 
+// 	forward_map(*(g.graph)), backward_map(*(g.graph)) { }
+
+//       EdgeMap(const SubBidirGraphWrapper<Graph, 
+// 	      ForwardFilterMap, BackwardFilterMap>& g, T a) : 
+// 	forward_map(*(g.graph), a), backward_map(*(g.graph), a) { }
+
+//       template <typename TT>
+//       EdgeMap(const EdgeMap<TT>& copy) 
+// 	: forward_map(copy.forward_map), backward_map(copy.backward_map) {}
+
+//       template <typename TT>
+//       EdgeMap& operator=(const EdgeMap<TT>& copy) {
+// 	forward_map = copy.forward_map;
+// 	backward_map = copy.backward_map;
+// 	return *this;
+//       }
       
-      void set(Edge e, T a) { 
-	if (!e.backward) 
-	  forward_map.set(e, a); 
-	else 
-	  backward_map.set(e, a); 
-      }
-
-      typename Graph::template EdgeMap<T>::ConstReference 
-      operator[](Edge e) const { 
-	if (!e.backward) 
-	  return forward_map[e]; 
-	else 
-	  return backward_map[e]; 
-      }
-
-      typename Graph::template EdgeMap<T>::Reference 
-      operator[](Edge e) { 
-	if (!e.backward) 
-	  return forward_map[e]; 
-	else 
-	  return backward_map[e]; 
-      }
-
-      void update() { 
-	forward_map.update(); 
-	backward_map.update();
-      }
-    };
-
-
-    //    KEEP_NODE_MAP(Parent, SubBidirGraphWrapper);
-
-  };
+//       void set(Edge e, T a) { 
+// 	if (!e.backward) 
+// 	  forward_map.set(e, a); 
+// 	else 
+// 	  backward_map.set(e, a); 
+//       }
+
+//       typename Graph::template EdgeMap<T>::ConstReference 
+//       operator[](Edge e) const { 
+// 	if (!e.backward) 
+// 	  return forward_map[e]; 
+// 	else 
+// 	  return backward_map[e]; 
+//       }
+
+//       typename Graph::template EdgeMap<T>::Reference 
+//       operator[](Edge e) { 
+// 	if (!e.backward) 
+// 	  return forward_map[e]; 
+// 	else 
+// 	  return backward_map[e]; 
+//       }
+
+//       void update() { 
+// 	forward_map.update(); 
+// 	backward_map.update();
+//       }
+//     };
+
+
+//     //    KEEP_NODE_MAP(Parent, SubBidirGraphWrapper);
+
+//   };
 
 
Index: src/test/graph_wrapper_test.cc
===================================================================
--- src/test/graph_wrapper_test.cc	(revision 989)
+++ src/test/graph_wrapper_test.cc	(revision 992)
@@ -47,13 +47,18 @@
 //     function_requires<StaticGraphConcept<RevGraphWrapper<Graph> > >();
 
-//     function_requires<StaticGraphConcept<SubGraphWrapper<Graph, Graph::NodeMap<bool> , Graph::EdgeMap<bool> > > >();
-//     function_requires<StaticGraphConcept<NodeSubGraphWrapper<Graph, Graph::NodeMap<bool> > > >();
-//     function_requires<StaticGraphConcept<EdgeSubGraphWrapper<Graph, Graph::EdgeMap<bool> > > >();
+    checkConcept<StaticGraph, SubGraphWrapper<StaticGraph, 
+      StaticGraph::NodeMap<bool> , StaticGraph::EdgeMap<bool> > >();
+    checkConcept<StaticGraph, NodeSubGraphWrapper<StaticGraph, 
+      StaticGraph::NodeMap<bool> > >();
+    checkConcept<StaticGraph, EdgeSubGraphWrapper<StaticGraph, 
+      StaticGraph::EdgeMap<bool> > >();
+    
+    checkConcept<StaticGraph, SubBidirGraphWrapper<StaticGraph, 
+      StaticGraph::EdgeMap<bool>, StaticGraph::EdgeMap<bool> > >();
 
-//     function_requires<StaticGraphConcept<SubBidirGraphWrapper<Graph, Graph::EdgeMap<bool>, Graph::EdgeMap<bool> > > > ();
+    checkConcept<StaticGraph, BidirGraph<StaticGraph> >();
 
-//     function_requires<StaticGraphConcept<BidirGraph<Graph> > >();
-
-//     function_requires<StaticGraphConcept<ResGraphWrapper<Graph, int, Graph::EdgeMap<int>, Graph::EdgeMap<int> > > >();
+    checkConcept<StaticGraph, ResGraphWrapper<StaticGraph, int, 
+      StaticGraph::EdgeMap<int>, StaticGraph::EdgeMap<int> > >();
 
 //     function_requires<StaticGraphConcept<ErasingFirstGraphWrapper<Graph, Graph::NodeMap<Graph::Edge> > > >();
