src/work/marci/experiment/graph_wrapper.h
changeset 909 6a22e0dfd453
parent 281 3fefabfd00b7
child 921 818510fa3d99
equal deleted inserted replaced
0:be439392430a 1:8a204142334d
   159       T get(Edge n) const { return map->get(n); }
   159       T get(Edge n) const { return map->get(n); }
   160     };
   160     };
   161   };
   161   };
   162 
   162 
   163   template<typename GraphWrapper>
   163   template<typename GraphWrapper>
   164   class GraphWrapperSkeleton {
   164   class GraphWrapper {
   165   protected:
   165   protected:
   166     GraphWrapper gw;
   166     GraphWrapper gw;
   167   
   167   
   168   public:
   168   public:
   169     //typedef typename GraphWrapper::BaseGraph BaseGraph;
   169     //typedef typename GraphWrapper::BaseGraph BaseGraph;
   182     public:
   182     public:
   183       NodeIt() { }
   183       NodeIt() { }
   184       NodeIt(const typename GraphWrapper::NodeIt& n) : 
   184       NodeIt(const typename GraphWrapper::NodeIt& n) : 
   185 	GraphWrapper::NodeIt(n) { }
   185 	GraphWrapper::NodeIt(n) { }
   186       NodeIt(const Invalid& i) : GraphWrapper::NodeIt(i) { }
   186       NodeIt(const Invalid& i) : GraphWrapper::NodeIt(i) { }
   187       NodeIt(const GraphWrapperSkeleton<GraphWrapper>& _G) : 
   187       NodeIt(const GraphWrapper<GraphWrapper>& _G) : 
   188 	GraphWrapper::NodeIt(_G.gw) { }
   188 	GraphWrapper::NodeIt(_G.gw) { }
   189     };
   189     };
   190     typedef typename GraphWrapper::Edge Edge;
   190     typedef typename GraphWrapper::Edge Edge;
   191     //typedef typename GraphWrapper::OutEdgeIt OutEdgeIt;
   191     //typedef typename GraphWrapper::OutEdgeIt OutEdgeIt;
   192     class OutEdgeIt : public GraphWrapper::OutEdgeIt { 
   192     class OutEdgeIt : public GraphWrapper::OutEdgeIt { 
   193     public:
   193     public:
   194       OutEdgeIt() { }
   194       OutEdgeIt() { }
   195       OutEdgeIt(const typename GraphWrapper::OutEdgeIt& e) : 
   195       OutEdgeIt(const typename GraphWrapper::OutEdgeIt& e) : 
   196 	GraphWrapper::OutEdgeIt(e) { }
   196 	GraphWrapper::OutEdgeIt(e) { }
   197       OutEdgeIt(const Invalid& i) : GraphWrapper::OutEdgeIt(i) { }
   197       OutEdgeIt(const Invalid& i) : GraphWrapper::OutEdgeIt(i) { }
   198       OutEdgeIt(const GraphWrapperSkeleton<GraphWrapper>& _G, const Node& n) : 
   198       OutEdgeIt(const GraphWrapper<GraphWrapper>& _G, const Node& n) : 
   199 	GraphWrapper::OutEdgeIt(_G.gw, n) { }
   199 	GraphWrapper::OutEdgeIt(_G.gw, n) { }
   200     };
   200     };
   201     //typedef typename GraphWrapper::InEdgeIt InEdgeIt;
   201     //typedef typename GraphWrapper::InEdgeIt InEdgeIt;
   202     class InEdgeIt : public GraphWrapper::InEdgeIt { 
   202     class InEdgeIt : public GraphWrapper::InEdgeIt { 
   203     public:
   203     public:
   204       InEdgeIt() { }
   204       InEdgeIt() { }
   205       InEdgeIt(const typename GraphWrapper::InEdgeIt& e) : 
   205       InEdgeIt(const typename GraphWrapper::InEdgeIt& e) : 
   206 	GraphWrapper::InEdgeIt(e) { }
   206 	GraphWrapper::InEdgeIt(e) { }
   207       InEdgeIt(const Invalid& i) : GraphWrapper::InEdgeIt(i) { }
   207       InEdgeIt(const Invalid& i) : GraphWrapper::InEdgeIt(i) { }
   208       InEdgeIt(const GraphWrapperSkeleton<GraphWrapper>& _G, const Node& n) : 
   208       InEdgeIt(const GraphWrapper<GraphWrapper>& _G, const Node& n) : 
   209 	GraphWrapper::InEdgeIt(_G.gw, n) { }
   209 	GraphWrapper::InEdgeIt(_G.gw, n) { }
   210     };
   210     };
   211     //typedef typename GraphWrapper::SymEdgeIt SymEdgeIt;
   211     //typedef typename GraphWrapper::SymEdgeIt SymEdgeIt;
   212     //typedef typename GraphWrapper::EdgeIt EdgeIt;
   212     //typedef typename GraphWrapper::EdgeIt EdgeIt;
   213     class EdgeIt : public GraphWrapper::EdgeIt { 
   213     class EdgeIt : public GraphWrapper::EdgeIt { 
   214     public:
   214     public:
   215       EdgeIt() { }
   215       EdgeIt() { }
   216       EdgeIt(const typename GraphWrapper::EdgeIt& e) : 
   216       EdgeIt(const typename GraphWrapper::EdgeIt& e) : 
   217 	GraphWrapper::EdgeIt(e) { }
   217 	GraphWrapper::EdgeIt(e) { }
   218       EdgeIt(const Invalid& i) : GraphWrapper::EdgeIt(i) { }
   218       EdgeIt(const Invalid& i) : GraphWrapper::EdgeIt(i) { }
   219       EdgeIt(const GraphWrapperSkeleton<GraphWrapper>& _G) : 
   219       EdgeIt(const GraphWrapper<GraphWrapper>& _G) : 
   220 	GraphWrapper::EdgeIt(_G.gw) { }
   220 	GraphWrapper::EdgeIt(_G.gw) { }
   221     };
   221     };
   222 
   222 
   223 
   223 
   224     //GraphWrapperSkeleton() : gw() { }
   224     //GraphWrapper() : gw() { }
   225     GraphWrapperSkeleton(GraphWrapper _gw) : gw(_gw) { }
   225     GraphWrapper(GraphWrapper _gw) : gw(_gw) { }
   226 
   226 
   227     //void setGraph(BaseGraph& _graph) { gw.setGraph(_graph); }
   227     //void setGraph(BaseGraph& _graph) { gw.setGraph(_graph); }
   228     //BaseGraph& getGraph() const { return gw.getGraph(); }
   228     //BaseGraph& getGraph() const { return gw.getGraph(); }
   229     
   229     
   230     template<typename I> I& first(I& i) const {       
   230     template<typename I> I& first(I& i) const {       
   267   
   267   
   268     void clear() const { gw.clear(); }
   268     void clear() const { gw.clear(); }
   269     
   269     
   270     template<typename T> class NodeMap : public GraphWrapper::NodeMap<T> { 
   270     template<typename T> class NodeMap : public GraphWrapper::NodeMap<T> { 
   271     public:
   271     public:
   272       NodeMap(const GraphWrapperSkeleton<GraphWrapper>& _G) :  
   272       NodeMap(const GraphWrapper<GraphWrapper>& _G) :  
   273 	GraphWrapper::NodeMap<T>(_G.gw) { }
   273 	GraphWrapper::NodeMap<T>(_G.gw) { }
   274       NodeMap(const GraphWrapperSkeleton<GraphWrapper>& _G, T a) : 
   274       NodeMap(const GraphWrapper<GraphWrapper>& _G, T a) : 
   275 	GraphWrapper::NodeMap<T>(_G.gw, a) { }
   275 	GraphWrapper::NodeMap<T>(_G.gw, a) { }
   276     };
   276     };
   277 
   277 
   278     template<typename T> class EdgeMap : public GraphWrapper::EdgeMap<T> { 
   278     template<typename T> class EdgeMap : public GraphWrapper::EdgeMap<T> { 
   279     public:
   279     public:
   280       EdgeMap(const GraphWrapperSkeleton<GraphWrapper>& _G) :  
   280       EdgeMap(const GraphWrapper<GraphWrapper>& _G) :  
   281 	GraphWrapper::EdgeMap<T>(_G.gw) { }
   281 	GraphWrapper::EdgeMap<T>(_G.gw) { }
   282       EdgeMap(const GraphWrapperSkeleton<GraphWrapper>& _G, T a) : 
   282       EdgeMap(const GraphWrapper<GraphWrapper>& _G, T a) : 
   283 	GraphWrapper::EdgeMap<T>(_G.gw, a) { }
   283 	GraphWrapper::EdgeMap<T>(_G.gw, a) { }
   284     };
   284     };
   285   };
   285   };
   286 
   286 
   287 //   template<typename Graph>
   287 //   template<typename Graph>
   363 // 	Graph::EdgeMap<T>(_G.getGraph(), a) { }
   363 // 	Graph::EdgeMap<T>(_G.getGraph(), a) { }
   364 //     };
   364 //     };
   365 //   };
   365 //   };
   366 
   366 
   367 //   template<typename /*Graph*/GraphWrapper
   367 //   template<typename /*Graph*/GraphWrapper
   368 //   /*=typename GraphWrapperSkeleton< TrivGraphWrapper<Graph>*/ >
   368 //   /*=typename GraphWrapper< TrivGraphWrapper<Graph>*/ >
   369 //   class RevGraphWrapper : 
   369 //   class RevGraphWrapper : 
   370 //     public GraphWrapper/*GraphWrapperSkeleton< TrivGraphWrapper<Graph> >*/ {
   370 //     public GraphWrapper/*GraphWrapper< TrivGraphWrapper<Graph> >*/ {
   371 //   protected:
   371 //   protected:
   372 //     //Graph* graph;
   372 //     //Graph* graph;
   373     
   373     
   374 //   public:
   374 //   public:
   375 //     //typedef Graph BaseGraph;
   375 //     //typedef Graph BaseGraph;
   376 
   376 
   377 //     //typedef typename Graph::Node Node;    
   377 //     //typedef typename Graph::Node Node;    
   378 //     //typedef typename Graph::NodeIt NodeIt;
   378 //     //typedef typename Graph::NodeIt NodeIt;
   379   
   379   
   380 //     //typedef typename Graph::Edge Edge;
   380 //     //typedef typename Graph::Edge Edge;
   381 //     typedef typename GraphWrapper/*typename GraphWrapperSkeleton< TrivGraphWrapper<Graph> >*/::OutEdgeIt InEdgeIt;
   381 //     typedef typename GraphWrapper/*typename GraphWrapper< TrivGraphWrapper<Graph> >*/::OutEdgeIt InEdgeIt;
   382 //     typedef typename GraphWrapper/*typename GraphWrapperSkeleton< TrivGraphWrapper<Graph> >*/::InEdgeIt OutEdgeIt;
   382 //     typedef typename GraphWrapper/*typename GraphWrapper< TrivGraphWrapper<Graph> >*/::InEdgeIt OutEdgeIt;
   383 //     //typedef typename Graph::SymEdgeIt SymEdgeIt;
   383 //     //typedef typename Graph::SymEdgeIt SymEdgeIt;
   384 //     //typedef typename Graph::EdgeIt EdgeIt;
   384 //     //typedef typename Graph::EdgeIt EdgeIt;
   385 
   385 
   386 //     //RevGraphWrapper() : graph(0) { }
   386 //     //RevGraphWrapper() : graph(0) { }
   387 //     RevGraphWrapper(GraphWrapper _gw/*BaseGraph& _graph*/) : GraphWrapper/*GraphWrapperSkeleton< TrivGraphWrapper<Graph> >*/(_gw/*TrivGraphWrapper<Graph>(_graph)*/) { }
   387 //     RevGraphWrapper(GraphWrapper _gw/*BaseGraph& _graph*/) : GraphWrapper/*GraphWrapper< TrivGraphWrapper<Graph> >*/(_gw/*TrivGraphWrapper<Graph>(_graph)*/) { }
   388     
   388     
   389 //     //void setGraph(Graph& _graph) { graph = &_graph; }
   389 //     //void setGraph(Graph& _graph) { graph = &_graph; }
   390 //     //Graph& getGraph() const { return (*graph); }
   390 //     //Graph& getGraph() const { return (*graph); }
   391     
   391     
   392 //     //template<typename I> I& first(I& i) const { return graph->first(i); }
   392 //     //template<typename I> I& first(I& i) const { return graph->first(i); }
   427 //     //template<typename I> void erase(const I& i) const { graph->erase(i); }
   427 //     //template<typename I> void erase(const I& i) const { graph->erase(i); }
   428   
   428   
   429 //     //void clear() const { graph->clear(); }
   429 //     //void clear() const { graph->clear(); }
   430 
   430 
   431 //     template<typename T> class NodeMap : 
   431 //     template<typename T> class NodeMap : 
   432 //       public GraphWrapper/*Skeleton< TrivGraphWrapper<Graph> >*/::NodeMap<T> 
   432 //       public GraphWrapper/*< TrivGraphWrapper<Graph> >*/::NodeMap<T> 
   433 //     { 
   433 //     { 
   434 //     public:
   434 //     public:
   435 //       NodeMap(const RevGraphWrapper<GraphWrapper>& _gw) : 
   435 //       NodeMap(const RevGraphWrapper<GraphWrapper>& _gw) : 
   436 // 	GraphWrapper/*Skeleton< TrivGraphWrapper<Graph> >*/::NodeMap<T>(_gw) { }
   436 // 	GraphWrapper/*< TrivGraphWrapper<Graph> >*/::NodeMap<T>(_gw) { }
   437 //       NodeMap(const RevGraphWrapper<GraphWrapper>& _gw, T a) : 
   437 //       NodeMap(const RevGraphWrapper<GraphWrapper>& _gw, T a) : 
   438 // 	GraphWrapper/*Skeleton< TrivGraphWrapper<Graph> >*/::NodeMap<T>(_gw, a) { }
   438 // 	GraphWrapper/*< TrivGraphWrapper<Graph> >*/::NodeMap<T>(_gw, a) { }
   439 //     };
   439 //     };
   440     
   440     
   441 //     template<typename T> class EdgeMap : 
   441 //     template<typename T> class EdgeMap : 
   442 //       public GraphWrapper/*Skeleton< TrivGraphWrapper<Graph> >*/::EdgeMap<T> { 
   442 //       public GraphWrapper/*< TrivGraphWrapper<Graph> >*/::EdgeMap<T> { 
   443 //     public:
   443 //     public:
   444 //       EdgeMap(const RevGraphWrapper<GraphWrapper>& _gw) : 
   444 //       EdgeMap(const RevGraphWrapper<GraphWrapper>& _gw) : 
   445 // 	GraphWrapper/*Skeleton< TrivGraphWrapper<Graph> >*/::EdgeMap<T>(_gw) { }
   445 // 	GraphWrapper/*< TrivGraphWrapper<Graph> >*/::EdgeMap<T>(_gw) { }
   446 //       EdgeMap(const RevGraphWrapper<GraphWrapper>& _gw, T a) : 
   446 //       EdgeMap(const RevGraphWrapper<GraphWrapper>& _gw, T a) : 
   447 // 	GraphWrapper/*Skeleton< TrivGraphWrapper<Graph> >*/::EdgeMap<T>(_gw, a) { }
   447 // 	GraphWrapper/*< TrivGraphWrapper<Graph> >*/::EdgeMap<T>(_gw, a) { }
   448 //     };
   448 //     };
   449 //   };
   449 //   };
   450 
   450 
   451   template<typename GraphWrapper>
   451   template<typename GraphWrapper>
   452   class RevGraphWrapper : public GraphWrapperSkeleton<GraphWrapper> {
   452   class RevGraphWrapper : public GraphWrapper<GraphWrapper> {
   453   public:
   453   public:
   454     typedef typename GraphWrapperSkeleton<GraphWrapper>::Node Node;
   454     typedef typename GraphWrapper<GraphWrapper>::Node Node;
   455     typedef typename GraphWrapperSkeleton<GraphWrapper>::Edge Edge;
   455     typedef typename GraphWrapper<GraphWrapper>::Edge Edge;
   456     //FIXME 
   456     //FIXME 
   457     //If GraphWrapper::OutEdgeIt is not defined
   457     //If GraphWrapper::OutEdgeIt is not defined
   458     //and we do not want to use RevGraphWrapper::InEdgeIt,
   458     //and we do not want to use RevGraphWrapper::InEdgeIt,
   459     //this won't work, because of typedef
   459     //this won't work, because of typedef
   460     //OR
   460     //OR
   461     //graphs have to define their non-existing iterators to void
   461     //graphs have to define their non-existing iterators to void
   462     //Unfortunately all the typedefs are instantiated in templates, 
   462     //Unfortunately all the typedefs are instantiated in templates, 
   463     //unlike other stuff
   463     //unlike other stuff
   464     typedef typename GraphWrapperSkeleton<GraphWrapper>::OutEdgeIt InEdgeIt;
   464     typedef typename GraphWrapper<GraphWrapper>::OutEdgeIt InEdgeIt;
   465     typedef typename GraphWrapperSkeleton<GraphWrapper>::InEdgeIt OutEdgeIt;
   465     typedef typename GraphWrapper<GraphWrapper>::InEdgeIt OutEdgeIt;
   466 
   466 
   467     RevGraphWrapper(GraphWrapper _gw) : 
   467     RevGraphWrapper(GraphWrapper _gw) : 
   468       GraphWrapperSkeleton<GraphWrapper>(_gw) { }  
   468       GraphWrapper<GraphWrapper>(_gw) { }  
   469 
   469 
   470     Node head(const Edge& e) const 
   470     Node head(const Edge& e) const 
   471       { return GraphWrapperSkeleton<GraphWrapper>::tail(e); }
   471       { return GraphWrapper<GraphWrapper>::tail(e); }
   472     Node tail(const Edge& e) const 
   472     Node tail(const Edge& e) const 
   473       { return GraphWrapperSkeleton<GraphWrapper>::head(e); }
   473       { return GraphWrapper<GraphWrapper>::head(e); }
   474   };
   474   };
   475 
   475 
   476   //Subgraph on the same node-set and partial edge-set
   476   //Subgraph on the same node-set and partial edge-set
   477   template<typename GraphWrapper, typename EdgeFilterMap>
   477   template<typename GraphWrapper, typename EdgeFilterMap>
   478   class SubGraphWrapper : public GraphWrapperSkeleton<GraphWrapper> {
   478   class SubGraphWrapper : public GraphWrapper<GraphWrapper> {
   479   protected:
   479   protected:
   480     EdgeFilterMap* filter_map;
   480     EdgeFilterMap* filter_map;
   481   public:
   481   public:
   482     typedef typename GraphWrapperSkeleton<GraphWrapper>::Node Node;
   482     typedef typename GraphWrapper<GraphWrapper>::Node Node;
   483     typedef typename GraphWrapperSkeleton<GraphWrapper>::NodeIt NodeIt;
   483     typedef typename GraphWrapper<GraphWrapper>::NodeIt NodeIt;
   484     typedef typename GraphWrapperSkeleton<GraphWrapper>::Edge Edge;
   484     typedef typename GraphWrapper<GraphWrapper>::Edge Edge;
   485     typedef typename GraphWrapperSkeleton<GraphWrapper>::EdgeIt EdgeIt;
   485     typedef typename GraphWrapper<GraphWrapper>::EdgeIt EdgeIt;
   486     typedef typename GraphWrapperSkeleton<GraphWrapper>::InEdgeIt InEdgeIt;
   486     typedef typename GraphWrapper<GraphWrapper>::InEdgeIt InEdgeIt;
   487     typedef typename GraphWrapperSkeleton<GraphWrapper>::OutEdgeIt OutEdgeIt;
   487     typedef typename GraphWrapper<GraphWrapper>::OutEdgeIt OutEdgeIt;
   488 
   488 
   489     SubGraphWrapper(GraphWrapper _gw, EdgeFilterMap& _filter_map) : 
   489     SubGraphWrapper(GraphWrapper _gw, EdgeFilterMap& _filter_map) : 
   490       GraphWrapperSkeleton<GraphWrapper>(_gw), filter_map(&_filter_map) { }  
   490       GraphWrapper<GraphWrapper>(_gw), filter_map(&_filter_map) { }  
   491 
   491 
   492     template<typename I> I& first(I& i) const { 
   492     template<typename I> I& first(I& i) const { 
   493       gw.first(i); 
   493       gw.first(i); 
   494       while (gw.valid(i) && !filter_map->get(i)) { gw.next(i); }
   494       while (gw.valid(i) && !filter_map->get(i)) { gw.next(i); }
   495       return i;
   495       return i;
   675 //     };
   675 //     };
   676 //   };
   676 //   };
   677 
   677 
   678 
   678 
   679   template<typename GraphWrapper>
   679   template<typename GraphWrapper>
   680   class UndirGraphWrapper : public GraphWrapperSkeleton<GraphWrapper> {
   680   class UndirGraphWrapper : public GraphWrapper<GraphWrapper> {
   681   protected:
   681   protected:
   682 //    GraphWrapper gw;
   682 //    GraphWrapper gw;
   683 
   683 
   684   public:
   684   public:
   685     //typedef GraphWrapper BaseGraph;
   685     //typedef GraphWrapper BaseGraph;
   686 
   686 
   687     typedef typename GraphWrapperSkeleton<GraphWrapper>::Node Node;
   687     typedef typename GraphWrapper<GraphWrapper>::Node Node;
   688     typedef typename GraphWrapperSkeleton<GraphWrapper>::NodeIt NodeIt;
   688     typedef typename GraphWrapper<GraphWrapper>::NodeIt NodeIt;
   689 
   689 
   690     //private:
   690     //private:
   691     //FIXME ezeknek valojaban a GraphWrapper megfelelo dolgai kellene hogy 
   691     //FIXME ezeknek valojaban a GraphWrapper megfelelo dolgai kellene hogy 
   692     //legyenek, at kell irni
   692     //legyenek, at kell irni
   693     typedef typename /*GraphWrapperSkeleton<GraphWrapper>*/
   693     typedef typename /*GraphWrapper<GraphWrapper>*/
   694     GraphWrapper::Edge GraphEdge;
   694     GraphWrapper::Edge GraphEdge;
   695     typedef typename /*GraphWrapperSkeleton<GraphWrapper>*/ 
   695     typedef typename /*GraphWrapper<GraphWrapper>*/ 
   696     GraphWrapper::OutEdgeIt GraphOutEdgeIt;
   696     GraphWrapper::OutEdgeIt GraphOutEdgeIt;
   697     typedef typename /*GraphWrapperSkeleton<GraphWrapper>*/ 
   697     typedef typename /*GraphWrapper<GraphWrapper>*/ 
   698     GraphWrapper::InEdgeIt GraphInEdgeIt;
   698     GraphWrapper::InEdgeIt GraphInEdgeIt;
   699     //public:
   699     //public:
   700 
   700 
   701     //UndirGraphWrapper() : graph(0) { }
   701     //UndirGraphWrapper() : graph(0) { }
   702     UndirGraphWrapper(GraphWrapper _gw) : 
   702     UndirGraphWrapper(GraphWrapper _gw) : 
   703       GraphWrapperSkeleton<GraphWrapper>(_gw) { }  
   703       GraphWrapper<GraphWrapper>(_gw) { }  
   704 
   704 
   705     //UndirGraphWrapper(GraphWrapper _gw) : gw(_gw) { }
   705     //UndirGraphWrapper(GraphWrapper _gw) : gw(_gw) { }
   706 
   706 
   707     //void setGraph(Graph& _graph) { graph = &_graph; }
   707     //void setGraph(Graph& _graph) { graph = &_graph; }
   708     //Graph& getGraph() const { return (*graph); }
   708     //Graph& getGraph() const { return (*graph); }
   862 //       NodeMap(const UndirGraphWrapper<GraphWrapper>& _G, T a) : 
   862 //       NodeMap(const UndirGraphWrapper<GraphWrapper>& _G, T a) : 
   863 // 	GraphWrapper::NodeMap<T>(_G.gw, a) { }
   863 // 	GraphWrapper::NodeMap<T>(_G.gw, a) { }
   864 //     };
   864 //     };
   865 
   865 
   866 //     template<typename T> class EdgeMap : 
   866 //     template<typename T> class EdgeMap : 
   867 //       public GraphWrapperSkeleton<GraphWrapper>::EdgeMap<T> { 
   867 //       public GraphWrapper<GraphWrapper>::EdgeMap<T> { 
   868 //     public:
   868 //     public:
   869 //       EdgeMap(const UndirGraphWrapper<GraphWrapper>& _G) : 
   869 //       EdgeMap(const UndirGraphWrapper<GraphWrapper>& _G) : 
   870 // 	GraphWrapperSkeleton<GraphWrapper>::EdgeMap<T>(_G.gw) { }
   870 // 	GraphWrapper<GraphWrapper>::EdgeMap<T>(_G.gw) { }
   871 //       EdgeMap(const UndirGraphWrapper<GraphWrapper>& _G, T a) : 
   871 //       EdgeMap(const UndirGraphWrapper<GraphWrapper>& _G, T a) : 
   872 // 	GraphWrapper::EdgeMap<T>(_G.gw, a) { }
   872 // 	GraphWrapper::EdgeMap<T>(_G.gw, a) { }
   873 //     };
   873 //     };
   874    };
   874    };
   875 
   875 
   945 //     SymGraphWrapper(Graph& _graph) : graph(&_graph) { }
   945 //     SymGraphWrapper(Graph& _graph) : graph(&_graph) { }
   946 //   };
   946 //   };
   947 
   947 
   948 
   948 
   949   template<typename GraphWrapper, typename Number, typename FlowMap, typename CapacityMap>
   949   template<typename GraphWrapper, typename Number, typename FlowMap, typename CapacityMap>
   950   class ResGraphWrapper : public GraphWrapperSkeleton<GraphWrapper>{
   950   class ResGraphWrapper : public GraphWrapper<GraphWrapper>{
   951   public:
   951   public:
   952     //typedef Graph BaseGraph;
   952     //typedef Graph BaseGraph;
   953     //typedef TrivGraphWrapper<const Graph> GraphWrapper;
   953     //typedef TrivGraphWrapper<const Graph> GraphWrapper;
   954     typedef typename GraphWrapperSkeleton<GraphWrapper>::Node Node;
   954     typedef typename GraphWrapper<GraphWrapper>::Node Node;
   955     typedef typename GraphWrapperSkeleton<GraphWrapper>::NodeIt NodeIt;
   955     typedef typename GraphWrapper<GraphWrapper>::NodeIt NodeIt;
   956   private:
   956   private:
   957     typedef typename /*GraphWrapperSkeleton<GraphWrapper>*/
   957     typedef typename /*GraphWrapper<GraphWrapper>*/
   958     GraphWrapper::OutEdgeIt OldOutEdgeIt;
   958     GraphWrapper::OutEdgeIt OldOutEdgeIt;
   959     typedef typename /*GraphWrapperSkeleton<GraphWrapper>*/
   959     typedef typename /*GraphWrapper<GraphWrapper>*/
   960     GraphWrapper::InEdgeIt OldInEdgeIt;
   960     GraphWrapper::InEdgeIt OldInEdgeIt;
   961   protected:
   961   protected:
   962     //const Graph* graph;
   962     //const Graph* graph;
   963     //GraphWrapper gw;
   963     //GraphWrapper gw;
   964     FlowMap* flow;
   964     FlowMap* flow;
   965     const CapacityMap* capacity;
   965     const CapacityMap* capacity;
   966   public:
   966   public:
   967 
   967 
   968     ResGraphWrapper(const GraphWrapper& _gw, FlowMap& _flow, 
   968     ResGraphWrapper(const GraphWrapper& _gw, FlowMap& _flow, 
   969 		    const CapacityMap& _capacity) : 
   969 		    const CapacityMap& _capacity) : 
   970       GraphWrapperSkeleton<GraphWrapper>(_gw), 
   970       GraphWrapper<GraphWrapper>(_gw), 
   971       flow(&_flow), capacity(&_capacity) { }
   971       flow(&_flow), capacity(&_capacity) { }
   972 
   972 
   973     //void setGraph(const Graph& _graph) { graph = &_graph; }
   973     //void setGraph(const Graph& _graph) { graph = &_graph; }
   974     //const Graph& getGraph() const { return (*graph); }
   974     //const Graph& getGraph() const { return (*graph); }
   975 
   975 
  1262     };
  1262     };
  1263   };
  1263   };
  1264 
  1264 
  1265   //Subgraph on the same node-set and partial edge-set
  1265   //Subgraph on the same node-set and partial edge-set
  1266   template<typename GraphWrapper, typename FirstOutEdgesMap>
  1266   template<typename GraphWrapper, typename FirstOutEdgesMap>
  1267   class ErasingFirstGraphWrapper : public GraphWrapperSkeleton<GraphWrapper> {
  1267   class ErasingFirstGraphWrapper : public GraphWrapper<GraphWrapper> {
  1268   protected:
  1268   protected:
  1269     FirstOutEdgesMap* first_out_edges;
  1269     FirstOutEdgesMap* first_out_edges;
  1270   public:
  1270   public:
  1271     typedef typename GraphWrapperSkeleton<GraphWrapper>::Node Node;
  1271     typedef typename GraphWrapper<GraphWrapper>::Node Node;
  1272     typedef typename GraphWrapperSkeleton<GraphWrapper>::NodeIt NodeIt;
  1272     typedef typename GraphWrapper<GraphWrapper>::NodeIt NodeIt;
  1273     typedef typename GraphWrapperSkeleton<GraphWrapper>::Edge Edge;
  1273     typedef typename GraphWrapper<GraphWrapper>::Edge Edge;
  1274     typedef typename GraphWrapperSkeleton<GraphWrapper>::EdgeIt EdgeIt;
  1274     typedef typename GraphWrapper<GraphWrapper>::EdgeIt EdgeIt;
  1275     typedef typename GraphWrapperSkeleton<GraphWrapper>::InEdgeIt InEdgeIt;
  1275     typedef typename GraphWrapper<GraphWrapper>::InEdgeIt InEdgeIt;
  1276     typedef typename GraphWrapperSkeleton<GraphWrapper>::OutEdgeIt OutEdgeIt;
  1276     typedef typename GraphWrapper<GraphWrapper>::OutEdgeIt OutEdgeIt;
  1277 
  1277 
  1278     ErasingFirstGraphWrapper(GraphWrapper _gw, FirstOutEdgesMap& _first_out_edges) : 
  1278     ErasingFirstGraphWrapper(GraphWrapper _gw, FirstOutEdgesMap& _first_out_edges) : 
  1279       GraphWrapperSkeleton<GraphWrapper>(_gw), first_out_edges(&_first_out_edges) { }  
  1279       GraphWrapper<GraphWrapper>(_gw), first_out_edges(&_first_out_edges) { }  
  1280 
  1280 
  1281     template<typename I> I& first(I& i) const { 
  1281     template<typename I> I& first(I& i) const { 
  1282       gw.first(i); 
  1282       gw.first(i); 
  1283       //while (gw.valid(i) && !filter_map->get(i)) { gw.next(i); }
  1283       //while (gw.valid(i) && !filter_map->get(i)) { gw.next(i); }
  1284       return i;
  1284       return i;