GraphWrapper changes for factory
authormarci
Mon, 15 Nov 2004 12:25:39 +0000
changeset 99210d378f2821c
parent 991 e619a466ca5d
child 993 21d1b4fa1b24
GraphWrapper changes for factory
src/lemon/graph_wrapper.h
src/test/graph_wrapper_test.cc
     1.1 --- a/src/lemon/graph_wrapper.h	Sun Nov 14 13:15:46 2004 +0000
     1.2 +++ b/src/lemon/graph_wrapper.h	Mon Nov 15 12:25:39 2004 +0000
     1.3 @@ -27,6 +27,7 @@
     1.4  
     1.5  #include <lemon/invalid.h>
     1.6  #include <lemon/maps.h>
     1.7 +#include <lemon/iterable_graph_extender.h>
     1.8  #include <lemon/map_defines.h>
     1.9  #include <iostream>
    1.10  
    1.11 @@ -123,7 +124,7 @@
    1.12  
    1.13    public:
    1.14      GraphWrapperBase(Graph& _graph) : graph(&_graph) { }
    1.15 -    GraphWrapperBase(const GraphWrapperBase<_Graph>& gw) : graph(gw.graph) { }
    1.16 +//     GraphWrapperBase(const GraphWrapperBase<_Graph>& gw) : graph(gw.graph) { }
    1.17   
    1.18      typedef typename Graph::Node Node;
    1.19      typedef typename Graph::Edge Edge;
    1.20 @@ -299,7 +300,118 @@
    1.21  
    1.22    };
    1.23  
    1.24 +  
    1.25 +  template <typename _Graph, typename NodeFilterMap, typename EdgeFilterMap>
    1.26 +  class SubGraphWrapperBase : public GraphWrapperBase<_Graph> {
    1.27 +  public:
    1.28 +    typedef _Graph Graph;
    1.29 +    typedef GraphWrapperBase<_Graph> Parent;
    1.30 +  protected:
    1.31 +    NodeFilterMap* node_filter_map;
    1.32 +    EdgeFilterMap* edge_filter_map;
    1.33 +    SubGraphWrapperBase() : Parent(), 
    1.34 +			    node_filter_map(0), edge_filter_map(0) { }
    1.35  
    1.36 +    void setNodeFilterMap(NodeFilterMap& _node_filter_map) {
    1.37 +      node_filter_map=&_node_filter_map;
    1.38 +    }
    1.39 +    void setEdgeFilterMap(EdgeFilterMap& _edge_filter_map) {
    1.40 +      edge_filter_map=&_edge_filter_map;
    1.41 +    }
    1.42 +
    1.43 +  public:
    1.44 +//     SubGraphWrapperBase(Graph& _graph, 
    1.45 +// 			NodeFilterMap& _node_filter_map, 
    1.46 +// 			EdgeFilterMap& _edge_filter_map) : 
    1.47 +//       Parent(&_graph), 
    1.48 +//       node_filter_map(&node_filter_map), 
    1.49 +//       edge_filter_map(&edge_filter_map) { }
    1.50 +
    1.51 +    typedef typename Parent::Node Node;
    1.52 +    typedef typename Parent::Edge Edge;
    1.53 +
    1.54 +    void first(Node& i) const { 
    1.55 +      Parent::first(i); 
    1.56 +      while (i!=INVALID && !(*node_filter_map)[i]) Parent::next(i); 
    1.57 +    }
    1.58 +    void first(Edge& i) const { 
    1.59 +      Parent::first(i); 
    1.60 +      while (i!=INVALID && !(*edge_filter_map)[i]) Parent::next(i); 
    1.61 +    }
    1.62 +    void firstIn(Edge& i, const Node& n) const { 
    1.63 +      Parent::firstIn(i, n); 
    1.64 +      while (i!=INVALID && !(*edge_filter_map)[i]) Parent::nextIn(i); 
    1.65 +    }
    1.66 +    void firstOut(Edge& i, const Node& n) const { 
    1.67 +      Parent::firstOut(i, n); 
    1.68 +      while (i!=INVALID && !(*edge_filter_map)[i]) Parent::nextOut(i); 
    1.69 +    }
    1.70 +
    1.71 +    void next(Node& i) const { 
    1.72 +      Parent::next(i); 
    1.73 +      while (i!=INVALID && !(*node_filter_map)[i]) Parent::next(i); 
    1.74 +    }
    1.75 +    void next(Edge& i) const { 
    1.76 +      Parent::next(i); 
    1.77 +      while (i!=INVALID && !(*edge_filter_map)[i]) Parent::next(i); 
    1.78 +    }
    1.79 +    void nextIn(Edge& i) const { 
    1.80 +      Parent::nextIn(i); 
    1.81 +      while (i!=INVALID && !(*edge_filter_map)[i]) Parent::nextIn(i); 
    1.82 +    }
    1.83 +    void nextOut(Edge& i) const { 
    1.84 +      Parent::nextOut(i); 
    1.85 +      while (i!=INVALID && !(*edge_filter_map)[i]) Parent::nextOut(i); 
    1.86 +    }
    1.87 +
    1.88 +    /// This function hides \c n in the graph, i.e. the iteration 
    1.89 +    /// jumps over it. This is done by simply setting the value of \c n  
    1.90 +    /// to be false in the corresponding node-map.
    1.91 +    void hide(const Node& n) const { node_filter_map->set(n, false); }
    1.92 +
    1.93 +    /// This function hides \c e in the graph, i.e. the iteration 
    1.94 +    /// jumps over it. This is done by simply setting the value of \c e  
    1.95 +    /// to be false in the corresponding edge-map.
    1.96 +    void hide(const Edge& e) const { edge_filter_map->set(e, false); }
    1.97 +
    1.98 +    /// The value of \c n is set to be true in the node-map which stores 
    1.99 +    /// hide information. If \c n was hidden previuosly, then it is shown 
   1.100 +    /// again
   1.101 +     void unHide(const Node& n) const { node_filter_map->set(n, true); }
   1.102 +
   1.103 +    /// The value of \c e is set to be true in the edge-map which stores 
   1.104 +    /// hide information. If \c e was hidden previuosly, then it is shown 
   1.105 +    /// again
   1.106 +    void unHide(const Edge& e) const { edge_filter_map->set(e, true); }
   1.107 +
   1.108 +    /// Returns true if \c n is hidden.
   1.109 +    bool hidden(const Node& n) const { return !(*node_filter_map)[n]; }
   1.110 +
   1.111 +    /// Returns true if \c n is hidden.
   1.112 +    bool hidden(const Edge& e) const { return !(*edge_filter_map)[e]; }
   1.113 +
   1.114 +    /// \warning This is a linear time operation and works only if s
   1.115 +    /// \c Graph::NodeIt is defined.
   1.116 +    /// \todo assign tags.
   1.117 +    int nodeNum() const { 
   1.118 +      int i=0;
   1.119 +      Node n;
   1.120 +      for (first(n); n!=INVALID; next(n)) ++i;
   1.121 +      return i; 
   1.122 +    }
   1.123 +
   1.124 +    /// \warning This is a linear time operation and works only if 
   1.125 +    /// \c Graph::EdgeIt is defined.
   1.126 +    /// \todo assign tags.
   1.127 +    int edgeNum() const { 
   1.128 +      int i=0;
   1.129 +      Edge e;
   1.130 +      for (first(e); e!=INVALID; next(e)) ++i;
   1.131 +      return i; 
   1.132 +    }
   1.133 +
   1.134 +
   1.135 +  };
   1.136  
   1.137    /*! \brief A graph wrapper for hiding nodes and edges from a graph.
   1.138    
   1.139 @@ -347,195 +459,215 @@
   1.140  
   1.141    \author Marton Makai
   1.142    */
   1.143 -  template<typename Graph, typename NodeFilterMap, 
   1.144 +  template<typename _Graph, typename NodeFilterMap, 
   1.145  	   typename EdgeFilterMap>
   1.146 -  class SubGraphWrapper : public GraphWrapper<Graph> {
   1.147 +  class SubGraphWrapper : 
   1.148 +    public IterableGraphExtender<
   1.149 +    SubGraphWrapperBase<_Graph, NodeFilterMap, EdgeFilterMap> > {
   1.150    public:
   1.151 -    typedef GraphWrapper<Graph> Parent;
   1.152 +    typedef _Graph Graph;
   1.153 +    typedef IterableGraphExtender<
   1.154 +      SubGraphWrapperBase<_Graph, NodeFilterMap, EdgeFilterMap> > Parent;
   1.155    protected:
   1.156 -    NodeFilterMap* node_filter_map;
   1.157 -    EdgeFilterMap* edge_filter_map;
   1.158 +    SubGraphWrapper() { }
   1.159 +  public:
   1.160 +    SubGraphWrapper(_Graph& _graph, NodeFilterMap& _node_filter_map, 
   1.161 +		    EdgeFilterMap& _edge_filter_map) { 
   1.162 +      setGraph(_graph);
   1.163 +      setNodeFilterMap(_node_filter_map);
   1.164 +      setEdgeFilterMap(_edge_filter_map);
   1.165 +    }
   1.166 +  };
   1.167  
   1.168 -    SubGraphWrapper() : GraphWrapper<Graph>(), 
   1.169 -			node_filter_map(0), edge_filter_map(0) { }
   1.170 -    void setNodeFilterMap(NodeFilterMap& _node_filter_map) {
   1.171 -      node_filter_map=&_node_filter_map;
   1.172 -    }
   1.173 -    void setEdgeFilterMap(EdgeFilterMap& _edge_filter_map) {
   1.174 -      edge_filter_map=&_edge_filter_map;
   1.175 -    }
   1.176 +//   template<typename Graph, typename NodeFilterMap, 
   1.177 +// 	   typename EdgeFilterMap>
   1.178 +//   class SubGraphWrapper : public GraphWrapper<Graph> {
   1.179 +//   public:
   1.180 +//     typedef GraphWrapper<Graph> Parent;
   1.181 +//   protected:
   1.182 +//     NodeFilterMap* node_filter_map;
   1.183 +//     EdgeFilterMap* edge_filter_map;
   1.184 +
   1.185 +//     SubGraphWrapper() : GraphWrapper<Graph>(), 
   1.186 +// 			node_filter_map(0), edge_filter_map(0) { }
   1.187 +//     void setNodeFilterMap(NodeFilterMap& _node_filter_map) {
   1.188 +//       node_filter_map=&_node_filter_map;
   1.189 +//     }
   1.190 +//     void setEdgeFilterMap(EdgeFilterMap& _edge_filter_map) {
   1.191 +//       edge_filter_map=&_edge_filter_map;
   1.192 +//     }
   1.193      
   1.194 -  public:
   1.195 -    SubGraphWrapper(Graph& _graph, NodeFilterMap& _node_filter_map, 
   1.196 -		    EdgeFilterMap& _edge_filter_map) : 
   1.197 -      GraphWrapper<Graph>(_graph), node_filter_map(&_node_filter_map), 
   1.198 -      edge_filter_map(&_edge_filter_map) { }  
   1.199 +//   public:
   1.200 +//     SubGraphWrapper(Graph& _graph, NodeFilterMap& _node_filter_map, 
   1.201 +// 		    EdgeFilterMap& _edge_filter_map) : 
   1.202 +//       GraphWrapper<Graph>(_graph), node_filter_map(&_node_filter_map), 
   1.203 +//       edge_filter_map(&_edge_filter_map) { }  
   1.204  
   1.205 -    typedef typename GraphWrapper<Graph>::Node Node;
   1.206 -    class NodeIt : public Node { 
   1.207 -      const SubGraphWrapper<Graph, NodeFilterMap, EdgeFilterMap>* gw;
   1.208 -      friend class SubGraphWrapper<Graph, NodeFilterMap, EdgeFilterMap>;
   1.209 -    public:
   1.210 -      NodeIt() { }
   1.211 -      NodeIt(Invalid i) : Node(i) { }
   1.212 -      NodeIt(const SubGraphWrapper<Graph, NodeFilterMap, EdgeFilterMap>& _gw) : 
   1.213 -	Node(typename Graph::NodeIt(*(_gw.graph))), gw(&_gw) { 
   1.214 -	while (*static_cast<Node*>(this)!=INVALID && 
   1.215 -	       !(*(gw->node_filter_map))[*this]) 
   1.216 -	  *(static_cast<Node*>(this))=
   1.217 -	    ++(typename Graph::NodeIt(*(gw->graph), *this));
   1.218 -      }
   1.219 -      NodeIt(const SubGraphWrapper<Graph, NodeFilterMap, EdgeFilterMap>& _gw, 
   1.220 -	     const Node& n) : 
   1.221 -	Node(n), gw(&_gw) { }
   1.222 -      NodeIt& operator++() { 
   1.223 -	*(static_cast<Node*>(this))=
   1.224 -	  ++(typename Graph::NodeIt(*(gw->graph), *this));
   1.225 -	while (*static_cast<Node*>(this)!=INVALID && 
   1.226 -	       !(*(gw->node_filter_map))[*this]) 
   1.227 -	  *(static_cast<Node*>(this))=
   1.228 -	    ++(typename Graph::NodeIt(*(gw->graph), *this));
   1.229 -	return *this; 
   1.230 -      }
   1.231 -    };
   1.232 -    typedef typename GraphWrapper<Graph>::Edge Edge;
   1.233 -    class OutEdgeIt : public Edge { 
   1.234 -      const SubGraphWrapper<Graph, NodeFilterMap, EdgeFilterMap>* gw;
   1.235 -      friend class SubGraphWrapper<Graph, NodeFilterMap, EdgeFilterMap>;
   1.236 -    public:
   1.237 -      OutEdgeIt() { }
   1.238 -      OutEdgeIt(Invalid i) : Edge(i) { }
   1.239 -      OutEdgeIt(const SubGraphWrapper<Graph, NodeFilterMap, EdgeFilterMap>& _gw, const Node& n) : 
   1.240 -	Edge(typename Graph::OutEdgeIt(*(_gw.graph), n)), gw(&_gw) { 
   1.241 -	while (*static_cast<Edge*>(this)!=INVALID && 
   1.242 -	       !(*(gw->edge_filter_map))[*this]) 
   1.243 -	  *(static_cast<Edge*>(this))=
   1.244 -	    ++(typename Graph::OutEdgeIt(*(gw->graph), *this));
   1.245 -      }
   1.246 -      OutEdgeIt(const SubGraphWrapper<Graph, NodeFilterMap, EdgeFilterMap>& _gw, 
   1.247 -	     const Edge& e) : 
   1.248 -	Edge(e), gw(&_gw) { }
   1.249 -      OutEdgeIt& operator++() { 
   1.250 -	*(static_cast<Edge*>(this))=
   1.251 -	  ++(typename Graph::OutEdgeIt(*(gw->graph), *this));
   1.252 -	while (*static_cast<Edge*>(this)!=INVALID && 
   1.253 -	       !(*(gw->edge_filter_map))[*this]) 
   1.254 -	  *(static_cast<Edge*>(this))=
   1.255 -	    ++(typename Graph::OutEdgeIt(*(gw->graph), *this));
   1.256 -	return *this; 
   1.257 -      }
   1.258 -    };
   1.259 -    class InEdgeIt : public Edge { 
   1.260 -      const SubGraphWrapper<Graph, NodeFilterMap, EdgeFilterMap>* gw;
   1.261 -      friend class SubGraphWrapper<Graph, NodeFilterMap, EdgeFilterMap>;
   1.262 -    public:
   1.263 -      InEdgeIt() { }
   1.264 -      //      InEdgeIt(const InEdgeIt& e) : Edge(e), gw(e.gw) { }
   1.265 -      InEdgeIt(Invalid i) : Edge(i) { }
   1.266 -      InEdgeIt(const SubGraphWrapper<Graph, NodeFilterMap, EdgeFilterMap>& _gw, const Node& n) : 
   1.267 -	Edge(typename Graph::InEdgeIt(*(_gw.graph), n)), gw(&_gw) { 
   1.268 -	while (*static_cast<Edge*>(this)!=INVALID && 
   1.269 -	       !(*(gw->edge_filter_map))[*this]) 
   1.270 -	  *(static_cast<Edge*>(this))=
   1.271 -	    ++(typename Graph::InEdgeIt(*(gw->graph), *this));
   1.272 -      }
   1.273 -      InEdgeIt(const SubGraphWrapper<Graph, NodeFilterMap, EdgeFilterMap>& _gw, 
   1.274 -	     const Edge& e) : 
   1.275 -	Edge(e), gw(&_gw) { }
   1.276 -      InEdgeIt& operator++() { 
   1.277 -	*(static_cast<Edge*>(this))=
   1.278 -	  ++(typename Graph::InEdgeIt(*(gw->graph), *this));
   1.279 -	while (*static_cast<Edge*>(this)!=INVALID && 
   1.280 -	       !(*(gw->edge_filter_map))[*this]) 
   1.281 -	  *(static_cast<Edge*>(this))=
   1.282 -	    ++(typename Graph::InEdgeIt(*(gw->graph), *this));
   1.283 -	return *this; 
   1.284 -      }
   1.285 -    };
   1.286 -    class EdgeIt : public Edge { 
   1.287 -      const SubGraphWrapper<Graph, NodeFilterMap, EdgeFilterMap>* gw;
   1.288 -      friend class SubGraphWrapper<Graph, NodeFilterMap, EdgeFilterMap>;
   1.289 -    public:
   1.290 -      EdgeIt() { }
   1.291 -      EdgeIt(Invalid i) : Edge(i) { }
   1.292 -      EdgeIt(const SubGraphWrapper<Graph, NodeFilterMap, EdgeFilterMap>& _gw) : 
   1.293 -	Edge(typename Graph::EdgeIt(*(_gw.graph))), gw(&_gw) { 
   1.294 -	while (*static_cast<Edge*>(this)!=INVALID && 
   1.295 -	       !(*(gw->edge_filter_map))[*this]) 
   1.296 -	  *(static_cast<Edge*>(this))=
   1.297 -	    ++(typename Graph::EdgeIt(*(gw->graph), *this));
   1.298 -      }
   1.299 -      EdgeIt(const SubGraphWrapper<Graph, NodeFilterMap, EdgeFilterMap>& _gw, 
   1.300 -	     const Edge& e) : 
   1.301 -	Edge(e), gw(&_gw) { }
   1.302 -      EdgeIt& operator++() { 
   1.303 -	*(static_cast<Edge*>(this))=
   1.304 -	  ++(typename Graph::EdgeIt(*(gw->graph), *this));
   1.305 -	while (*static_cast<Edge*>(this)!=INVALID && 
   1.306 -	       !(*(gw->edge_filter_map))[*this]) 
   1.307 -	  *(static_cast<Edge*>(this))=
   1.308 -	    ++(typename Graph::EdgeIt(*(gw->graph), *this));
   1.309 -	return *this; 
   1.310 -      }
   1.311 -    };
   1.312 +//     typedef typename GraphWrapper<Graph>::Node Node;
   1.313 +//     class NodeIt : public Node { 
   1.314 +//       const SubGraphWrapper<Graph, NodeFilterMap, EdgeFilterMap>* gw;
   1.315 +//       friend class SubGraphWrapper<Graph, NodeFilterMap, EdgeFilterMap>;
   1.316 +//     public:
   1.317 +//       NodeIt() { }
   1.318 +//       NodeIt(Invalid i) : Node(i) { }
   1.319 +//       NodeIt(const SubGraphWrapper<Graph, NodeFilterMap, EdgeFilterMap>& _gw) : 
   1.320 +// 	Node(typename Graph::NodeIt(*(_gw.graph))), gw(&_gw) { 
   1.321 +// 	while (*static_cast<Node*>(this)!=INVALID && 
   1.322 +// 	       !(*(gw->node_filter_map))[*this]) 
   1.323 +// 	  *(static_cast<Node*>(this))=
   1.324 +// 	    ++(typename Graph::NodeIt(*(gw->graph), *this));
   1.325 +//       }
   1.326 +//       NodeIt(const SubGraphWrapper<Graph, NodeFilterMap, EdgeFilterMap>& _gw, 
   1.327 +// 	     const Node& n) : 
   1.328 +// 	Node(n), gw(&_gw) { }
   1.329 +//       NodeIt& operator++() { 
   1.330 +// 	*(static_cast<Node*>(this))=
   1.331 +// 	  ++(typename Graph::NodeIt(*(gw->graph), *this));
   1.332 +// 	while (*static_cast<Node*>(this)!=INVALID && 
   1.333 +// 	       !(*(gw->node_filter_map))[*this]) 
   1.334 +// 	  *(static_cast<Node*>(this))=
   1.335 +// 	    ++(typename Graph::NodeIt(*(gw->graph), *this));
   1.336 +// 	return *this; 
   1.337 +//       }
   1.338 +//     };
   1.339 +//     typedef typename GraphWrapper<Graph>::Edge Edge;
   1.340 +//     class OutEdgeIt : public Edge { 
   1.341 +//       const SubGraphWrapper<Graph, NodeFilterMap, EdgeFilterMap>* gw;
   1.342 +//       friend class SubGraphWrapper<Graph, NodeFilterMap, EdgeFilterMap>;
   1.343 +//     public:
   1.344 +//       OutEdgeIt() { }
   1.345 +//       OutEdgeIt(Invalid i) : Edge(i) { }
   1.346 +//       OutEdgeIt(const SubGraphWrapper<Graph, NodeFilterMap, EdgeFilterMap>& _gw, const Node& n) : 
   1.347 +// 	Edge(typename Graph::OutEdgeIt(*(_gw.graph), n)), gw(&_gw) { 
   1.348 +// 	while (*static_cast<Edge*>(this)!=INVALID && 
   1.349 +// 	       !(*(gw->edge_filter_map))[*this]) 
   1.350 +// 	  *(static_cast<Edge*>(this))=
   1.351 +// 	    ++(typename Graph::OutEdgeIt(*(gw->graph), *this));
   1.352 +//       }
   1.353 +//       OutEdgeIt(const SubGraphWrapper<Graph, NodeFilterMap, EdgeFilterMap>& _gw, 
   1.354 +// 	     const Edge& e) : 
   1.355 +// 	Edge(e), gw(&_gw) { }
   1.356 +//       OutEdgeIt& operator++() { 
   1.357 +// 	*(static_cast<Edge*>(this))=
   1.358 +// 	  ++(typename Graph::OutEdgeIt(*(gw->graph), *this));
   1.359 +// 	while (*static_cast<Edge*>(this)!=INVALID && 
   1.360 +// 	       !(*(gw->edge_filter_map))[*this]) 
   1.361 +// 	  *(static_cast<Edge*>(this))=
   1.362 +// 	    ++(typename Graph::OutEdgeIt(*(gw->graph), *this));
   1.363 +// 	return *this; 
   1.364 +//       }
   1.365 +//     };
   1.366 +//     class InEdgeIt : public Edge { 
   1.367 +//       const SubGraphWrapper<Graph, NodeFilterMap, EdgeFilterMap>* gw;
   1.368 +//       friend class SubGraphWrapper<Graph, NodeFilterMap, EdgeFilterMap>;
   1.369 +//     public:
   1.370 +//       InEdgeIt() { }
   1.371 +//       //      InEdgeIt(const InEdgeIt& e) : Edge(e), gw(e.gw) { }
   1.372 +//       InEdgeIt(Invalid i) : Edge(i) { }
   1.373 +//       InEdgeIt(const SubGraphWrapper<Graph, NodeFilterMap, EdgeFilterMap>& _gw, const Node& n) : 
   1.374 +// 	Edge(typename Graph::InEdgeIt(*(_gw.graph), n)), gw(&_gw) { 
   1.375 +// 	while (*static_cast<Edge*>(this)!=INVALID && 
   1.376 +// 	       !(*(gw->edge_filter_map))[*this]) 
   1.377 +// 	  *(static_cast<Edge*>(this))=
   1.378 +// 	    ++(typename Graph::InEdgeIt(*(gw->graph), *this));
   1.379 +//       }
   1.380 +//       InEdgeIt(const SubGraphWrapper<Graph, NodeFilterMap, EdgeFilterMap>& _gw, 
   1.381 +// 	     const Edge& e) : 
   1.382 +// 	Edge(e), gw(&_gw) { }
   1.383 +//       InEdgeIt& operator++() { 
   1.384 +// 	*(static_cast<Edge*>(this))=
   1.385 +// 	  ++(typename Graph::InEdgeIt(*(gw->graph), *this));
   1.386 +// 	while (*static_cast<Edge*>(this)!=INVALID && 
   1.387 +// 	       !(*(gw->edge_filter_map))[*this]) 
   1.388 +// 	  *(static_cast<Edge*>(this))=
   1.389 +// 	    ++(typename Graph::InEdgeIt(*(gw->graph), *this));
   1.390 +// 	return *this; 
   1.391 +//       }
   1.392 +//     };
   1.393 +//     class EdgeIt : public Edge { 
   1.394 +//       const SubGraphWrapper<Graph, NodeFilterMap, EdgeFilterMap>* gw;
   1.395 +//       friend class SubGraphWrapper<Graph, NodeFilterMap, EdgeFilterMap>;
   1.396 +//     public:
   1.397 +//       EdgeIt() { }
   1.398 +//       EdgeIt(Invalid i) : Edge(i) { }
   1.399 +//       EdgeIt(const SubGraphWrapper<Graph, NodeFilterMap, EdgeFilterMap>& _gw) : 
   1.400 +// 	Edge(typename Graph::EdgeIt(*(_gw.graph))), gw(&_gw) { 
   1.401 +// 	while (*static_cast<Edge*>(this)!=INVALID && 
   1.402 +// 	       !(*(gw->edge_filter_map))[*this]) 
   1.403 +// 	  *(static_cast<Edge*>(this))=
   1.404 +// 	    ++(typename Graph::EdgeIt(*(gw->graph), *this));
   1.405 +//       }
   1.406 +//       EdgeIt(const SubGraphWrapper<Graph, NodeFilterMap, EdgeFilterMap>& _gw, 
   1.407 +// 	     const Edge& e) : 
   1.408 +// 	Edge(e), gw(&_gw) { }
   1.409 +//       EdgeIt& operator++() { 
   1.410 +// 	*(static_cast<Edge*>(this))=
   1.411 +// 	  ++(typename Graph::EdgeIt(*(gw->graph), *this));
   1.412 +// 	while (*static_cast<Edge*>(this)!=INVALID && 
   1.413 +// 	       !(*(gw->edge_filter_map))[*this]) 
   1.414 +// 	  *(static_cast<Edge*>(this))=
   1.415 +// 	    ++(typename Graph::EdgeIt(*(gw->graph), *this));
   1.416 +// 	return *this; 
   1.417 +//       }
   1.418 +//     };
   1.419  
   1.420 -    NodeIt& first(NodeIt& i) const { 
   1.421 -      i=NodeIt(*this); return i;
   1.422 -    }
   1.423 -    OutEdgeIt& first(OutEdgeIt& i, const Node& p) const { 
   1.424 -      i=OutEdgeIt(*this, p); return i;
   1.425 -    }
   1.426 -    InEdgeIt& first(InEdgeIt& i, const Node& p) const { 
   1.427 -      i=InEdgeIt(*this, p); return i;
   1.428 -    }
   1.429 -    EdgeIt& first(EdgeIt& i) const { 
   1.430 -      i=EdgeIt(*this); return i;
   1.431 -    }
   1.432 +//     NodeIt& first(NodeIt& i) const { 
   1.433 +//       i=NodeIt(*this); return i;
   1.434 +//     }
   1.435 +//     OutEdgeIt& first(OutEdgeIt& i, const Node& p) const { 
   1.436 +//       i=OutEdgeIt(*this, p); return i;
   1.437 +//     }
   1.438 +//     InEdgeIt& first(InEdgeIt& i, const Node& p) const { 
   1.439 +//       i=InEdgeIt(*this, p); return i;
   1.440 +//     }
   1.441 +//     EdgeIt& first(EdgeIt& i) const { 
   1.442 +//       i=EdgeIt(*this); return i;
   1.443 +//     }
   1.444      
   1.445 -    /// This function hides \c n in the graph, i.e. the iteration 
   1.446 -    /// jumps over it. This is done by simply setting the value of \c n  
   1.447 -    /// to be false in the corresponding node-map.
   1.448 -    void hide(const Node& n) const { node_filter_map->set(n, false); }
   1.449 +//     /// This function hides \c n in the graph, i.e. the iteration 
   1.450 +//     /// jumps over it. This is done by simply setting the value of \c n  
   1.451 +//     /// to be false in the corresponding node-map.
   1.452 +//     void hide(const Node& n) const { node_filter_map->set(n, false); }
   1.453  
   1.454 -    /// This function hides \c e in the graph, i.e. the iteration 
   1.455 -    /// jumps over it. This is done by simply setting the value of \c e  
   1.456 -    /// to be false in the corresponding edge-map.
   1.457 -    void hide(const Edge& e) const { edge_filter_map->set(e, false); }
   1.458 +//     /// This function hides \c e in the graph, i.e. the iteration 
   1.459 +//     /// jumps over it. This is done by simply setting the value of \c e  
   1.460 +//     /// to be false in the corresponding edge-map.
   1.461 +//     void hide(const Edge& e) const { edge_filter_map->set(e, false); }
   1.462  
   1.463 -    /// The value of \c n is set to be true in the node-map which stores 
   1.464 -    /// hide information. If \c n was hidden previuosly, then it is shown 
   1.465 -    /// again
   1.466 -     void unHide(const Node& n) const { node_filter_map->set(n, true); }
   1.467 +//     /// The value of \c n is set to be true in the node-map which stores 
   1.468 +//     /// hide information. If \c n was hidden previuosly, then it is shown 
   1.469 +//     /// again
   1.470 +//      void unHide(const Node& n) const { node_filter_map->set(n, true); }
   1.471  
   1.472 -    /// The value of \c e is set to be true in the edge-map which stores 
   1.473 -    /// hide information. If \c e was hidden previuosly, then it is shown 
   1.474 -    /// again
   1.475 -    void unHide(const Edge& e) const { edge_filter_map->set(e, true); }
   1.476 +//     /// The value of \c e is set to be true in the edge-map which stores 
   1.477 +//     /// hide information. If \c e was hidden previuosly, then it is shown 
   1.478 +//     /// again
   1.479 +//     void unHide(const Edge& e) const { edge_filter_map->set(e, true); }
   1.480  
   1.481 -    /// Returns true if \c n is hidden.
   1.482 -    bool hidden(const Node& n) const { return !(*node_filter_map)[n]; }
   1.483 +//     /// Returns true if \c n is hidden.
   1.484 +//     bool hidden(const Node& n) const { return !(*node_filter_map)[n]; }
   1.485  
   1.486 -    /// Returns true if \c n is hidden.
   1.487 -    bool hidden(const Edge& e) const { return !(*edge_filter_map)[e]; }
   1.488 +//     /// Returns true if \c n is hidden.
   1.489 +//     bool hidden(const Edge& e) const { return !(*edge_filter_map)[e]; }
   1.490  
   1.491 -    /// \warning This is a linear time operation and works only if 
   1.492 -    /// \c Graph::NodeIt is defined.
   1.493 -    int nodeNum() const { 
   1.494 -      int i=0;
   1.495 -      for (NodeIt n(*this); n!=INVALID; ++n) ++i;
   1.496 -      return i; 
   1.497 -    }
   1.498 +//     /// \warning This is a linear time operation and works only if 
   1.499 +//     /// \c Graph::NodeIt is defined.
   1.500 +//     int nodeNum() const { 
   1.501 +//       int i=0;
   1.502 +//       for (NodeIt n(*this); n!=INVALID; ++n) ++i;
   1.503 +//       return i; 
   1.504 +//     }
   1.505  
   1.506 -    /// \warning This is a linear time operation and works only if 
   1.507 -    /// \c Graph::EdgeIt is defined.
   1.508 -    int edgeNum() const { 
   1.509 -      int i=0;
   1.510 -      for (EdgeIt e(*this); e!=INVALID; ++e) ++i;
   1.511 -      return i; 
   1.512 -    }
   1.513 +//     /// \warning This is a linear time operation and works only if 
   1.514 +//     /// \c Graph::EdgeIt is defined.
   1.515 +//     int edgeNum() const { 
   1.516 +//       int i=0;
   1.517 +//       for (EdgeIt e(*this); e!=INVALID; ++e) ++i;
   1.518 +//       return i; 
   1.519 +//     }
   1.520  
   1.521 -    //    KEEP_MAPS(Parent, SubGraphWrapper);
   1.522 -  };
   1.523 +//     //    KEEP_MAPS(Parent, SubGraphWrapper);
   1.524 +//   };
   1.525  
   1.526  
   1.527    /*! \brief A wrapper for hiding nodes from a graph.
   1.528 @@ -799,6 +931,255 @@
   1.529      //    KEEP_MAPS(Parent, UndirGraph);
   1.530    };
   1.531  
   1.532 +  
   1.533 +  template <typename _Graph, 
   1.534 +	    typename ForwardFilterMap, typename BackwardFilterMap>
   1.535 +  class SubBidirGraphWrapperBase : public GraphWrapperBase<_Graph> {
   1.536 +  public:
   1.537 +    typedef _Graph Graph;
   1.538 +    typedef GraphWrapperBase<_Graph> Parent;
   1.539 +  protected:
   1.540 +    ForwardFilterMap* forward_filter;
   1.541 +    BackwardFilterMap* backward_filter;
   1.542 +    SubBidirGraphWrapperBase() : Parent(), 
   1.543 +				 forward_filter(0), backward_filter(0) { }
   1.544 +
   1.545 +    void setForwardFilterMap(ForwardFilterMap& _forward_filter) {
   1.546 +      forward_filter=&_forward_filter;
   1.547 +    }
   1.548 +    void setBackwardFilterMap(BackwardFilterMap& _backward_filter) {
   1.549 +      backward_filter=&_backward_filter;
   1.550 +    }
   1.551 +
   1.552 +  public:
   1.553 +//     SubGraphWrapperBase(Graph& _graph, 
   1.554 +// 			NodeFilterMap& _node_filter_map, 
   1.555 +// 			EdgeFilterMap& _edge_filter_map) : 
   1.556 +//       Parent(&_graph), 
   1.557 +//       node_filter_map(&node_filter_map), 
   1.558 +//       edge_filter_map(&edge_filter_map) { }
   1.559 +
   1.560 +    typedef typename Parent::Node Node;
   1.561 +    typedef typename _Graph::Edge GraphEdge;
   1.562 +    template <typename T> class EdgeMap;
   1.563 +    /// SubBidirGraphWrapperBase<..., ..., ...>::Edge is inherited from 
   1.564 +    /// _Graph::Edge. It contains an extra bool flag which is true 
   1.565 +    /// if and only if the 
   1.566 +    /// edge is the backward version of the original edge.
   1.567 +    class Edge : public _Graph::Edge {
   1.568 +      friend class SubBidirGraphWrapperBase<
   1.569 +	Graph, ForwardFilterMap, BackwardFilterMap>;
   1.570 +      template<typename T> friend class EdgeMap;
   1.571 +    protected:
   1.572 +      bool backward; //true, iff backward
   1.573 +    public:
   1.574 +      Edge() { }
   1.575 +      /// \todo =false is needed, or causes problems?
   1.576 +      /// If \c _backward is false, then we get an edge corresponding to the 
   1.577 +      /// original one, otherwise its oppositely directed pair is obtained.
   1.578 +      Edge(const typename _Graph::Edge& e, bool _backward/*=false*/) : 
   1.579 +	_Graph::Edge(e), backward(_backward) { }
   1.580 +      Edge(Invalid i) : _Graph::Edge(i), backward(true) { }
   1.581 +      bool operator==(const Edge& v) const { 
   1.582 +	return (this->backward==v.backward && 
   1.583 +		static_cast<typename _Graph::Edge>(*this)==
   1.584 +		static_cast<typename _Graph::Edge>(v));
   1.585 +      } 
   1.586 +      bool operator!=(const Edge& v) const { 
   1.587 +	return (this->backward!=v.backward || 
   1.588 +		static_cast<typename _Graph::Edge>(*this)!=
   1.589 +		static_cast<typename _Graph::Edge>(v));
   1.590 +      }
   1.591 +    };
   1.592 +
   1.593 +    void first(Node& i) const { 
   1.594 +      Parent::first(i); 
   1.595 +    }
   1.596 +
   1.597 +    void first(Edge& i) const { 
   1.598 +      Parent::first(i); 
   1.599 +      i.backward=false;
   1.600 +      while (*static_cast<GraphEdge*>(&i)!=INVALID && 
   1.601 +	     !(*forward_filter)[i]) Parent::next(i);
   1.602 +      if (*static_cast<GraphEdge*>(&i)==INVALID) {
   1.603 +	Parent::first(i); 
   1.604 +	i.backward=true;
   1.605 +	while (*static_cast<GraphEdge*>(&i)!=INVALID && 
   1.606 +	       !(*backward_filter)[i]) Parent::next(i);
   1.607 +      }
   1.608 +    }
   1.609 +
   1.610 +    void firstIn(Edge& i, const Node& n) const { 
   1.611 +      Parent::firstIn(i, n); 
   1.612 +      i.backward=false;
   1.613 +      while (*static_cast<GraphEdge*>(&i)!=INVALID && 
   1.614 +	     !(*forward_filter)[i]) Parent::nextOut(i);
   1.615 +      if (*static_cast<GraphEdge*>(&i)==INVALID) {
   1.616 +	Parent::firstOut(i, n); 
   1.617 +	i.backward=true;
   1.618 +	while (*static_cast<GraphEdge*>(&i)!=INVALID && 
   1.619 +	       !(*backward_filter)[i]) Parent::nextOut(i);
   1.620 +      }
   1.621 +    }
   1.622 +
   1.623 +    void firstOut(Edge& i, const Node& n) const { 
   1.624 +      Parent::firstOut(i, n); 
   1.625 +      i.backward=false;
   1.626 +      while (*static_cast<GraphEdge*>(&i)!=INVALID && 
   1.627 +	     !(*forward_filter)[i]) Parent::nextOut(i);
   1.628 +      if (*static_cast<GraphEdge*>(&i)==INVALID) {
   1.629 +	Parent::firstIn(i, n); 
   1.630 +	i.backward=true;
   1.631 +	while (*static_cast<GraphEdge*>(&i)!=INVALID && 
   1.632 +	       !(*backward_filter)[i]) Parent::nextIn(i);
   1.633 +      }
   1.634 +    }
   1.635 +
   1.636 +    void next(Node& i) const { 
   1.637 +      Parent::next(i); 
   1.638 +    }
   1.639 +
   1.640 +    void next(Edge& i) const { 
   1.641 +      if (!(i.backward)) {
   1.642 +	Parent::next(i);
   1.643 +	while (*static_cast<GraphEdge*>(&i)!=INVALID && 
   1.644 +	       !(*forward_filter)[i]) Parent::next(i);
   1.645 +	if (*static_cast<GraphEdge*>(&i)==INVALID) {
   1.646 +	  Parent::first(i); 
   1.647 +	  i.backward=true;
   1.648 +	  while (*static_cast<GraphEdge*>(&i)!=INVALID && 
   1.649 +		 !(*backward_filter)[i]) Parent::next(i);
   1.650 +	}
   1.651 +      } else {
   1.652 +	Parent::next(i);
   1.653 +	while (*static_cast<GraphEdge*>(&i)!=INVALID && 
   1.654 +	       !(*backward_filter)[i]) Parent::next(i);
   1.655 +      }
   1.656 +    }
   1.657 +
   1.658 +    void nextIn(Edge& i) const { 
   1.659 +      if (!(i.backward)) {
   1.660 +	Node n=Parent::target(i);
   1.661 +	Parent::nextIn(i);
   1.662 +	while (*static_cast<GraphEdge*>(&i)!=INVALID && 
   1.663 +	       !(*forward_filter)[i]) Parent::nextIn(i);
   1.664 +	if (*static_cast<GraphEdge*>(&i)==INVALID) {
   1.665 +	  Parent::firstOut(i, n); 
   1.666 +	  i.backward=true;
   1.667 +	  while (*static_cast<GraphEdge*>(&i)!=INVALID && 
   1.668 +		 !(*backward_filter)[i]) Parent::nextOut(i);
   1.669 +	}
   1.670 +      } else {
   1.671 +	Parent::nextOut(i);
   1.672 +	while (*static_cast<GraphEdge*>(&i)!=INVALID && 
   1.673 +	       !(*backward_filter)[i]) Parent::nextOut(i);
   1.674 +      }
   1.675 +    }
   1.676 +
   1.677 +    void nextOut(Edge& i) const { 
   1.678 +      if (!(i.backward)) {
   1.679 +	Node n=Parent::source(i);
   1.680 +	Parent::nextOut(i);
   1.681 +	while (*static_cast<GraphEdge*>(&i)!=INVALID && 
   1.682 +	       !(*forward_filter)[i]) Parent::nextOut(i);
   1.683 +	if (*static_cast<GraphEdge*>(&i)==INVALID) {
   1.684 +	  Parent::firstIn(i, n); 
   1.685 +	  i.backward=true;
   1.686 +	  while (*static_cast<GraphEdge*>(&i)!=INVALID && 
   1.687 +		 !(*backward_filter)[i]) Parent::nextIn(i);
   1.688 +	}
   1.689 +      } else {
   1.690 +	Parent::nextIn(i);
   1.691 +	while (*static_cast<GraphEdge*>(&i)!=INVALID && 
   1.692 +	       !(*backward_filter)[i]) Parent::nextIn(i);
   1.693 +      }
   1.694 +    }
   1.695 +
   1.696 +    Node source(Edge e) const { 
   1.697 +      return ((!e.backward) ? this->graph->source(e) : this->graph->target(e)); }
   1.698 +    Node target(Edge e) const { 
   1.699 +      return ((!e.backward) ? this->graph->target(e) : this->graph->source(e)); }
   1.700 +
   1.701 +    /// Gives back the opposite edge.
   1.702 +    Edge opposite(const Edge& e) const { 
   1.703 +      Edge f=e;
   1.704 +      f.backward=!f.backward;
   1.705 +      return f;
   1.706 +    }
   1.707 +
   1.708 +    /// \warning This is a linear time operation and works only if 
   1.709 +    /// \c Graph::EdgeIt is defined.
   1.710 +    /// \todo hmm
   1.711 +    int edgeNum() const { 
   1.712 +      int i=0;
   1.713 +      Edge e;
   1.714 +      for (first(e); e!=INVALID; next(e)) ++i;
   1.715 +      return i; 
   1.716 +    }
   1.717 +
   1.718 +    bool forward(const Edge& e) const { return !e.backward; }
   1.719 +    bool backward(const Edge& e) const { return e.backward; }
   1.720 +
   1.721 +    template <typename T>
   1.722 +    /// \c SubBidirGraphWrapperBase<..., ..., ...>::EdgeMap contains two 
   1.723 +    /// _Graph::EdgeMap one for the forward edges and 
   1.724 +    /// one for the backward edges.
   1.725 +    class EdgeMap {
   1.726 +      template <typename TT> friend class EdgeMap;
   1.727 +      typename _Graph::template EdgeMap<T> forward_map, backward_map; 
   1.728 +    public:
   1.729 +      typedef T Value;
   1.730 +      typedef Edge Key;
   1.731 +
   1.732 +      EdgeMap(const SubBidirGraphWrapperBase<_Graph, 
   1.733 +	      ForwardFilterMap, BackwardFilterMap>& g) : 
   1.734 +	forward_map(*(g.graph)), backward_map(*(g.graph)) { }
   1.735 +
   1.736 +      EdgeMap(const SubBidirGraphWrapperBase<_Graph, 
   1.737 +	      ForwardFilterMap, BackwardFilterMap>& g, T a) : 
   1.738 +	forward_map(*(g.graph), a), backward_map(*(g.graph), a) { }
   1.739 +
   1.740 +//       template <typename TT>
   1.741 +//       EdgeMap(const EdgeMap<TT>& copy) 
   1.742 +// 	: forward_map(copy.forward_map), backward_map(copy.backward_map) {}
   1.743 +
   1.744 +//       template <typename TT>
   1.745 +//       EdgeMap& operator=(const EdgeMap<TT>& copy) {
   1.746 +// 	forward_map = copy.forward_map;
   1.747 +// 	backward_map = copy.backward_map;
   1.748 +// 	return *this;
   1.749 +//       }
   1.750 +      
   1.751 +      void set(Edge e, T a) { 
   1.752 +	if (!e.backward) 
   1.753 +	  forward_map.set(e, a); 
   1.754 +	else 
   1.755 +	  backward_map.set(e, a); 
   1.756 +      }
   1.757 +
   1.758 +//       typename _Graph::template EdgeMap<T>::ConstReference 
   1.759 +//       operator[](Edge e) const { 
   1.760 +// 	if (!e.backward) 
   1.761 +// 	  return forward_map[e]; 
   1.762 +// 	else 
   1.763 +// 	  return backward_map[e]; 
   1.764 +//       }
   1.765 +
   1.766 +//      typename _Graph::template EdgeMap<T>::Reference 
   1.767 +      T operator[](Edge e) { 
   1.768 +	if (!e.backward) 
   1.769 +	  return forward_map[e]; 
   1.770 +	else 
   1.771 +	  return backward_map[e]; 
   1.772 +      }
   1.773 +
   1.774 +      void update() { 
   1.775 +	forward_map.update(); 
   1.776 +	backward_map.update();
   1.777 +      }
   1.778 +    };
   1.779 +
   1.780 +  };
   1.781  
   1.782  
   1.783    ///\brief A wrapper for composing a subgraph of a 
   1.784 @@ -838,344 +1219,365 @@
   1.785    /// As wrappers usually, the SubBidirGraphWrapper implements the 
   1.786    /// above mentioned graph structure without its physical storage, 
   1.787    /// that is the whole stuff is stored in constant memory. 
   1.788 -  template<typename Graph, 
   1.789 +  template<typename _Graph, 
   1.790  	   typename ForwardFilterMap, typename BackwardFilterMap>
   1.791 -  class SubBidirGraphWrapper : public GraphWrapper<Graph> {
   1.792 +  class SubBidirGraphWrapper : 
   1.793 +    public IterableGraphExtender<
   1.794 +    SubBidirGraphWrapperBase<_Graph, ForwardFilterMap, BackwardFilterMap> > {
   1.795    public:
   1.796 -    typedef GraphWrapper<Graph> Parent; 
   1.797 +    typedef _Graph Graph;
   1.798 +    typedef IterableGraphExtender<
   1.799 +      SubBidirGraphWrapperBase<
   1.800 +      _Graph, ForwardFilterMap, BackwardFilterMap> > Parent;
   1.801    protected:
   1.802 -    ForwardFilterMap* forward_filter;
   1.803 -    BackwardFilterMap* backward_filter;
   1.804 +    SubBidirGraphWrapper() { }
   1.805 +  public:
   1.806 +    SubBidirGraphWrapper(_Graph& _graph, ForwardFilterMap& _forward_filter, 
   1.807 +			 BackwardFilterMap& _backward_filter) { 
   1.808 +      setGraph(_graph);
   1.809 +      setForwardFilterMap(_forward_filter);
   1.810 +      setBackwardFilterMap(_backward_filter);
   1.811 +    }
   1.812 +  };
   1.813  
   1.814 -    SubBidirGraphWrapper() : GraphWrapper<Graph>() { }
   1.815 -    void setForwardFilterMap(ForwardFilterMap& _forward_filter) {
   1.816 -      forward_filter=&_forward_filter;
   1.817 -    }
   1.818 -    void setBackwardFilterMap(BackwardFilterMap& _backward_filter) {
   1.819 -      backward_filter=&_backward_filter;
   1.820 -    }
   1.821 +//   template<typename Graph, 
   1.822 +// 	   typename ForwardFilterMap, typename BackwardFilterMap>
   1.823 +//   class SubBidirGraphWrapper : public GraphWrapper<Graph> {
   1.824 +//   public:
   1.825 +//     typedef GraphWrapper<Graph> Parent; 
   1.826 +//   protected:
   1.827 +//     ForwardFilterMap* forward_filter;
   1.828 +//     BackwardFilterMap* backward_filter;
   1.829  
   1.830 -  public:
   1.831 +//     SubBidirGraphWrapper() : GraphWrapper<Graph>() { }
   1.832 +//     void setForwardFilterMap(ForwardFilterMap& _forward_filter) {
   1.833 +//       forward_filter=&_forward_filter;
   1.834 +//     }
   1.835 +//     void setBackwardFilterMap(BackwardFilterMap& _backward_filter) {
   1.836 +//       backward_filter=&_backward_filter;
   1.837 +//     }
   1.838  
   1.839 -    SubBidirGraphWrapper(Graph& _graph, ForwardFilterMap& _forward_filter, 
   1.840 -			 BackwardFilterMap& _backward_filter) : 
   1.841 -      GraphWrapper<Graph>(_graph), 
   1.842 -      forward_filter(&_forward_filter), backward_filter(&_backward_filter) { }
   1.843 -    SubBidirGraphWrapper(const SubBidirGraphWrapper<Graph, 
   1.844 -			 ForwardFilterMap, BackwardFilterMap>& gw) : 
   1.845 -      Parent(gw), 
   1.846 -      forward_filter(gw.forward_filter), 
   1.847 -      backward_filter(gw.backward_filter) { }
   1.848 +//   public:
   1.849  
   1.850 -    class Edge; 
   1.851 -    class OutEdgeIt; 
   1.852 -    friend class Edge; 
   1.853 -    friend class OutEdgeIt; 
   1.854 +//     SubBidirGraphWrapper(Graph& _graph, ForwardFilterMap& _forward_filter, 
   1.855 +// 			 BackwardFilterMap& _backward_filter) : 
   1.856 +//       GraphWrapper<Graph>(_graph), 
   1.857 +//       forward_filter(&_forward_filter), backward_filter(&_backward_filter) { }
   1.858 +//     SubBidirGraphWrapper(const SubBidirGraphWrapper<Graph, 
   1.859 +// 			 ForwardFilterMap, BackwardFilterMap>& gw) : 
   1.860 +//       Parent(gw), 
   1.861 +//       forward_filter(gw.forward_filter), 
   1.862 +//       backward_filter(gw.backward_filter) { }
   1.863  
   1.864 -    template<typename T> class EdgeMap;
   1.865 +//     class Edge; 
   1.866 +//     class OutEdgeIt; 
   1.867 +//     friend class Edge; 
   1.868 +//     friend class OutEdgeIt; 
   1.869  
   1.870 -    typedef typename GraphWrapper<Graph>::Node Node;
   1.871 +//     template<typename T> class EdgeMap;
   1.872  
   1.873 -    typedef typename Graph::Edge GraphEdge;
   1.874 -    /// SubBidirGraphWrapper<..., ..., ...>::Edge is inherited from 
   1.875 -    /// Graph::Edge. It contains an extra bool flag which is true 
   1.876 -    /// if and only if the 
   1.877 -    /// edge is the backward version of the original edge.
   1.878 -    class Edge : public Graph::Edge {
   1.879 -      friend class SubBidirGraphWrapper<Graph, 
   1.880 -					ForwardFilterMap, BackwardFilterMap>;
   1.881 -      template<typename T> friend class EdgeMap;
   1.882 -    protected:
   1.883 -      bool backward; //true, iff backward
   1.884 -    public:
   1.885 -      Edge() { }
   1.886 -      /// \todo =false is needed, or causes problems?
   1.887 -      /// If \c _backward is false, then we get an edge corresponding to the 
   1.888 -      /// original one, otherwise its oppositely directed pair is obtained.
   1.889 -      Edge(const typename Graph::Edge& e, bool _backward/*=false*/) : 
   1.890 -	Graph::Edge(e), backward(_backward) { }
   1.891 -      Edge(Invalid i) : Graph::Edge(i), backward(true) { }
   1.892 -      bool operator==(const Edge& v) const { 
   1.893 -	return (this->backward==v.backward && 
   1.894 -		static_cast<typename Graph::Edge>(*this)==
   1.895 -		static_cast<typename Graph::Edge>(v));
   1.896 -      } 
   1.897 -      bool operator!=(const Edge& v) const { 
   1.898 -	return (this->backward!=v.backward || 
   1.899 -		static_cast<typename Graph::Edge>(*this)!=
   1.900 -		static_cast<typename Graph::Edge>(v));
   1.901 -      }
   1.902 -    };
   1.903 +//     typedef typename GraphWrapper<Graph>::Node Node;
   1.904  
   1.905 -    class OutEdgeIt : public Edge {
   1.906 -      friend class SubBidirGraphWrapper<Graph, 
   1.907 -					ForwardFilterMap, BackwardFilterMap>;
   1.908 -    protected:
   1.909 -      const SubBidirGraphWrapper<Graph, 
   1.910 -				 ForwardFilterMap, BackwardFilterMap>* gw;
   1.911 -    public:
   1.912 -      OutEdgeIt() { }
   1.913 -      OutEdgeIt(Invalid i) : Edge(i) { }
   1.914 -      OutEdgeIt(const SubBidirGraphWrapper<Graph, 
   1.915 -		ForwardFilterMap, BackwardFilterMap>& _gw, const Node& n) : 
   1.916 -	Edge(typename Graph::OutEdgeIt(*(_gw.graph), n), false), gw(&_gw) { 
   1.917 -	while (*static_cast<GraphEdge*>(this)!=INVALID && 
   1.918 -	       !(*(gw->forward_filter))[*this]) 
   1.919 -	  *(static_cast<GraphEdge*>(this))=
   1.920 -	    ++(typename Graph::OutEdgeIt(*(gw->graph), *this));
   1.921 -	if (*static_cast<GraphEdge*>(this)==INVALID) {
   1.922 -	  *static_cast<Edge*>(this)=
   1.923 -	    Edge(typename Graph::InEdgeIt(*(_gw.graph), n), true);
   1.924 -	  while (*static_cast<GraphEdge*>(this)!=INVALID && 
   1.925 -		 !(*(gw->backward_filter))[*this]) 
   1.926 -	    *(static_cast<GraphEdge*>(this))=
   1.927 -	      ++(typename Graph::InEdgeIt(*(gw->graph), *this));
   1.928 -	}
   1.929 -      }
   1.930 -      OutEdgeIt(const SubBidirGraphWrapper<Graph, 
   1.931 -		ForwardFilterMap, BackwardFilterMap>& _gw, const Edge& e) : 
   1.932 -	Edge(e), gw(&_gw) { }
   1.933 -      OutEdgeIt& operator++() { 
   1.934 -	if (!this->backward) {
   1.935 -	  Node n=gw->source(*this);
   1.936 -	  *(static_cast<GraphEdge*>(this))=
   1.937 -	    ++(typename Graph::OutEdgeIt(*(gw->graph), *this));
   1.938 -	  while (*static_cast<GraphEdge*>(this)!=INVALID && 
   1.939 -		 !(*(gw->forward_filter))[*this]) 
   1.940 -	    *(static_cast<GraphEdge*>(this))=
   1.941 -	      ++(typename Graph::OutEdgeIt(*(gw->graph), *this));
   1.942 -	  if (*static_cast<GraphEdge*>(this)==INVALID) {
   1.943 -	    *static_cast<Edge*>(this)=
   1.944 -	      Edge(typename Graph::InEdgeIt(*(gw->graph), n), true);
   1.945 -	    while (*static_cast<GraphEdge*>(this)!=INVALID && 
   1.946 -		   !(*(gw->backward_filter))[*this]) 
   1.947 -	      *(static_cast<GraphEdge*>(this))=
   1.948 -		++(typename Graph::InEdgeIt(*(gw->graph), *this));
   1.949 -	  }
   1.950 -	} else {
   1.951 -	  *(static_cast<GraphEdge*>(this))=
   1.952 -	    ++(typename Graph::InEdgeIt(*(gw->graph), *this));
   1.953 -	  while (*static_cast<GraphEdge*>(this)!=INVALID && 
   1.954 -		 !(*(gw->backward_filter))[*this]) 
   1.955 -	    *(static_cast<GraphEdge*>(this))=
   1.956 -	      ++(typename Graph::InEdgeIt(*(gw->graph), *this));
   1.957 -	}
   1.958 -	return *this;
   1.959 -      }
   1.960 -    };
   1.961 +//     typedef typename Graph::Edge GraphEdge;
   1.962 +//     /// SubBidirGraphWrapper<..., ..., ...>::Edge is inherited from 
   1.963 +//     /// Graph::Edge. It contains an extra bool flag which is true 
   1.964 +//     /// if and only if the 
   1.965 +//     /// edge is the backward version of the original edge.
   1.966 +//     class Edge : public Graph::Edge {
   1.967 +//       friend class SubBidirGraphWrapper<Graph, 
   1.968 +// 					ForwardFilterMap, BackwardFilterMap>;
   1.969 +//       template<typename T> friend class EdgeMap;
   1.970 +//     protected:
   1.971 +//       bool backward; //true, iff backward
   1.972 +//     public:
   1.973 +//       Edge() { }
   1.974 +//       /// \todo =false is needed, or causes problems?
   1.975 +//       /// If \c _backward is false, then we get an edge corresponding to the 
   1.976 +//       /// original one, otherwise its oppositely directed pair is obtained.
   1.977 +//       Edge(const typename Graph::Edge& e, bool _backward/*=false*/) : 
   1.978 +// 	Graph::Edge(e), backward(_backward) { }
   1.979 +//       Edge(Invalid i) : Graph::Edge(i), backward(true) { }
   1.980 +//       bool operator==(const Edge& v) const { 
   1.981 +// 	return (this->backward==v.backward && 
   1.982 +// 		static_cast<typename Graph::Edge>(*this)==
   1.983 +// 		static_cast<typename Graph::Edge>(v));
   1.984 +//       } 
   1.985 +//       bool operator!=(const Edge& v) const { 
   1.986 +// 	return (this->backward!=v.backward || 
   1.987 +// 		static_cast<typename Graph::Edge>(*this)!=
   1.988 +// 		static_cast<typename Graph::Edge>(v));
   1.989 +//       }
   1.990 +//     };
   1.991  
   1.992 -    class InEdgeIt : public Edge {
   1.993 -      friend class SubBidirGraphWrapper<Graph, 
   1.994 -					ForwardFilterMap, BackwardFilterMap>;
   1.995 -    protected:
   1.996 -      const SubBidirGraphWrapper<Graph, 
   1.997 -				 ForwardFilterMap, BackwardFilterMap>* gw;
   1.998 -    public:
   1.999 -      InEdgeIt() { }
  1.1000 -      InEdgeIt(Invalid i) : Edge(i) { }
  1.1001 -      InEdgeIt(const SubBidirGraphWrapper<Graph, 
  1.1002 -	       ForwardFilterMap, BackwardFilterMap>& _gw, const Node& n) : 
  1.1003 -	Edge(typename Graph::InEdgeIt(*(_gw.graph), n), false), gw(&_gw) { 
  1.1004 -	while (*static_cast<GraphEdge*>(this)!=INVALID && 
  1.1005 -	       !(*(gw->forward_filter))[*this]) 
  1.1006 -	  *(static_cast<GraphEdge*>(this))=
  1.1007 -	    ++(typename Graph::InEdgeIt(*(gw->graph), *this));
  1.1008 -	if (*static_cast<GraphEdge*>(this)==INVALID) {
  1.1009 -	  *static_cast<Edge*>(this)=
  1.1010 -	    Edge(typename Graph::OutEdgeIt(*(_gw.graph), n), true);
  1.1011 -	  while (*static_cast<GraphEdge*>(this)!=INVALID && 
  1.1012 -		 !(*(gw->backward_filter))[*this]) 
  1.1013 -	    *(static_cast<GraphEdge*>(this))=
  1.1014 -	      ++(typename Graph::OutEdgeIt(*(gw->graph), *this));
  1.1015 -	}
  1.1016 -      }
  1.1017 -      InEdgeIt(const SubBidirGraphWrapper<Graph, 
  1.1018 -	       ForwardFilterMap, BackwardFilterMap>& _gw, const Edge& e) : 
  1.1019 -	Edge(e), gw(&_gw) { }
  1.1020 -      InEdgeIt& operator++() { 
  1.1021 -	if (!this->backward) {
  1.1022 -	  Node n=gw->source(*this);
  1.1023 -	  *(static_cast<GraphEdge*>(this))=
  1.1024 -	    ++(typename Graph::InEdgeIt(*(gw->graph), *this));
  1.1025 -	  while (*static_cast<GraphEdge*>(this)!=INVALID && 
  1.1026 -		 !(*(gw->forward_filter))[*this]) 
  1.1027 -	    *(static_cast<GraphEdge*>(this))=
  1.1028 -	      ++(typename Graph::InEdgeIt(*(gw->graph), *this));
  1.1029 -	  if (*static_cast<GraphEdge*>(this)==INVALID) {
  1.1030 -	    *static_cast<Edge*>(this)=
  1.1031 -	      Edge(typename Graph::OutEdgeIt(*(gw->graph), n), true);
  1.1032 -	    while (*static_cast<GraphEdge*>(this)!=INVALID && 
  1.1033 -		   !(*(gw->backward_filter))[*this]) 
  1.1034 -	      *(static_cast<GraphEdge*>(this))=
  1.1035 -		++(typename Graph::OutEdgeIt(*(gw->graph), *this));
  1.1036 -	  }
  1.1037 -	} else {
  1.1038 -	  *(static_cast<GraphEdge*>(this))=
  1.1039 -	    ++(typename Graph::OutEdgeIt(*(gw->graph), *this));
  1.1040 -	  while (*static_cast<GraphEdge*>(this)!=INVALID && 
  1.1041 -		 !(*(gw->backward_filter))[*this]) 
  1.1042 -	    *(static_cast<GraphEdge*>(this))=
  1.1043 -	      ++(typename Graph::OutEdgeIt(*(gw->graph), *this));
  1.1044 -	}
  1.1045 -	return *this;
  1.1046 -      }
  1.1047 -    };
  1.1048 +//     class OutEdgeIt : public Edge {
  1.1049 +//       friend class SubBidirGraphWrapper<Graph, 
  1.1050 +// 					ForwardFilterMap, BackwardFilterMap>;
  1.1051 +//     protected:
  1.1052 +//       const SubBidirGraphWrapper<Graph, 
  1.1053 +// 				 ForwardFilterMap, BackwardFilterMap>* gw;
  1.1054 +//     public:
  1.1055 +//       OutEdgeIt() { }
  1.1056 +//       OutEdgeIt(Invalid i) : Edge(i) { }
  1.1057 +//       OutEdgeIt(const SubBidirGraphWrapper<Graph, 
  1.1058 +// 		ForwardFilterMap, BackwardFilterMap>& _gw, const Node& n) : 
  1.1059 +// 	Edge(typename Graph::OutEdgeIt(*(_gw.graph), n), false), gw(&_gw) { 
  1.1060 +// 	while (*static_cast<GraphEdge*>(this)!=INVALID && 
  1.1061 +// 	       !(*(gw->forward_filter))[*this]) 
  1.1062 +// 	  *(static_cast<GraphEdge*>(this))=
  1.1063 +// 	    ++(typename Graph::OutEdgeIt(*(gw->graph), *this));
  1.1064 +// 	if (*static_cast<GraphEdge*>(this)==INVALID) {
  1.1065 +// 	  *static_cast<Edge*>(this)=
  1.1066 +// 	    Edge(typename Graph::InEdgeIt(*(_gw.graph), n), true);
  1.1067 +// 	  while (*static_cast<GraphEdge*>(this)!=INVALID && 
  1.1068 +// 		 !(*(gw->backward_filter))[*this]) 
  1.1069 +// 	    *(static_cast<GraphEdge*>(this))=
  1.1070 +// 	      ++(typename Graph::InEdgeIt(*(gw->graph), *this));
  1.1071 +// 	}
  1.1072 +//       }
  1.1073 +//       OutEdgeIt(const SubBidirGraphWrapper<Graph, 
  1.1074 +// 		ForwardFilterMap, BackwardFilterMap>& _gw, const Edge& e) : 
  1.1075 +// 	Edge(e), gw(&_gw) { }
  1.1076 +//       OutEdgeIt& operator++() { 
  1.1077 +// 	if (!this->backward) {
  1.1078 +// 	  Node n=gw->source(*this);
  1.1079 +// 	  *(static_cast<GraphEdge*>(this))=
  1.1080 +// 	    ++(typename Graph::OutEdgeIt(*(gw->graph), *this));
  1.1081 +// 	  while (*static_cast<GraphEdge*>(this)!=INVALID && 
  1.1082 +// 		 !(*(gw->forward_filter))[*this]) 
  1.1083 +// 	    *(static_cast<GraphEdge*>(this))=
  1.1084 +// 	      ++(typename Graph::OutEdgeIt(*(gw->graph), *this));
  1.1085 +// 	  if (*static_cast<GraphEdge*>(this)==INVALID) {
  1.1086 +// 	    *static_cast<Edge*>(this)=
  1.1087 +// 	      Edge(typename Graph::InEdgeIt(*(gw->graph), n), true);
  1.1088 +// 	    while (*static_cast<GraphEdge*>(this)!=INVALID && 
  1.1089 +// 		   !(*(gw->backward_filter))[*this]) 
  1.1090 +// 	      *(static_cast<GraphEdge*>(this))=
  1.1091 +// 		++(typename Graph::InEdgeIt(*(gw->graph), *this));
  1.1092 +// 	  }
  1.1093 +// 	} else {
  1.1094 +// 	  *(static_cast<GraphEdge*>(this))=
  1.1095 +// 	    ++(typename Graph::InEdgeIt(*(gw->graph), *this));
  1.1096 +// 	  while (*static_cast<GraphEdge*>(this)!=INVALID && 
  1.1097 +// 		 !(*(gw->backward_filter))[*this]) 
  1.1098 +// 	    *(static_cast<GraphEdge*>(this))=
  1.1099 +// 	      ++(typename Graph::InEdgeIt(*(gw->graph), *this));
  1.1100 +// 	}
  1.1101 +// 	return *this;
  1.1102 +//       }
  1.1103 +//     };
  1.1104  
  1.1105 -    class EdgeIt : public Edge {
  1.1106 -      friend class SubBidirGraphWrapper<Graph, 
  1.1107 -					ForwardFilterMap, BackwardFilterMap>;
  1.1108 -    protected:
  1.1109 -      const SubBidirGraphWrapper<Graph, 
  1.1110 -				 ForwardFilterMap, BackwardFilterMap>* gw;
  1.1111 -    public:
  1.1112 -      EdgeIt() { }
  1.1113 -      EdgeIt(Invalid i) : Edge(i) { }
  1.1114 -      EdgeIt(const SubBidirGraphWrapper<Graph, 
  1.1115 -	     ForwardFilterMap, BackwardFilterMap>& _gw) : 
  1.1116 -	Edge(typename Graph::EdgeIt(*(_gw.graph)), false), gw(&_gw) { 
  1.1117 -	while (*static_cast<GraphEdge*>(this)!=INVALID && 
  1.1118 -	       !(*(gw->forward_filter))[*this]) 
  1.1119 -	  *(static_cast<GraphEdge*>(this))=
  1.1120 -	    ++(typename Graph::EdgeIt(*(gw->graph), *this));
  1.1121 -	if (*static_cast<GraphEdge*>(this)==INVALID) {
  1.1122 -	  *static_cast<Edge*>(this)=
  1.1123 -	    Edge(typename Graph::EdgeIt(*(_gw.graph)), true);
  1.1124 -	  while (*static_cast<GraphEdge*>(this)!=INVALID && 
  1.1125 -		 !(*(gw->backward_filter))[*this]) 
  1.1126 -	    *(static_cast<GraphEdge*>(this))=
  1.1127 -	      ++(typename Graph::EdgeIt(*(gw->graph), *this));
  1.1128 -	}
  1.1129 -      }
  1.1130 -      EdgeIt(const SubBidirGraphWrapper<Graph, 
  1.1131 -	     ForwardFilterMap, BackwardFilterMap>& _gw, const Edge& e) : 
  1.1132 -	Edge(e), gw(&_gw) { }
  1.1133 -      EdgeIt& operator++() { 
  1.1134 -	if (!this->backward) {
  1.1135 -	  *(static_cast<GraphEdge*>(this))=
  1.1136 -	    ++(typename Graph::EdgeIt(*(gw->graph), *this));
  1.1137 -	  while (*static_cast<GraphEdge*>(this)!=INVALID && 
  1.1138 -		 !(*(gw->forward_filter))[*this]) 
  1.1139 -	    *(static_cast<GraphEdge*>(this))=
  1.1140 -	      ++(typename Graph::EdgeIt(*(gw->graph), *this));
  1.1141 -	  if (*static_cast<GraphEdge*>(this)==INVALID) {
  1.1142 -	    *static_cast<Edge*>(this)=
  1.1143 -	      Edge(typename Graph::EdgeIt(*(gw->graph)), true);
  1.1144 -	    while (*static_cast<GraphEdge*>(this)!=INVALID && 
  1.1145 -		   !(*(gw->backward_filter))[*this]) 
  1.1146 -	      *(static_cast<GraphEdge*>(this))=
  1.1147 -		++(typename Graph::EdgeIt(*(gw->graph), *this));
  1.1148 -	  }
  1.1149 -	} else {
  1.1150 -	  *(static_cast<GraphEdge*>(this))=
  1.1151 -	    ++(typename Graph::EdgeIt(*(gw->graph), *this));
  1.1152 -	  while (*static_cast<GraphEdge*>(this)!=INVALID && 
  1.1153 -		 !(*(gw->backward_filter))[*this]) 
  1.1154 -	    *(static_cast<GraphEdge*>(this))=
  1.1155 -	      ++(typename Graph::EdgeIt(*(gw->graph), *this));
  1.1156 -	}
  1.1157 -	return *this;
  1.1158 -      }
  1.1159 -    };
  1.1160 +//     class InEdgeIt : public Edge {
  1.1161 +//       friend class SubBidirGraphWrapper<Graph, 
  1.1162 +// 					ForwardFilterMap, BackwardFilterMap>;
  1.1163 +//     protected:
  1.1164 +//       const SubBidirGraphWrapper<Graph, 
  1.1165 +// 				 ForwardFilterMap, BackwardFilterMap>* gw;
  1.1166 +//     public:
  1.1167 +//       InEdgeIt() { }
  1.1168 +//       InEdgeIt(Invalid i) : Edge(i) { }
  1.1169 +//       InEdgeIt(const SubBidirGraphWrapper<Graph, 
  1.1170 +// 	       ForwardFilterMap, BackwardFilterMap>& _gw, const Node& n) : 
  1.1171 +// 	Edge(typename Graph::InEdgeIt(*(_gw.graph), n), false), gw(&_gw) { 
  1.1172 +// 	while (*static_cast<GraphEdge*>(this)!=INVALID && 
  1.1173 +// 	       !(*(gw->forward_filter))[*this]) 
  1.1174 +// 	  *(static_cast<GraphEdge*>(this))=
  1.1175 +// 	    ++(typename Graph::InEdgeIt(*(gw->graph), *this));
  1.1176 +// 	if (*static_cast<GraphEdge*>(this)==INVALID) {
  1.1177 +// 	  *static_cast<Edge*>(this)=
  1.1178 +// 	    Edge(typename Graph::OutEdgeIt(*(_gw.graph), n), true);
  1.1179 +// 	  while (*static_cast<GraphEdge*>(this)!=INVALID && 
  1.1180 +// 		 !(*(gw->backward_filter))[*this]) 
  1.1181 +// 	    *(static_cast<GraphEdge*>(this))=
  1.1182 +// 	      ++(typename Graph::OutEdgeIt(*(gw->graph), *this));
  1.1183 +// 	}
  1.1184 +//       }
  1.1185 +//       InEdgeIt(const SubBidirGraphWrapper<Graph, 
  1.1186 +// 	       ForwardFilterMap, BackwardFilterMap>& _gw, const Edge& e) : 
  1.1187 +// 	Edge(e), gw(&_gw) { }
  1.1188 +//       InEdgeIt& operator++() { 
  1.1189 +// 	if (!this->backward) {
  1.1190 +// 	  Node n=gw->source(*this);
  1.1191 +// 	  *(static_cast<GraphEdge*>(this))=
  1.1192 +// 	    ++(typename Graph::InEdgeIt(*(gw->graph), *this));
  1.1193 +// 	  while (*static_cast<GraphEdge*>(this)!=INVALID && 
  1.1194 +// 		 !(*(gw->forward_filter))[*this]) 
  1.1195 +// 	    *(static_cast<GraphEdge*>(this))=
  1.1196 +// 	      ++(typename Graph::InEdgeIt(*(gw->graph), *this));
  1.1197 +// 	  if (*static_cast<GraphEdge*>(this)==INVALID) {
  1.1198 +// 	    *static_cast<Edge*>(this)=
  1.1199 +// 	      Edge(typename Graph::OutEdgeIt(*(gw->graph), n), true);
  1.1200 +// 	    while (*static_cast<GraphEdge*>(this)!=INVALID && 
  1.1201 +// 		   !(*(gw->backward_filter))[*this]) 
  1.1202 +// 	      *(static_cast<GraphEdge*>(this))=
  1.1203 +// 		++(typename Graph::OutEdgeIt(*(gw->graph), *this));
  1.1204 +// 	  }
  1.1205 +// 	} else {
  1.1206 +// 	  *(static_cast<GraphEdge*>(this))=
  1.1207 +// 	    ++(typename Graph::OutEdgeIt(*(gw->graph), *this));
  1.1208 +// 	  while (*static_cast<GraphEdge*>(this)!=INVALID && 
  1.1209 +// 		 !(*(gw->backward_filter))[*this]) 
  1.1210 +// 	    *(static_cast<GraphEdge*>(this))=
  1.1211 +// 	      ++(typename Graph::OutEdgeIt(*(gw->graph), *this));
  1.1212 +// 	}
  1.1213 +// 	return *this;
  1.1214 +//       }
  1.1215 +//     };
  1.1216  
  1.1217 -//     using GraphWrapper<Graph>::first;
  1.1218 -//     OutEdgeIt& first(OutEdgeIt& i, const Node& p) const { 
  1.1219 -//       i=OutEdgeIt(*this, p); return i;
  1.1220 -//     }
  1.1221 -//     InEdgeIt& first(InEdgeIt& i, const Node& p) const { 
  1.1222 -//       i=InEdgeIt(*this, p); return i;
  1.1223 -//     }
  1.1224 -//     EdgeIt& first(EdgeIt& i) const { 
  1.1225 -//       i=EdgeIt(*this); return i;
  1.1226 -//     }
  1.1227 +//     class EdgeIt : public Edge {
  1.1228 +//       friend class SubBidirGraphWrapper<Graph, 
  1.1229 +// 					ForwardFilterMap, BackwardFilterMap>;
  1.1230 +//     protected:
  1.1231 +//       const SubBidirGraphWrapper<Graph, 
  1.1232 +// 				 ForwardFilterMap, BackwardFilterMap>* gw;
  1.1233 +//     public:
  1.1234 +//       EdgeIt() { }
  1.1235 +//       EdgeIt(Invalid i) : Edge(i) { }
  1.1236 +//       EdgeIt(const SubBidirGraphWrapper<Graph, 
  1.1237 +// 	     ForwardFilterMap, BackwardFilterMap>& _gw) : 
  1.1238 +// 	Edge(typename Graph::EdgeIt(*(_gw.graph)), false), gw(&_gw) { 
  1.1239 +// 	while (*static_cast<GraphEdge*>(this)!=INVALID && 
  1.1240 +// 	       !(*(gw->forward_filter))[*this]) 
  1.1241 +// 	  *(static_cast<GraphEdge*>(this))=
  1.1242 +// 	    ++(typename Graph::EdgeIt(*(gw->graph), *this));
  1.1243 +// 	if (*static_cast<GraphEdge*>(this)==INVALID) {
  1.1244 +// 	  *static_cast<Edge*>(this)=
  1.1245 +// 	    Edge(typename Graph::EdgeIt(*(_gw.graph)), true);
  1.1246 +// 	  while (*static_cast<GraphEdge*>(this)!=INVALID && 
  1.1247 +// 		 !(*(gw->backward_filter))[*this]) 
  1.1248 +// 	    *(static_cast<GraphEdge*>(this))=
  1.1249 +// 	      ++(typename Graph::EdgeIt(*(gw->graph), *this));
  1.1250 +// 	}
  1.1251 +//       }
  1.1252 +//       EdgeIt(const SubBidirGraphWrapper<Graph, 
  1.1253 +// 	     ForwardFilterMap, BackwardFilterMap>& _gw, const Edge& e) : 
  1.1254 +// 	Edge(e), gw(&_gw) { }
  1.1255 +//       EdgeIt& operator++() { 
  1.1256 +// 	if (!this->backward) {
  1.1257 +// 	  *(static_cast<GraphEdge*>(this))=
  1.1258 +// 	    ++(typename Graph::EdgeIt(*(gw->graph), *this));
  1.1259 +// 	  while (*static_cast<GraphEdge*>(this)!=INVALID && 
  1.1260 +// 		 !(*(gw->forward_filter))[*this]) 
  1.1261 +// 	    *(static_cast<GraphEdge*>(this))=
  1.1262 +// 	      ++(typename Graph::EdgeIt(*(gw->graph), *this));
  1.1263 +// 	  if (*static_cast<GraphEdge*>(this)==INVALID) {
  1.1264 +// 	    *static_cast<Edge*>(this)=
  1.1265 +// 	      Edge(typename Graph::EdgeIt(*(gw->graph)), true);
  1.1266 +// 	    while (*static_cast<GraphEdge*>(this)!=INVALID && 
  1.1267 +// 		   !(*(gw->backward_filter))[*this]) 
  1.1268 +// 	      *(static_cast<GraphEdge*>(this))=
  1.1269 +// 		++(typename Graph::EdgeIt(*(gw->graph), *this));
  1.1270 +// 	  }
  1.1271 +// 	} else {
  1.1272 +// 	  *(static_cast<GraphEdge*>(this))=
  1.1273 +// 	    ++(typename Graph::EdgeIt(*(gw->graph), *this));
  1.1274 +// 	  while (*static_cast<GraphEdge*>(this)!=INVALID && 
  1.1275 +// 		 !(*(gw->backward_filter))[*this]) 
  1.1276 +// 	    *(static_cast<GraphEdge*>(this))=
  1.1277 +// 	      ++(typename Graph::EdgeIt(*(gw->graph), *this));
  1.1278 +// 	}
  1.1279 +// 	return *this;
  1.1280 +//       }
  1.1281 +//     };
  1.1282 +
  1.1283 +// //     using GraphWrapper<Graph>::first;
  1.1284 +// //     OutEdgeIt& first(OutEdgeIt& i, const Node& p) const { 
  1.1285 +// //       i=OutEdgeIt(*this, p); return i;
  1.1286 +// //     }
  1.1287 +// //     InEdgeIt& first(InEdgeIt& i, const Node& p) const { 
  1.1288 +// //       i=InEdgeIt(*this, p); return i;
  1.1289 +// //     }
  1.1290 +// //     EdgeIt& first(EdgeIt& i) const { 
  1.1291 +// //       i=EdgeIt(*this); return i;
  1.1292 +// //     }
  1.1293    
  1.1294  
  1.1295 -    Node source(Edge e) const { 
  1.1296 -      return ((!e.backward) ? this->graph->source(e) : this->graph->target(e)); }
  1.1297 -    Node target(Edge e) const { 
  1.1298 -      return ((!e.backward) ? this->graph->target(e) : this->graph->source(e)); }
  1.1299 +//     Node source(Edge e) const { 
  1.1300 +//       return ((!e.backward) ? this->graph->source(e) : this->graph->target(e)); }
  1.1301 +//     Node target(Edge e) const { 
  1.1302 +//       return ((!e.backward) ? this->graph->target(e) : this->graph->source(e)); }
  1.1303  
  1.1304 -    /// Gives back the opposite edge.
  1.1305 -    Edge opposite(const Edge& e) const { 
  1.1306 -      Edge f=e;
  1.1307 -      f.backward=!f.backward;
  1.1308 -      return f;
  1.1309 -    }
  1.1310 +//     /// Gives back the opposite edge.
  1.1311 +//     Edge opposite(const Edge& e) const { 
  1.1312 +//       Edge f=e;
  1.1313 +//       f.backward=!f.backward;
  1.1314 +//       return f;
  1.1315 +//     }
  1.1316  
  1.1317 -    /// \warning This is a linear time operation and works only if 
  1.1318 -    /// \c Graph::EdgeIt is defined.
  1.1319 -    int edgeNum() const { 
  1.1320 -      int i=0;
  1.1321 -      for (EdgeIt e(*this); e!=INVALID; ++e) ++i;
  1.1322 -      return i; 
  1.1323 -    }
  1.1324 +//     /// \warning This is a linear time operation and works only if 
  1.1325 +//     /// \c Graph::EdgeIt is defined.
  1.1326 +//     int edgeNum() const { 
  1.1327 +//       int i=0;
  1.1328 +//       for (EdgeIt e(*this); e!=INVALID; ++e) ++i;
  1.1329 +//       return i; 
  1.1330 +//     }
  1.1331  
  1.1332 -    bool forward(const Edge& e) const { return !e.backward; }
  1.1333 -    bool backward(const Edge& e) const { return e.backward; }
  1.1334 +//     bool forward(const Edge& e) const { return !e.backward; }
  1.1335 +//     bool backward(const Edge& e) const { return e.backward; }
  1.1336  
  1.1337  
  1.1338 -    template <typename T>
  1.1339 -    /// \c SubBidirGraphWrapper<..., ..., ...>::EdgeMap contains two 
  1.1340 -    /// Graph::EdgeMap one for the forward edges and 
  1.1341 -    /// one for the backward edges.
  1.1342 -    class EdgeMap {
  1.1343 -      template <typename TT> friend class EdgeMap;
  1.1344 -      typename Graph::template EdgeMap<T> forward_map, backward_map; 
  1.1345 -    public:
  1.1346 -      typedef T Value;
  1.1347 -      typedef Edge Key;
  1.1348 +//     template <typename T>
  1.1349 +//     /// \c SubBidirGraphWrapper<..., ..., ...>::EdgeMap contains two 
  1.1350 +//     /// Graph::EdgeMap one for the forward edges and 
  1.1351 +//     /// one for the backward edges.
  1.1352 +//     class EdgeMap {
  1.1353 +//       template <typename TT> friend class EdgeMap;
  1.1354 +//       typename Graph::template EdgeMap<T> forward_map, backward_map; 
  1.1355 +//     public:
  1.1356 +//       typedef T Value;
  1.1357 +//       typedef Edge Key;
  1.1358  
  1.1359 -      EdgeMap(const SubBidirGraphWrapper<Graph, 
  1.1360 -	      ForwardFilterMap, BackwardFilterMap>& g) : 
  1.1361 -	forward_map(*(g.graph)), backward_map(*(g.graph)) { }
  1.1362 +//       EdgeMap(const SubBidirGraphWrapper<Graph, 
  1.1363 +// 	      ForwardFilterMap, BackwardFilterMap>& g) : 
  1.1364 +// 	forward_map(*(g.graph)), backward_map(*(g.graph)) { }
  1.1365  
  1.1366 -      EdgeMap(const SubBidirGraphWrapper<Graph, 
  1.1367 -	      ForwardFilterMap, BackwardFilterMap>& g, T a) : 
  1.1368 -	forward_map(*(g.graph), a), backward_map(*(g.graph), a) { }
  1.1369 +//       EdgeMap(const SubBidirGraphWrapper<Graph, 
  1.1370 +// 	      ForwardFilterMap, BackwardFilterMap>& g, T a) : 
  1.1371 +// 	forward_map(*(g.graph), a), backward_map(*(g.graph), a) { }
  1.1372  
  1.1373 -      template <typename TT>
  1.1374 -      EdgeMap(const EdgeMap<TT>& copy) 
  1.1375 -	: forward_map(copy.forward_map), backward_map(copy.backward_map) {}
  1.1376 +//       template <typename TT>
  1.1377 +//       EdgeMap(const EdgeMap<TT>& copy) 
  1.1378 +// 	: forward_map(copy.forward_map), backward_map(copy.backward_map) {}
  1.1379  
  1.1380 -      template <typename TT>
  1.1381 -      EdgeMap& operator=(const EdgeMap<TT>& copy) {
  1.1382 -	forward_map = copy.forward_map;
  1.1383 -	backward_map = copy.backward_map;
  1.1384 -	return *this;
  1.1385 -      }
  1.1386 +//       template <typename TT>
  1.1387 +//       EdgeMap& operator=(const EdgeMap<TT>& copy) {
  1.1388 +// 	forward_map = copy.forward_map;
  1.1389 +// 	backward_map = copy.backward_map;
  1.1390 +// 	return *this;
  1.1391 +//       }
  1.1392        
  1.1393 -      void set(Edge e, T a) { 
  1.1394 -	if (!e.backward) 
  1.1395 -	  forward_map.set(e, a); 
  1.1396 -	else 
  1.1397 -	  backward_map.set(e, a); 
  1.1398 -      }
  1.1399 +//       void set(Edge e, T a) { 
  1.1400 +// 	if (!e.backward) 
  1.1401 +// 	  forward_map.set(e, a); 
  1.1402 +// 	else 
  1.1403 +// 	  backward_map.set(e, a); 
  1.1404 +//       }
  1.1405  
  1.1406 -      typename Graph::template EdgeMap<T>::ConstReference 
  1.1407 -      operator[](Edge e) const { 
  1.1408 -	if (!e.backward) 
  1.1409 -	  return forward_map[e]; 
  1.1410 -	else 
  1.1411 -	  return backward_map[e]; 
  1.1412 -      }
  1.1413 +//       typename Graph::template EdgeMap<T>::ConstReference 
  1.1414 +//       operator[](Edge e) const { 
  1.1415 +// 	if (!e.backward) 
  1.1416 +// 	  return forward_map[e]; 
  1.1417 +// 	else 
  1.1418 +// 	  return backward_map[e]; 
  1.1419 +//       }
  1.1420  
  1.1421 -      typename Graph::template EdgeMap<T>::Reference 
  1.1422 -      operator[](Edge e) { 
  1.1423 -	if (!e.backward) 
  1.1424 -	  return forward_map[e]; 
  1.1425 -	else 
  1.1426 -	  return backward_map[e]; 
  1.1427 -      }
  1.1428 +//       typename Graph::template EdgeMap<T>::Reference 
  1.1429 +//       operator[](Edge e) { 
  1.1430 +// 	if (!e.backward) 
  1.1431 +// 	  return forward_map[e]; 
  1.1432 +// 	else 
  1.1433 +// 	  return backward_map[e]; 
  1.1434 +//       }
  1.1435  
  1.1436 -      void update() { 
  1.1437 -	forward_map.update(); 
  1.1438 -	backward_map.update();
  1.1439 -      }
  1.1440 -    };
  1.1441 +//       void update() { 
  1.1442 +// 	forward_map.update(); 
  1.1443 +// 	backward_map.update();
  1.1444 +//       }
  1.1445 +//     };
  1.1446  
  1.1447  
  1.1448 -    //    KEEP_NODE_MAP(Parent, SubBidirGraphWrapper);
  1.1449 +//     //    KEEP_NODE_MAP(Parent, SubBidirGraphWrapper);
  1.1450  
  1.1451 -  };
  1.1452 +//   };
  1.1453  
  1.1454  
  1.1455    ///\brief A wrapper for composing bidirected graph from a directed one. 
     2.1 --- a/src/test/graph_wrapper_test.cc	Sun Nov 14 13:15:46 2004 +0000
     2.2 +++ b/src/test/graph_wrapper_test.cc	Mon Nov 15 12:25:39 2004 +0000
     2.3 @@ -46,15 +46,20 @@
     2.4  
     2.5  //     function_requires<StaticGraphConcept<RevGraphWrapper<Graph> > >();
     2.6  
     2.7 -//     function_requires<StaticGraphConcept<SubGraphWrapper<Graph, Graph::NodeMap<bool> , Graph::EdgeMap<bool> > > >();
     2.8 -//     function_requires<StaticGraphConcept<NodeSubGraphWrapper<Graph, Graph::NodeMap<bool> > > >();
     2.9 -//     function_requires<StaticGraphConcept<EdgeSubGraphWrapper<Graph, Graph::EdgeMap<bool> > > >();
    2.10 +    checkConcept<StaticGraph, SubGraphWrapper<StaticGraph, 
    2.11 +      StaticGraph::NodeMap<bool> , StaticGraph::EdgeMap<bool> > >();
    2.12 +    checkConcept<StaticGraph, NodeSubGraphWrapper<StaticGraph, 
    2.13 +      StaticGraph::NodeMap<bool> > >();
    2.14 +    checkConcept<StaticGraph, EdgeSubGraphWrapper<StaticGraph, 
    2.15 +      StaticGraph::EdgeMap<bool> > >();
    2.16 +    
    2.17 +    checkConcept<StaticGraph, SubBidirGraphWrapper<StaticGraph, 
    2.18 +      StaticGraph::EdgeMap<bool>, StaticGraph::EdgeMap<bool> > >();
    2.19  
    2.20 -//     function_requires<StaticGraphConcept<SubBidirGraphWrapper<Graph, Graph::EdgeMap<bool>, Graph::EdgeMap<bool> > > > ();
    2.21 +    checkConcept<StaticGraph, BidirGraph<StaticGraph> >();
    2.22  
    2.23 -//     function_requires<StaticGraphConcept<BidirGraph<Graph> > >();
    2.24 -
    2.25 -//     function_requires<StaticGraphConcept<ResGraphWrapper<Graph, int, Graph::EdgeMap<int>, Graph::EdgeMap<int> > > >();
    2.26 +    checkConcept<StaticGraph, ResGraphWrapper<StaticGraph, int, 
    2.27 +      StaticGraph::EdgeMap<int>, StaticGraph::EdgeMap<int> > >();
    2.28  
    2.29  //     function_requires<StaticGraphConcept<ErasingFirstGraphWrapper<Graph, Graph::NodeMap<Graph::Edge> > > >();
    2.30    }