src/work/marci/graph_wrapper.h
changeset 102 294cb99af985
child 105 a3c73e9b9b2e
equal deleted inserted replaced
-1:000000000000 0:514a63e37f08
       
     1 // -*-mode: c++; -*-
       
     2 #ifndef GRAPH_WRAPPER_H
       
     3 #define GRAPH_WRAPPER_H
       
     4 
       
     5 namespace marci {
       
     6 
       
     7   template<typename Graph>
       
     8   class TrivGraphWrapper {
       
     9     Graph* graph;
       
    10   
       
    11   public:
       
    12     typedef Graph BaseGraph;
       
    13 
       
    14     typedef typename Graph::NodeIt NodeIt;
       
    15     typedef typename Graph::EdgeIt EdgeIt;
       
    16   
       
    17     typedef typename Graph::EachNodeIt EachNodeIt;
       
    18 
       
    19     typedef typename Graph::OutEdgeIt OutEdgeIt;
       
    20     typedef typename Graph::InEdgeIt InEdgeIt;
       
    21     typedef typename Graph::SymEdgeIt SymEdgeIt;
       
    22     typedef typename Graph::EachEdgeIt EachEdgeIt;
       
    23 
       
    24     int nodeNum() const { return graph->nodeNum(); }
       
    25     int edgeNum() const { return graph->edgeNum(); }
       
    26     
       
    27     template<typename I> I& getFirst(I& i) const { return graph->getFirst(i); }
       
    28     template<typename I, typename P> I& getFirst(I& i, const P& p) const { 
       
    29       return graph->getFirst(i, p); }
       
    30     //template<typename I> I next(const I i); { return graph->goNext(i); }
       
    31     //template<typename I> I &goNext(I &i); { return graph->goNext(i); }
       
    32 
       
    33     template< typename It > It first() const { 
       
    34       It e; getFirst(e); return e; }
       
    35 
       
    36     template< typename It > It first(NodeIt v) const { 
       
    37       It e; getFirst(e, v); return e; }
       
    38 
       
    39     NodeIt head(const EdgeIt& e) const { return graph->head(e); }
       
    40     NodeIt tail(const EdgeIt& e) const { return graph->tail(e); }
       
    41   
       
    42     template<typename I> NodeIt aNode(const I& e) const { 
       
    43       return graph->aNode(e); }
       
    44     template<typename I> NodeIt bNode(const I& e) const { 
       
    45       return graph->bNode(e); }
       
    46   
       
    47     //template<typename I> bool valid(const I& i) 
       
    48     //{ return graph->valid(i); }
       
    49   
       
    50     //template<typename I> void setInvalid(const I &i);
       
    51     //{ return graph->setInvalid(i); }
       
    52   
       
    53     NodeIt addNode() const { return graph->addNode(); }
       
    54     EdgeIt addEdge(const NodeIt& tail, const NodeIt& head) const { 
       
    55       return graph->addEdge(tail, head); }
       
    56   
       
    57     template<typename I> void erase(const I& i) const { graph->erase(i); }
       
    58   
       
    59     void clear() const { graph->clear(); }
       
    60   
       
    61     template<typename T> class NodeMap : public Graph::NodeMap<T> { 
       
    62     public:
       
    63       NodeMap(const Graph& _G) : Graph::NodeMap<T>(_G) { }
       
    64       NodeMap(const Graph& _G, T a) : Graph::NodeMap<T>(_G, a) { }
       
    65     };
       
    66     template<typename T> class EdgeMap : public Graph::EdgeMap<T> { };
       
    67   
       
    68     void setGraph(Graph& _graph) { graph = &_graph; }
       
    69     Graph& getGraph() { return (*graph); }
       
    70   
       
    71     //TrivGraphWrapper() : graph(0) { }
       
    72     TrivGraphWrapper(Graph& _graph) : graph(&_graph) { }
       
    73   };
       
    74 
       
    75   template<typename Graph>
       
    76   class ConstTrivGraphWrapper {
       
    77     const Graph* graph;
       
    78   
       
    79   public:
       
    80     typedef Graph BaseGraph;
       
    81 
       
    82     typedef typename Graph::NodeIt NodeIt;
       
    83     typedef typename Graph::EdgeIt EdgeIt;
       
    84   
       
    85     typedef typename Graph::EachNodeIt EachNodeIt;
       
    86 
       
    87     typedef typename Graph::OutEdgeIt OutEdgeIt;
       
    88     typedef typename Graph::InEdgeIt InEdgeIt;
       
    89     typedef typename Graph::SymEdgeIt SymEdgeIt;
       
    90     typedef typename Graph::EachEdgeIt EachEdgeIt;
       
    91 
       
    92     int nodeNum() const { return graph->nodeNum(); }
       
    93     int edgeNum() const { return graph->edgeNum(); }
       
    94     
       
    95     template<typename I> I& getFirst(I& i) const { return graph->getFirst(i); }
       
    96     template<typename I, typename P> I& getFirst(I& i, const P& p) const { 
       
    97       return graph->getFirst(i, p); }
       
    98     //template<typename I> I next(const I i); { return graph->goNext(i); }
       
    99     //template<typename I> I &goNext(I &i); { return graph->goNext(i); }
       
   100 
       
   101     template< typename It > It first() const { 
       
   102       It e; getFirst(e); return e; }
       
   103 
       
   104     template< typename It > It first(NodeIt v) const { 
       
   105       It e; getFirst(e, v); return e; }
       
   106 
       
   107     NodeIt head(const EdgeIt& e) const { return graph->head(e); }
       
   108     NodeIt tail(const EdgeIt& e) const { return graph->tail(e); }
       
   109   
       
   110     template<typename I> NodeIt aNode(const I& e) const { 
       
   111       return graph->aNode(e); }
       
   112     template<typename I> NodeIt bNode(const I& e) const { 
       
   113       return graph->bNode(e); }
       
   114   
       
   115     //template<typename I> bool valid(const I& i) 
       
   116     //{ return graph->valid(i); }
       
   117   
       
   118     //template<typename I> void setInvalid(const I &i);
       
   119     //{ return graph->setInvalid(i); }
       
   120   
       
   121     NodeIt addNode() const { return graph->addNode(); }
       
   122     EdgeIt addEdge(const NodeIt& tail, const NodeIt& head) const { 
       
   123       return graph->addEdge(tail, head); }
       
   124   
       
   125     template<typename I> void erase(const I& i) const { graph->erase(i); }
       
   126   
       
   127     void clear() const { graph->clear(); }
       
   128   
       
   129     template<typename T> class NodeMap : public Graph::NodeMap<T> { 
       
   130     public:
       
   131       NodeMap(const Graph& _G) : Graph::NodeMap<T>(_G) { }
       
   132       NodeMap(const Graph& _G, T a) : Graph::NodeMap<T>(_G, a) { }
       
   133     };
       
   134     template<typename T> class EdgeMap : public Graph::EdgeMap<T> { };
       
   135   
       
   136     void setGraph(const Graph& _graph) { graph = &_graph; }
       
   137     const Graph& getGraph() { return (*graph); }
       
   138   
       
   139     //ConstTrivGraphWrapper() : graph(0) { }
       
   140     ConstTrivGraphWrapper(const Graph& _graph) : graph(&_graph) { }
       
   141   };
       
   142 
       
   143 
       
   144   template<typename Graph>
       
   145   class RevGraphWrapper
       
   146   {
       
   147     Graph* graph;
       
   148   
       
   149   public:
       
   150     typedef Graph BaseGraph;
       
   151 
       
   152     typedef typename Graph::NodeIt NodeIt;
       
   153     typedef typename Graph::EdgeIt EdgeIt;
       
   154   
       
   155     typedef typename Graph::EachNodeIt EachNodeIt;
       
   156   
       
   157     typedef typename Graph::OutEdgeIt InEdgeIt;
       
   158     typedef typename Graph::InEdgeIt OutEdgeIt;
       
   159     typedef typename Graph::SymEdgeIt SymEdgeIt;
       
   160     typedef typename Graph::EachEdgeIt EachEdgeIt;
       
   161 
       
   162     int nodeNum() const { return graph->nodeNum(); }
       
   163     int edgeNum() const { return graph->edgeNum(); }
       
   164     
       
   165     template<typename I> I& getFirst(I& i) const { return graph->getFirst(i); }
       
   166     template<typename I, typename P> I& getFirst(I& i, const P& p) const { 
       
   167       return graph->getFirst(i, p); }
       
   168     //template<typename I> I next(const I i); { return graph->goNext(i); }
       
   169     //template<typename I> I &goNext(I &i); { return graph->goNext(i); }
       
   170 
       
   171     template< typename It > It first() const { 
       
   172       It e; getFirst(e); return e; }
       
   173 
       
   174     template< typename It > It first(NodeIt v) const { 
       
   175       It e; getFirst(e, v); return e; }
       
   176 
       
   177     NodeIt head(const EdgeIt& e) const { return graph->tail(e); }
       
   178     NodeIt tail(const EdgeIt& e) const { return graph->head(e); }
       
   179   
       
   180     template<typename I> NodeIt aNode(const I& e) const { 
       
   181       return graph->aNode(e); }
       
   182     template<typename I> NodeIt bNode(const I& e) const { 
       
   183       return graph->bNode(e); }
       
   184   
       
   185     //template<typename I> bool valid(const I i);
       
   186     //{ return graph->valid(i); }
       
   187   
       
   188     //template<typename I> void setInvalid(const I &i);
       
   189     //{ return graph->setInvalid(i); }
       
   190   
       
   191     NodeIt addNode() { return graph->addNode(); }
       
   192     EdgeIt addEdge(const NodeIt& tail, const NodeIt& head) { 
       
   193       return graph->addEdge(tail, head); }
       
   194   
       
   195     template<typename I> void erase(const I& i) { graph->erase(i); }
       
   196   
       
   197     void clear() { graph->clear(); }
       
   198   
       
   199     template<typename T> class NodeMap : public Graph::NodeMap<T> { };
       
   200     template<typename T> class EdgeMap : public Graph::EdgeMap<T> { };
       
   201   
       
   202     void setGraph(Graph& _graph) { graph = &_graph; }
       
   203     Graph& getGraph() { return (*graph); }
       
   204 
       
   205     //RevGraphWrapper() : graph(0) { }
       
   206     RevGraphWrapper(Graph& _graph) : graph(&_graph) { }
       
   207   };
       
   208 
       
   209   template<typename Graph>
       
   210   class SymGraphWrapper
       
   211   {
       
   212     Graph* graph;
       
   213   
       
   214   public:
       
   215     typedef Graph BaseGraph;
       
   216 
       
   217     typedef typename Graph::NodeIt NodeIt;
       
   218     typedef typename Graph::EdgeIt EdgeIt;
       
   219   
       
   220     typedef typename Graph::EachNodeIt EachNodeIt;
       
   221     
       
   222     //FIXME tag-ekkel megcsinalni, hogy abbol csinaljon
       
   223     //iranyitatlant, ami van
       
   224     //mert csak 1 dolgot lehet be typedef-elni
       
   225     typedef typename Graph::OutEdgeIt SymEdgeIt;
       
   226     //typedef typename Graph::InEdgeIt SymEdgeIt;
       
   227     //typedef typename Graph::SymEdgeIt SymEdgeIt;
       
   228     typedef typename Graph::EachEdgeIt EachEdgeIt;
       
   229 
       
   230     int nodeNum() const { return graph->nodeNum(); }
       
   231     int edgeNum() const { return graph->edgeNum(); }
       
   232     
       
   233     template<typename I> I& getFirst(I& i) const { return graph->getFirst(i); }
       
   234     template<typename I, typename P> I& getFirst(I& i, const P& p) const { 
       
   235       return graph->getFirst(i, p); }
       
   236     //template<typename I> I next(const I i); { return graph->goNext(i); }
       
   237     //template<typename I> I &goNext(I &i); { return graph->goNext(i); }
       
   238 
       
   239     template< typename It > It first() const { 
       
   240       It e; getFirst(e); return e; }
       
   241 
       
   242     template< typename It > It first(NodeIt v) const { 
       
   243       It e; getFirst(e, v); return e; }
       
   244 
       
   245     NodeIt head(const EdgeIt& e) const { return graph->head(e); }
       
   246     NodeIt tail(const EdgeIt& e) const { return graph->tail(e); }
       
   247   
       
   248     template<typename I> NodeIt aNode(const I& e) const { 
       
   249       return graph->aNode(e); }
       
   250     template<typename I> NodeIt bNode(const I& e) const { 
       
   251       return graph->bNode(e); }
       
   252   
       
   253     //template<typename I> bool valid(const I i);
       
   254     //{ return graph->valid(i); }
       
   255   
       
   256     //template<typename I> void setInvalid(const I &i);
       
   257     //{ return graph->setInvalid(i); }
       
   258   
       
   259     NodeIt addNode() { return graph->addNode(); }
       
   260     EdgeIt addEdge(const NodeIt& tail, const NodeIt& head) { 
       
   261       return graph->addEdge(tail, head); }
       
   262   
       
   263     template<typename I> void erase(const I& i) { graph->erase(i); }
       
   264   
       
   265     void clear() { graph->clear(); }
       
   266   
       
   267     template<typename T> class NodeMap : public Graph::NodeMap<T> { };
       
   268     template<typename T> class EdgeMap : public Graph::EdgeMap<T> { };
       
   269   
       
   270     void setGraph(Graph& _graph) { graph = &_graph; }
       
   271     Graph& getGraph() { return (*graph); }
       
   272 
       
   273     //SymGraphWrapper() : graph(0) { }
       
   274     SymGraphWrapper(Graph& _graph) : graph(&_graph) { }
       
   275   };
       
   276 
       
   277 
       
   278 // FIXME: comparison should be made better!!!
       
   279   template<typename Graph, typename T, typename LowerMap, typename FlowMap, typename UpperMap>
       
   280   class ResGraphWrapper
       
   281   {
       
   282     Graph* graph;
       
   283   
       
   284   public:
       
   285     typedef Graph BaseGraph;
       
   286 
       
   287     typedef typename Graph::NodeIt NodeIt;
       
   288     typedef typename Graph::EdgeIt EdgeIt;
       
   289   
       
   290     typedef typename Graph::EachNodeIt EachNodeIt;
       
   291    
       
   292     class OutEdgeIt {
       
   293     public:
       
   294       //Graph::NodeIt n;
       
   295       bool out_or_in;
       
   296       typename Graph::OutEdgeIt o;
       
   297       typename Graph::InEdgeIt i;   
       
   298     };
       
   299     class InEdgeIt {
       
   300     public:
       
   301       //Graph::NodeIt n;
       
   302       bool out_or_in;
       
   303       typename Graph::OutEdgeIt o;
       
   304       typename Graph::InEdgeIt i;   
       
   305     };
       
   306     typedef typename Graph::SymEdgeIt SymEdgeIt;
       
   307     typedef typename Graph::EachEdgeIt EachEdgeIt;
       
   308 
       
   309     int nodeNum() const { return graph->nodeNum(); }
       
   310     int edgeNum() const { return graph->edgeNum(); }
       
   311 
       
   312     NodeIt& getFirst(NodeIt& n) const { return graph->getFirst(n); }
       
   313 
       
   314     // EachEdge and SymEdge  is missing!!!!
       
   315     // EdgeIt <-> In/OutEdgeIt conversion is missing!!!!
       
   316 
       
   317     //FIXME
       
   318     OutEdgeIt& getFirst(OutEdgeIt& e, const NodeIt& n) const 
       
   319       {
       
   320 	e.n=n;
       
   321 	graph->getFirst(e.o,n);
       
   322 	while(graph->valid(e.o) && fmap.get(e.o)>=himap.get(e.o))
       
   323 	  graph->goNext(e.o);
       
   324 	if(!graph->valid(e.o)) {
       
   325 	  graph->getFirst(e.i,n);
       
   326 	  while(graph->valid(e.i) && fmap.get(e.i)<=lomap.get(e.i))
       
   327 	    graph->goNext(e.i);
       
   328 	}
       
   329 	return e;
       
   330       }
       
   331 /*
       
   332   OutEdgeIt &goNext(OutEdgeIt &e)
       
   333   {
       
   334   if(graph->valid(e.o)) {
       
   335   while(graph->valid(e.o) && fmap.get(e.o)>=himap.get(e.o))
       
   336   graph->goNext(e.o);
       
   337   if(graph->valid(e.o)) return e;
       
   338   else graph->getFirst(e.i,e.n);
       
   339   }
       
   340   else {
       
   341   while(graph->valid(e.i) && fmap.get(e.i)<=lomap.get(e.i))
       
   342   graph->goNext(e.i);
       
   343   return e;
       
   344   }
       
   345   }
       
   346   OutEdgeIt Next(const OutEdgeIt &e) {OutEdgeIt t(e); return goNext(t);}
       
   347 */
       
   348     //bool valid(const OutEdgeIt e) { return graph->valid(e.o)||graph->valid(e.i);}
       
   349 
       
   350     //FIXME
       
   351     InEdgeIt& getFirst(InEdgeIt& e, const NodeIt& n) const 
       
   352       {
       
   353 	e.n=n;
       
   354 	graph->getFirst(e.i,n);
       
   355 	while(graph->valid(e.i) && fmap.get(e.i)>=himap.get(e.i))
       
   356 	  graph->goNext(e.i);
       
   357 	if(!graph->valid(e.i)) {
       
   358 	  graph->getFirst(e.o,n);
       
   359 	  while(graph->valid(e.o) && fmap.get(e.o)<=lomap.get(e.o))
       
   360 	    graph->goNext(e.o);
       
   361 	}
       
   362 	return e;
       
   363       }
       
   364 /*
       
   365   InEdgeIt &goNext(InEdgeIt &e)
       
   366   {
       
   367   if(graph->valid(e.i)) {
       
   368   while(graph->valid(e.i) && fmap.get(e.i)>=himap.get(e.i))
       
   369   graph->goNext(e.i);
       
   370   if(graph->valid(e.i)) return e;
       
   371   else graph->getFirst(e.o,e.n);
       
   372   }
       
   373   else {
       
   374   while(graph->valid(e.o) && fmap.get(e.o)<=lomap.get(e.o))
       
   375   graph->goNext(e.o);
       
   376   return e;
       
   377   }
       
   378   }
       
   379   InEdgeIt Next(const InEdgeIt &e) {InEdgeIt t(e); return goNext(t);}
       
   380 */
       
   381     //bool valid(const InEdgeIt e) { return graph->valid(e.i)||graph->valid(e.o);}
       
   382 
       
   383     //template<typename I> I &goNext(I &i); { return graph->goNext(i); }
       
   384     //template<typename I> I next(const I i); { return graph->goNext(i); }
       
   385 
       
   386     template< typename It > It first() const { 
       
   387       It e; getFirst(e); return e; }
       
   388 
       
   389     template< typename It > It first(NodeIt v) const { 
       
   390       It e; getFirst(e, v); return e; }
       
   391 
       
   392     NodeIt head(const EdgeIt& e) const { return graph->head(e); }
       
   393     NodeIt tail(const EdgeIt& e) const { return graph->tail(e); }
       
   394   
       
   395     template<typename I> NodeIt aNode(const I& e) const { 
       
   396       return graph->aNode(e); }
       
   397     template<typename I> NodeIt bNode(const I& e) const { 
       
   398       return graph->bNode(e); }
       
   399   
       
   400     //template<typename I> bool valid(const I i);
       
   401     //{ return graph->valid(i); }
       
   402   
       
   403     //template<typename I> void setInvalid(const I &i);
       
   404     //{ return graph->setInvalid(i); }
       
   405   
       
   406     NodeIt addNode() { return graph->addNode(); }
       
   407     EdgeIt addEdge(const NodeIt& tail, const NodeIt& head) { 
       
   408       return graph->addEdge(tail, head); }
       
   409   
       
   410     template<typename I> void erase(const I& i) { graph->erase(i); }
       
   411   
       
   412     void clear() { graph->clear(); }
       
   413   
       
   414     template<typename S> class NodeMap : public Graph::NodeMap<S> { };
       
   415     template<typename S> class EdgeMap : public Graph::EdgeMap<S> { };
       
   416   
       
   417     void setGraph(Graph& _graph) { graph = &_graph; }
       
   418     Graph& getGraph() { return (*graph); }
       
   419 
       
   420     //ResGraphWrapper() : graph(0) { }
       
   421     ResGraphWrapper(Graph& _graph) : graph(&_graph) { }
       
   422   };
       
   423 
       
   424 
       
   425 // FIXME: comparison should be made better!!!
       
   426   template<typename Graph, typename T, typename LowerMap, typename FlowMap, typename UpperMap>
       
   427   class ConstResGraphWrapper
       
   428   {
       
   429     const Graph* graph;
       
   430     const LowerMap* low;
       
   431     FlowMap* flow;
       
   432     const UpperMap* up;
       
   433   public:
       
   434     typedef Graph BaseGraph;
       
   435 
       
   436     typedef typename Graph::NodeIt NodeIt;
       
   437     typedef typename Graph::EdgeIt EdgeIt;
       
   438   
       
   439     typedef typename Graph::EachNodeIt EachNodeIt;
       
   440    
       
   441     class OutEdgeIt {
       
   442     public:
       
   443       //Graph::NodeIt n;
       
   444       bool out_or_in;
       
   445       typename Graph::SymEdgeIt sym;
       
   446     };
       
   447     class InEdgeIt {
       
   448     public:
       
   449       //Graph::NodeIt n;
       
   450       bool out_or_in;
       
   451       typename Graph::OutEdgeIt sym;
       
   452     };
       
   453     //typedef typename Graph::SymEdgeIt SymEdgeIt;
       
   454     //typedef typename Graph::EachEdgeIt EachEdgeIt;
       
   455 
       
   456     int nodeNum() const { return graph->nodeNum(); }
       
   457     //int edgeNum() const { return graph->edgeNum(); }
       
   458 
       
   459     NodeIt& getFirst(NodeIt& n) const { return graph->getFirst(n); }
       
   460 
       
   461     // EachEdge and SymEdge  is missing!!!!
       
   462     // EdgeIt <-> In/OutEdgeIt conversion is missing!!!!
       
   463 
       
   464     
       
   465     //FIXME
       
   466     OutEdgeIt& getFirst(OutEdgeIt& e, const NodeIt& n) const 
       
   467       {
       
   468 	e.n=n;
       
   469 	graph->getFirst(e.o,n);
       
   470 	while(graph->valid(e.o) && fmap.get(e.o)>=himap.get(e.o))
       
   471 	  graph->goNext(e.o);
       
   472 	if(!graph->valid(e.o)) {
       
   473 	  graph->getFirst(e.i,n);
       
   474 	  while(graph->valid(e.i) && fmap.get(e.i)<=lomap.get(e.i))
       
   475 	    graph->goNext(e.i);
       
   476 	}
       
   477 	return e;
       
   478       }
       
   479 /*
       
   480   OutEdgeIt &goNext(OutEdgeIt &e)
       
   481   {
       
   482   if(graph->valid(e.o)) {
       
   483   while(graph->valid(e.o) && fmap.get(e.o)>=himap.get(e.o))
       
   484   graph->goNext(e.o);
       
   485   if(graph->valid(e.o)) return e;
       
   486   else graph->getFirst(e.i,e.n);
       
   487   }
       
   488   else {
       
   489   while(graph->valid(e.i) && fmap.get(e.i)<=lomap.get(e.i))
       
   490   graph->goNext(e.i);
       
   491   return e;
       
   492   }
       
   493   }
       
   494   OutEdgeIt Next(const OutEdgeIt &e) {OutEdgeIt t(e); return goNext(t);}
       
   495 */
       
   496     //bool valid(const OutEdgeIt e) { return graph->valid(e.o)||graph->valid(e.i);}
       
   497 
       
   498     //FIXME
       
   499     InEdgeIt& getFirst(InEdgeIt& e, const NodeIt& n) const 
       
   500       {
       
   501 	e.n=n;
       
   502 	graph->getFirst(e.i,n);
       
   503 	while(graph->valid(e.i) && fmap.get(e.i)>=himap.get(e.i))
       
   504 	  graph->goNext(e.i);
       
   505 	if(!graph->valid(e.i)) {
       
   506 	  graph->getFirst(e.o,n);
       
   507 	  while(graph->valid(e.o) && fmap.get(e.o)<=lomap.get(e.o))
       
   508 	    graph->goNext(e.o);
       
   509 	}
       
   510 	return e;
       
   511       }
       
   512 /*
       
   513   InEdgeIt &goNext(InEdgeIt &e)
       
   514   {
       
   515   if(graph->valid(e.i)) {
       
   516   while(graph->valid(e.i) && fmap.get(e.i)>=himap.get(e.i))
       
   517   graph->goNext(e.i);
       
   518   if(graph->valid(e.i)) return e;
       
   519   else graph->getFirst(e.o,e.n);
       
   520   }
       
   521   else {
       
   522   while(graph->valid(e.o) && fmap.get(e.o)<=lomap.get(e.o))
       
   523   graph->goNext(e.o);
       
   524   return e;
       
   525   }
       
   526   }
       
   527   InEdgeIt Next(const InEdgeIt &e) {InEdgeIt t(e); return goNext(t);}
       
   528 */
       
   529     //bool valid(const InEdgeIt e) { return graph->valid(e.i)||graph->valid(e.o);}
       
   530 
       
   531     //template<typename I> I &goNext(I &i); { return graph->goNext(i); }
       
   532     //template<typename I> I next(const I i); { return graph->goNext(i); }
       
   533 
       
   534     template< typename It > It first() const { 
       
   535       It e; getFirst(e); return e; }
       
   536 
       
   537     template< typename It > It first(NodeIt v) const { 
       
   538       It e; getFirst(e, v); return e; }
       
   539 
       
   540     NodeIt head(const EdgeIt& e) const { return graph->head(e); }
       
   541     NodeIt tail(const EdgeIt& e) const { return graph->tail(e); }
       
   542   
       
   543     template<typename I> NodeIt aNode(const I& e) const { 
       
   544       return graph->aNode(e); }
       
   545     template<typename I> NodeIt bNode(const I& e) const { 
       
   546       return graph->bNode(e); }
       
   547   
       
   548     //template<typename I> bool valid(const I i);
       
   549     //{ return graph->valid(i); }
       
   550   
       
   551     //template<typename I> void setInvalid(const I &i);
       
   552     //{ return graph->setInvalid(i); }
       
   553   
       
   554     NodeIt addNode() { return graph->addNode(); }
       
   555     EdgeIt addEdge(const NodeIt& tail, const NodeIt& head) { 
       
   556       return graph->addEdge(tail, head); }
       
   557   
       
   558     template<typename I> void erase(const I& i) { graph->erase(i); }
       
   559   
       
   560     void clear() { graph->clear(); }
       
   561   
       
   562     template<typename S> class NodeMap : public Graph::NodeMap<S> { };
       
   563     template<typename S> class EdgeMap : public Graph::EdgeMap<S> { };
       
   564   
       
   565     void setGraph(const Graph& _graph) { graph = &_graph; }
       
   566     const Graph& getGraph() { return (*graph); }
       
   567 
       
   568     //ConstResGraphWrapper() : graph(0) { }
       
   569     ConstResGraphWrapper(const Graph& _graph) : graph(&_graph) { }
       
   570   };
       
   571 
       
   572 
       
   573 
       
   574 
       
   575 
       
   576 } //namespace marci
       
   577 
       
   578 #endif //GRAPH_WRAPPER_H
       
   579 
       
   580 
       
   581 //   NodeIt &getFirst(NodeIt &n) { return graph->getFirst(n); }
       
   582 //   InEdgeIt &getFirst(InEdgeIt &e,const NodeIt &n);
       
   583 //   { return graph->getFirst(e,n); }
       
   584 //   OutEdgeIt &getFirst(OutEdgeIt &e,const NodeIt &n);
       
   585 //   { return graph->getFirst(e,n); }
       
   586 //   SymEdgeIt &getFirst(SymEdgeIt &e,const NodeIt &n);
       
   587 //   { return graph->getFirst(e,n); }
       
   588 //   EachEdgeIt &getFirst(EachEdgeIt &e);
       
   589 //   { return graph->getFirst(e); }
       
   590    
       
   591 //   NodeIt next(const NodeIt &n);
       
   592 //   { return graph->next(n); }
       
   593 //   InEdgeIt next(const InEdgeIt &e);
       
   594 //   { return graph->next(e); }
       
   595 //   OutEdgeIt next(const OutEdgeIt &e);
       
   596 //   { return graph->next(e); }
       
   597 //   SymEdgeIt next(const SymEdgeIt &e);
       
   598 //   { return graph->next(e); }
       
   599 //   EachEdgeIt next(const EachEdgeIt &e);
       
   600 //   { return graph->next(e); }
       
   601  
       
   602 //   NodeIt &goNext(NodeIt &n);
       
   603 //   { return graph->goNext(n); }
       
   604 //   InEdgeIt &goNext(InEdgeIt &e);
       
   605 //   { return graph->goNext(e); }
       
   606 //   OutEdgeIt &goNext(OutEdgeIt &e);
       
   607 //   { return graph->goNext(e); }
       
   608 //   SymEdgeIt &goNext(SymEdgeIt &e);
       
   609 //   { return graph->goNext(e); }
       
   610 //   EachEdgeIt &goNext(EachEdgeIt &e);
       
   611 //   { return graph->goNext(e); }
       
   612