Index: src/lemon/graph_wrapper.h
===================================================================
--- src/lemon/graph_wrapper.h	(revision 932)
+++ src/lemon/graph_wrapper.h	(revision 933)
@@ -369,6 +369,246 @@
   \c Graph::Node that is why \c g.id(n) can be applied.
 
-  Consider now a mathematically more invloved problem, where the application 
-  of SubGraphWrapper is reasonable sure enough. If a shortest path is to be 
+  For other examples see also the documentation of NodeSubGraphWrapper and 
+  EdgeSubGraphWrapper.
+
+  \author Marton Makai
+  */
+  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;
+    }
+    
+    /// 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);
+  };
+
+
+  /*! \brief A wrapper for hiding nodes from a graph.
+
+  \warning Graph wrappers are in even more experimental state than the other
+  parts of the lib. Use them at you own risk.
+  
+  A wrapper for hiding nodes from a graph.
+  This wrapper specializes SubGraphWrapper in the way that only the node-set 
+  can be filtered. Note that this does not mean of considering induced 
+  subgraph, the edge-iterators consider the original edge-set.
+  \author Marton Makai
+  */
+  template<typename Graph, typename NodeFilterMap>
+  class NodeSubGraphWrapper : 
+    public SubGraphWrapper<Graph, NodeFilterMap, 
+			   ConstMap<typename Graph::Edge,bool> > {
+  public:
+    typedef SubGraphWrapper<Graph, NodeFilterMap, 
+			    ConstMap<typename Graph::Edge,bool> > Parent;
+  protected:
+    ConstMap<typename Graph::Edge, bool> const_true_map;
+  public:
+    NodeSubGraphWrapper(Graph& _graph, NodeFilterMap& _node_filter_map) : 
+      Parent(), const_true_map(true) { 
+      Parent::setGraph(_graph);
+      Parent::setNodeFilterMap(_node_filter_map);
+      Parent::setEdgeFilterMap(const_true_map);
+    }
+  };
+
+
+  /*! \brief A wrapper for hiding edges from a graph.
+
+  \warning Graph wrappers are in even more experimental state than the other
+  parts of the lib. Use them at you own risk.
+  
+  A wrapper for hiding edges from a graph.
+  This wrapper specializes SubGraphWrapper in the way that only the edge-set 
+  can be filtered. The usefulness of this wrapper is demonstrated in the 
+  problem of searching a maximum number of edge-disjoint shortest paths 
+  between 
+  two nodes \c s and \c t. Shortest here means being shortest w.r.t. 
+  non-negative edge-lengths. Note that 
+  the comprehension of the presented solution 
+  need's some knowledge from elementary combinatorial optimization. 
+
+  If a single shortest path is to be 
   searched between two nodes \c s and \c t, then this can be done easily by 
   applying the Dijkstra algorithm class. What happens, if a maximum number of 
@@ -377,5 +617,5 @@
   the potential function computed by Dijkstra. Moreover, any path containing 
   only such edges is a shortest one. Thus we have to compute a maximum number 
-  of edge-disjoint path between \c s and \c t in the graph which has edge-set 
+  of edge-disjoint paths between \c s and \c t in the graph which has edge-set 
   all the tight edges. The computation will be demonstrated on the following 
   graph, which is read from a dimacs file.
@@ -478,205 +718,5 @@
    1, 0--2->2
   \endcode
-  \author Marton Makai
-  */
-  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;
-    }
-    
-    /// 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);
-  };
-
-
-  /*! \brief A wrapper for hiding edges from a graph.
-
-  \warning Graph wrappers are in even more experimental state than the other
-  parts of the lib. Use them at you own risk.
-  
-  A wrapper for hiding edges from a graph.
-  This wrapper specializes SubGraphWrapper in the way that only the edge-set 
-  can be filtered.
+
   \author Marton Makai
   */
