2 #ifndef GRAPH_WRAPPER_H
3 #define GRAPH_WRAPPER_H
7 template<typename Graph>
8 class TrivGraphWrapper {
12 typedef Graph BaseGraph;
14 typedef typename Graph::NodeIt NodeIt;
15 typedef typename Graph::EachNodeIt EachNodeIt;
17 typedef typename Graph::EdgeIt EdgeIt;
18 typedef typename Graph::OutEdgeIt OutEdgeIt;
19 typedef typename Graph::InEdgeIt InEdgeIt;
20 //typedef typename Graph::SymEdgeIt SymEdgeIt;
21 typedef typename Graph::EachEdgeIt EachEdgeIt;
23 template<typename I> I& getFirst(I& i) const { return graph->getFirst(i); }
24 template<typename I, typename P> I& getFirst(I& i, const P& p) const {
25 return graph->getFirst(i, p); }
27 template<typename I> I getNext(const I& i) const {
28 return graph->getNext(i); }
29 template<typename I> I& next(I &i) const { return graph->next(i); }
31 template< typename It > It first() const {
32 It e; getFirst(e); return e; }
34 template< typename It > It first(const NodeIt& v) const {
35 It e; getFirst(e, v); return e; }
37 NodeIt head(const EdgeIt& e) const { return graph->head(e); }
38 NodeIt tail(const EdgeIt& e) const { return graph->tail(e); }
40 template<typename I> bool valid(const I& i) const
41 { return graph->valid(i); }
43 //template<typename I> void setInvalid(const I &i);
44 //{ return graph->setInvalid(i); }
46 int nodeNum() const { return graph->nodeNum(); }
47 int edgeNum() const { return graph->edgeNum(); }
49 template<typename I> NodeIt aNode(const I& e) const {
50 return graph->aNode(e); }
51 template<typename I> NodeIt bNode(const I& e) const {
52 return graph->bNode(e); }
54 NodeIt addNode() const { return graph->addNode(); }
55 EdgeIt addEdge(const NodeIt& tail, const NodeIt& head) const {
56 return graph->addEdge(tail, head); }
58 template<typename I> void erase(const I& i) const { graph->erase(i); }
60 void clear() const { graph->clear(); }
62 template<typename T> class NodeMap : public Graph::NodeMap<T> {
64 NodeMap(const TrivGraphWrapper<Graph>& _G) :
65 Graph::NodeMap<T>(_G.getGraph()) { }
66 NodeMap(const TrivGraphWrapper<Graph>& _G, T a) :
67 Graph::NodeMap<T>(_G.getGraph(), a) { }
69 template<typename T> class EdgeMap : public Graph::EdgeMap<T> {
71 EdgeMap(const TrivGraphWrapper<Graph>& _G) :
72 Graph::EdgeMap<T>(_G.getGraph()) { }
73 EdgeMap(const TrivGraphWrapper<Graph>& _G, T a) :
74 Graph::EdgeMap<T>(_G.getGraph(), a) { }
77 void setGraph(Graph& _graph) { graph = &_graph; }
78 Graph& getGraph() const { return (*graph); }
80 //TrivGraphWrapper() : graph(0) { }
81 TrivGraphWrapper(Graph& _graph) : graph(&_graph) { }
84 template<typename Graph>
90 typedef Graph BaseGraph;
92 typedef typename Graph::NodeIt NodeIt;
93 typedef typename Graph::EachNodeIt EachNodeIt;
95 typedef typename Graph::EdgeIt EdgeIt;
96 typedef typename Graph::OutEdgeIt InEdgeIt;
97 typedef typename Graph::InEdgeIt OutEdgeIt;
98 //typedef typename Graph::SymEdgeIt SymEdgeIt;
99 typedef typename Graph::EachEdgeIt EachEdgeIt;
101 template<typename I> I& getFirst(I& i) const { return graph->getFirst(i); }
102 template<typename I, typename P> I& getFirst(I& i, const P& p) const {
103 return graph->getFirst(i, p); }
105 template<typename I> I getNext(const I& i) const {
106 return graph->getNext(i); }
107 template<typename I> I& next(I &i) const { return graph->next(i); }
109 template< typename It > It first() const {
110 It e; getFirst(e); return e; }
112 template< typename It > It first(const NodeIt& v) const {
113 It e; getFirst(e, v); return e; }
115 NodeIt head(const EdgeIt& e) const { return graph->tail(e); }
116 NodeIt tail(const EdgeIt& e) const { return graph->head(e); }
118 template<typename I> bool valid(const I& i) const
119 { return graph->valid(i); }
121 //template<typename I> void setInvalid(const I &i);
122 //{ return graph->setInvalid(i); }
124 template<typename I> NodeIt aNode(const I& e) const {
125 return graph->aNode(e); }
126 template<typename I> NodeIt bNode(const I& e) const {
127 return graph->bNode(e); }
129 NodeIt addNode() const { return graph->addNode(); }
130 EdgeIt addEdge(const NodeIt& tail, const NodeIt& head) const {
131 return graph->addEdge(tail, head); }
133 int nodeNum() const { return graph->nodeNum(); }
134 int edgeNum() const { return graph->edgeNum(); }
136 template<typename I> void erase(const I& i) const { graph->erase(i); }
138 void clear() const { graph->clear(); }
140 template<typename T> class NodeMap : public Graph::NodeMap<T> {
142 NodeMap(const RevGraphWrapper<Graph>& _G) :
143 Graph::NodeMap<T>(_G.getGraph()) { }
144 NodeMap(const RevGraphWrapper<Graph>& _G, T a) :
145 Graph::NodeMap<T>(_G.getGraph(), a) { }
147 template<typename T> class EdgeMap : public Graph::EdgeMap<T> {
149 EdgeMap(const RevGraphWrapper<Graph>& _G) :
150 Graph::EdgeMap<T>(_G.getGraph()) { }
151 EdgeMap(const RevGraphWrapper<Graph>& _G, T a) :
152 Graph::EdgeMap<T>(_G.getGraph(), a) { }
155 void setGraph(Graph& _graph) { graph = &_graph; }
156 Graph& getGraph() const { return (*graph); }
158 //RevGraphWrapper() : graph(0) { }
159 RevGraphWrapper(Graph& _graph) : graph(&_graph) { }
163 template<typename Graph>
164 class UndirGraphWrapper {
168 typedef Graph BaseGraph;
170 typedef typename Graph::NodeIt NodeIt;
171 typedef typename Graph::EachNodeIt EachNodeIt;
173 //typedef typename Graph::EdgeIt EdgeIt;
174 //typedef typename Graph::OutEdgeIt OutEdgeIt;
175 //typedef typename Graph::InEdgeIt InEdgeIt;
176 //typedef typename Graph::SymEdgeIt SymEdgeIt;
177 //typedef typename Graph::EachEdgeIt EachEdgeIt;
180 typedef typename Graph::EdgeIt GraphEdgeIt;
181 typedef typename Graph::OutEdgeIt GraphOutEdgeIt;
182 typedef typename Graph::InEdgeIt GraphInEdgeIt;
186 friend class UndirGraphWrapper<Graph>;
187 bool out_or_in; //true iff out
191 EdgeIt() : out_or_in(true), out(), in() { }
192 operator GraphEdgeIt() const {
193 if (out_or_in) return(out); else return(in);
197 class OutEdgeIt : public EdgeIt {
198 friend class UndirGraphWrapper<Graph>;
199 //bool out_or_in; //true iff out
200 //GraphOutEdgeIt out;
203 OutEdgeIt() : EdgeIt() { }
204 OutEdgeIt(const UndirGraphWrapper& _G, const NodeIt& n) : EdgeIt() {
205 _G.graph->getFirst(out, n);
206 if (!(_G.graph->valid(out))) {
208 _G.graph->getFirst(in, n);
213 OutEdgeIt& getFirst(OutEdgeIt& e, const NodeIt& n) const {
215 graph->getFirst(e.out, n);
216 if (!(graph->valid(e.out))) {
218 graph->getFirst(e.in, n);
223 OutEdgeIt& next(OutEdgeIt& e) const {
225 NodeIt n=graph->tail(e.out);
227 if (!graph->valid(e.out)) {
229 graph->getFirst(e.in, n);
237 NodeIt aNode(const OutEdgeIt& e) const {
238 if (e.out_or_in) return graph->tail(e); else return graph->head(e); }
239 NodeIt bNode(const OutEdgeIt& e) const {
240 if (e.out_or_in) return graph->head(e); else return graph->tail(e); }
242 typedef OutEdgeIt InEdgeIt;
244 template<typename I> I& getFirst(I& i) const { return graph->getFirst(i); }
245 // template<typename I, typename P> I& getFirst(I& i, const P& p) const {
246 // return graph->getFirst(i, p); }
248 template<typename I> I getNext(const I& i) const {
249 return graph->getNext(i); }
250 template<typename I> I& next(I &i) const { return graph->next(i); }
252 template< typename It > It first() const {
253 It e; getFirst(e); return e; }
255 template< typename It > It first(const NodeIt& v) const {
256 It e; getFirst(e, v); return e; }
258 NodeIt head(const EdgeIt& e) const { return graph->head(e); }
259 NodeIt tail(const EdgeIt& e) const { return graph->tail(e); }
261 template<typename I> bool valid(const I& i) const
262 { return graph->valid(i); }
264 //template<typename I> void setInvalid(const I &i);
265 //{ return graph->setInvalid(i); }
267 int nodeNum() const { return graph->nodeNum(); }
268 int edgeNum() const { return graph->edgeNum(); }
270 // template<typename I> NodeIt aNode(const I& e) const {
271 // return graph->aNode(e); }
272 // template<typename I> NodeIt bNode(const I& e) const {
273 // return graph->bNode(e); }
275 NodeIt addNode() const { return graph->addNode(); }
276 EdgeIt addEdge(const NodeIt& tail, const NodeIt& head) const {
277 return graph->addEdge(tail, head); }
279 template<typename I> void erase(const I& i) const { graph->erase(i); }
281 void clear() const { graph->clear(); }
283 template<typename T> class NodeMap : public Graph::NodeMap<T> {
285 NodeMap(const UndirGraphWrapper<Graph>& _G) :
286 Graph::NodeMap<T>(_G.getGraph()) { }
287 NodeMap(const UndirGraphWrapper<Graph>& _G, T a) :
288 Graph::NodeMap<T>(_G.getGraph(), a) { }
290 template<typename T> class EdgeMap : public Graph::EdgeMap<T> {
292 EdgeMap(const UndirGraphWrapper<Graph>& _G) :
293 Graph::EdgeMap<T>(_G.getGraph()) { }
294 EdgeMap(const UndirGraphWrapper<Graph>& _G, T a) :
295 Graph::EdgeMap<T>(_G.getGraph(), a) { }
298 void setGraph(Graph& _graph) { graph = &_graph; }
299 Graph& getGraph() const { return (*graph); }
301 //TrivGraphWrapper() : graph(0) { }
302 UndirGraphWrapper(Graph& _graph) : graph(&_graph) { }
307 // template<typename Graph>
308 // class SymGraphWrapper
313 // typedef Graph BaseGraph;
315 // typedef typename Graph::NodeIt NodeIt;
316 // typedef typename Graph::EdgeIt EdgeIt;
318 // typedef typename Graph::EachNodeIt EachNodeIt;
320 // //FIXME tag-ekkel megcsinalni, hogy abbol csinaljon
321 // //iranyitatlant, ami van
322 // //mert csak 1 dolgot lehet be typedef-elni
323 // typedef typename Graph::OutEdgeIt SymEdgeIt;
324 // //typedef typename Graph::InEdgeIt SymEdgeIt;
325 // //typedef typename Graph::SymEdgeIt SymEdgeIt;
326 // typedef typename Graph::EachEdgeIt EachEdgeIt;
328 // int nodeNum() const { return graph->nodeNum(); }
329 // int edgeNum() const { return graph->edgeNum(); }
331 // template<typename I> I& getFirst(I& i) const { return graph->getFirst(i); }
332 // template<typename I, typename P> I& getFirst(I& i, const P& p) const {
333 // return graph->getFirst(i, p); }
334 // //template<typename I> I next(const I i); { return graph->goNext(i); }
335 // //template<typename I> I &goNext(I &i); { return graph->goNext(i); }
337 // template< typename It > It first() const {
338 // It e; getFirst(e); return e; }
340 // template< typename It > It first(NodeIt v) const {
341 // It e; getFirst(e, v); return e; }
343 // NodeIt head(const EdgeIt& e) const { return graph->head(e); }
344 // NodeIt tail(const EdgeIt& e) const { return graph->tail(e); }
346 // template<typename I> NodeIt aNode(const I& e) const {
347 // return graph->aNode(e); }
348 // template<typename I> NodeIt bNode(const I& e) const {
349 // return graph->bNode(e); }
351 // //template<typename I> bool valid(const I i);
352 // //{ return graph->valid(i); }
354 // //template<typename I> void setInvalid(const I &i);
355 // //{ return graph->setInvalid(i); }
357 // NodeIt addNode() { return graph->addNode(); }
358 // EdgeIt addEdge(const NodeIt& tail, const NodeIt& head) {
359 // return graph->addEdge(tail, head); }
361 // template<typename I> void erase(const I& i) { graph->erase(i); }
363 // void clear() { graph->clear(); }
365 // template<typename T> class NodeMap : public Graph::NodeMap<T> { };
366 // template<typename T> class EdgeMap : public Graph::EdgeMap<T> { };
368 // void setGraph(Graph& _graph) { graph = &_graph; }
369 // Graph& getGraph() { return (*graph); }
371 // //SymGraphWrapper() : graph(0) { }
372 // SymGraphWrapper(Graph& _graph) : graph(&_graph) { }
376 template<typename Graph, typename Number, typename FlowMap, typename CapacityMap>
377 class ResGraphWrapper {
379 typedef Graph BaseGraph;
380 typedef typename Graph::NodeIt NodeIt;
381 typedef typename Graph::EachNodeIt EachNodeIt;
383 typedef typename Graph::OutEdgeIt OldOutEdgeIt;
384 typedef typename Graph::InEdgeIt OldInEdgeIt;
387 const CapacityMap* capacity;
389 ResGraphWrapper(const Graph& _G, FlowMap& _flow,
390 const CapacityMap& _capacity) :
391 G(&_G), flow(&_flow), capacity(&_capacity) { }
392 // ResGraphWrapper(const ResGraphWrapper& res_graph_wrapper) :
393 // G(res_graph_wrapper.G), flow(res_graph_wrapper.flow), capacity(res_graph_wrapper.capacity) { }
394 void setGraph(Graph& _graph) { graph = &_graph; }
395 Graph& getGraph() const { return (*graph); }
399 friend class OutEdgeIt;
402 friend class ResGraphWrapper<Graph, Number, FlowMap, CapacityMap>;
404 //const ResGraph3<Graph, Number, FlowMap, CapacityMap>* resG;
407 const CapacityMap* capacity;
411 bool out_or_in; //true, iff out
413 EdgeIt() : out_or_in(true) { }
414 EdgeIt(const Graph& _G, FlowMap& _flow, const CapacityMap& _capacity) :
415 G(&_G), flow(&_flow), capacity(&_capacity), out_or_in(true) { }
416 //EdgeIt(const EdgeIt& e) : G(e.G), flow(e.flow), capacity(e.capacity), out(e.out), in(e.in), out_or_in(e.out_or_in) { }
417 Number free() const {
419 return (/*resG->*/capacity->get(out)-/*resG->*/flow->get(out));
421 return (/*resG->*/flow->get(in));
425 return out_or_in && out.valid() || in.valid(); }
426 void augment(Number a) const {
428 /*resG->*/flow->set(out, /*resG->*/flow->get(out)+a);
430 /*resG->*/flow->set(in, /*resG->*/flow->get(in)-a);
437 std::cout << G->id(G->tail(out)) << "--"<< G->id(out) <<"->"<< G->id(G->head(out));
439 std::cout << "invalid";
444 std::cout << G->id(G->head(in)) << "<-"<< G->id(in) <<"--"<< G->id(G->tail(in));
446 std::cout << "invalid";
448 std::cout << std::endl;
452 Number free(OldOutEdgeIt out) const {
453 return (/*resG->*/capacity->get(out)-/*resG->*/flow->get(out));
455 Number free(OldInEdgeIt in) const {
456 return (/*resG->*/flow->get(in));
459 class OutEdgeIt : public EdgeIt {
460 friend class ResGraphWrapper<Graph, Number, FlowMap, CapacityMap>;
464 OutEdgeIt(const Graph& _G, NodeIt v, FlowMap& _flow, const CapacityMap& _capacity) : EdgeIt(_G, _flow, _capacity) {
465 //out=/*resG->*/G->template first<OldOutEdgeIt>(v);
467 while( out.valid() && !(EdgeIt::free()>0) ) { ++out; }
470 //in=/*resG->*/G->template first<OldInEdgeIt>(v);
472 while( in.valid() && !(EdgeIt::free()>0) ) { ++in; }
476 OutEdgeIt& operator++() {
478 NodeIt v=/*resG->*/G->aNode(out);
480 while( out.valid() && !(EdgeIt::free()>0) ) { ++out; }
483 G->getFirst(in, v); //=/*resG->*/G->template first<OldInEdgeIt>(v);
484 while( in.valid() && !(EdgeIt::free()>0) ) { ++in; }
488 while( in.valid() && !(EdgeIt::free()>0) ) { ++in; }
494 class EachEdgeIt : public EdgeIt {
495 friend class ResGraphWrapper<Graph, Number, FlowMap, CapacityMap>;
496 typename Graph::EachNodeIt v;
499 //EachEdgeIt(const EachEdgeIt& e) : EdgeIt(e), v(e.v) { }
500 EachEdgeIt(const Graph& _G, FlowMap& _flow, const CapacityMap& _capacity) : EdgeIt(_G, _flow, _capacity) {
503 if (v.valid()) G->getFirst(out, v); else out=OldOutEdgeIt();
504 while (out.valid() && !(EdgeIt::free()>0) ) { ++out; }
505 while (v.valid() && !out.valid()) {
507 if (v.valid()) G->getFirst(out, v);
508 while (out.valid() && !(EdgeIt::free()>0) ) { ++out; }
513 if (v.valid()) G->getFirst(in, v); else in=OldInEdgeIt();
514 while (in.valid() && !(EdgeIt::free()>0) ) { ++in; }
515 while (v.valid() && !in.valid()) {
517 if (v.valid()) G->getFirst(in, v);
518 while (in.valid() && !(EdgeIt::free()>0) ) { ++in; }
522 EachEdgeIt& operator++() {
525 while (out.valid() && !(EdgeIt::free()>0) ) { ++out; }
526 while (v.valid() && !out.valid()) {
528 if (v.valid()) G->getFirst(out, v);
529 while (out.valid() && !(EdgeIt::free()>0) ) { ++out; }
534 if (v.valid()) G->getFirst(in, v); else in=OldInEdgeIt();
535 while (in.valid() && !(EdgeIt::free()>0) ) { ++in; }
536 while (v.valid() && !in.valid()) {
538 if (v.valid()) G->getFirst(in, v);
539 while (in.valid() && !(EdgeIt::free()>0) ) { ++in; }
544 while (in.valid() && !(EdgeIt::free()>0) ) { ++in; }
545 while (v.valid() && !in.valid()) {
547 if (v.valid()) G->getFirst(in, v);
548 while (in.valid() && !(EdgeIt::free()>0) ) { ++in; }
555 void getFirst(EachNodeIt& v) const { G->getFirst(v); }
556 void getFirst(OutEdgeIt& e, NodeIt v) const {
557 e=OutEdgeIt(*G, v, *flow, *capacity);
559 void getFirst(EachEdgeIt& e) const {
560 e=EachEdgeIt(*G, *flow, *capacity);
563 EachNodeIt& next(EachNodeIt& n) const { return G->next(n); }
565 OutEdgeIt& next(OutEdgeIt& e) const {
567 NodeIt v=G->aNode(e.out);
569 while( G->valid(e.out) && !(e.free()>0) ) { ++(e.out); }
570 if (!G->valid(e.out)) {
572 G->getFirst(e.in, v); //=/*resG->*/G->template first<OldInEdgeIt>(v);
573 while( G->valid(e.in) && !(e.free()>0) ) { ++(e.in); }
577 while( G->valid(e.in) && !(e.free()>0) ) { ++(e.in); }
582 EachEdgeIt& next(EachEdgeIt& e) const {
585 while (G->valid(e.out) && !(e.free()>0) ) { ++(e.out); }
586 while (G->valid(e.v) && !G->valid(e.out)) {
588 if (G->valid(e.v)) G->getFirst(e.out, e.v);
589 while (G->valid(e.out) && !(e.free()>0) ) { ++(e.out); }
591 if (!G->valid(e.out)) {
594 if (G->valid(e.v)) G->getFirst(e.in, e.v); else e.in=OldInEdgeIt();
595 while (G->valid(e.in) && !(e.free()>0) ) { ++(e.in); }
596 while (G->valid(e.v) && !G->valid(e.in)) {
598 if (G->valid(e.v)) G->getFirst(e.in, e.v);
599 while (G->valid(e.in) && !(e.free()>0) ) { ++(e.in); }
604 while (G->valid(e.in) && !(e.free()>0) ) { ++(e.in); }
605 while (G->valid(e.v) && !G->valid(e.in)) {
607 if (G->valid(e.v)) G->getFirst(e.in, e.v);
608 while (G->valid(e.in) && !(e.free()>0) ) { ++(e.in); }
615 template< typename It >
622 template< typename It >
623 It first(NodeIt v) const {
629 NodeIt tail(EdgeIt e) const {
630 return ((e.out_or_in) ? G->aNode(e.out) : G->aNode(e.in)); }
631 NodeIt head(EdgeIt e) const {
632 return ((e.out_or_in) ? G->bNode(e.out) : G->bNode(e.in)); }
634 NodeIt aNode(OutEdgeIt e) const {
635 return ((e.out_or_in) ? G->aNode(e.out) : G->aNode(e.in)); }
636 NodeIt bNode(OutEdgeIt e) const {
637 return ((e.out_or_in) ? G->bNode(e.out) : G->bNode(e.in)); }
639 int id(NodeIt v) const { return G->id(v); }
641 bool valid(NodeIt n) const { return G->valid(n); }
642 bool valid(EdgeIt e) const {
643 return e.out_or_in ? G->valid(e.out) : G->valid(e.in); }
645 template<typename T> class NodeMap : public Graph::NodeMap<T> {
647 NodeMap(const ResGraphWrapper<Graph, Number, FlowMap, CapacityMap>& _G)
648 : Graph::NodeMap<T>(_G.getGraph()) { }
649 NodeMap(const ResGraphWrapper<Graph, Number, FlowMap, CapacityMap>& _G,
650 T a) : Graph::NodeMap<T>(_G.getGraph(), a) { }
653 // template <typename T>
655 // typename Graph::NodeMap<T> node_map;
657 // NodeMap(const ResGraphWrapper<Graph, Number, FlowMap, CapacityMap>& _G) : node_map(*(_G.G)) { }
658 // NodeMap(const ResGraphWrapper<Graph, Number, FlowMap, CapacityMap>& _G, T a) : node_map(*(_G.G), a) { }
659 // void set(NodeIt nit, T a) { node_map.set(nit, a); }
660 // T get(NodeIt nit) const { return node_map.get(nit); }
663 template <typename T>
665 typename Graph::EdgeMap<T> forward_map, backward_map;
667 EdgeMap(const ResGraphWrapper<Graph, Number, FlowMap, CapacityMap>& _G) : forward_map(_G.getGraph()), backward_map(_G.getGraph()) { }
668 EdgeMap(const ResGraphWrapper<Graph, Number, FlowMap, CapacityMap>& _G, T a) : forward_map(_G.getGraph(), a), backward_map(_G.getGraph(), a) { }
669 void set(EdgeIt e, T a) {
671 forward_map.set(e.out, a);
673 backward_map.set(e.in, a);
677 return forward_map.get(e.out);
679 return backward_map.get(e.in);
687 // // FIXME: comparison should be made better!!!
688 // template<typename Graph, typename T, typename LowerMap, typename FlowMap, typename UpperMap>
689 // class ResGraphWrapper
694 // typedef Graph BaseGraph;
696 // typedef typename Graph::NodeIt NodeIt;
697 // typedef typename Graph::EdgeIt EdgeIt;
699 // typedef typename Graph::EachNodeIt EachNodeIt;
703 // //Graph::NodeIt n;
705 // typename Graph::OutEdgeIt o;
706 // typename Graph::InEdgeIt i;
710 // //Graph::NodeIt n;
712 // typename Graph::OutEdgeIt o;
713 // typename Graph::InEdgeIt i;
715 // typedef typename Graph::SymEdgeIt SymEdgeIt;
716 // typedef typename Graph::EachEdgeIt EachEdgeIt;
718 // int nodeNum() const { return graph->nodeNum(); }
719 // int edgeNum() const { return graph->edgeNum(); }
721 // NodeIt& getFirst(NodeIt& n) const { return graph->getFirst(n); }
723 // // EachEdge and SymEdge is missing!!!!
724 // // EdgeIt <-> In/OutEdgeIt conversion is missing!!!!
727 // OutEdgeIt& getFirst(OutEdgeIt& e, const NodeIt& n) const
730 // graph->getFirst(e.o,n);
731 // while(graph->valid(e.o) && fmap.get(e.o)>=himap.get(e.o))
732 // graph->goNext(e.o);
733 // if(!graph->valid(e.o)) {
734 // graph->getFirst(e.i,n);
735 // while(graph->valid(e.i) && fmap.get(e.i)<=lomap.get(e.i))
736 // graph->goNext(e.i);
741 // OutEdgeIt &goNext(OutEdgeIt &e)
743 // if(graph->valid(e.o)) {
744 // while(graph->valid(e.o) && fmap.get(e.o)>=himap.get(e.o))
745 // graph->goNext(e.o);
746 // if(graph->valid(e.o)) return e;
747 // else graph->getFirst(e.i,e.n);
750 // while(graph->valid(e.i) && fmap.get(e.i)<=lomap.get(e.i))
751 // graph->goNext(e.i);
755 // OutEdgeIt Next(const OutEdgeIt &e) {OutEdgeIt t(e); return goNext(t);}
757 // //bool valid(const OutEdgeIt e) { return graph->valid(e.o)||graph->valid(e.i);}
760 // InEdgeIt& getFirst(InEdgeIt& e, const NodeIt& n) const
763 // graph->getFirst(e.i,n);
764 // while(graph->valid(e.i) && fmap.get(e.i)>=himap.get(e.i))
765 // graph->goNext(e.i);
766 // if(!graph->valid(e.i)) {
767 // graph->getFirst(e.o,n);
768 // while(graph->valid(e.o) && fmap.get(e.o)<=lomap.get(e.o))
769 // graph->goNext(e.o);
774 // InEdgeIt &goNext(InEdgeIt &e)
776 // if(graph->valid(e.i)) {
777 // while(graph->valid(e.i) && fmap.get(e.i)>=himap.get(e.i))
778 // graph->goNext(e.i);
779 // if(graph->valid(e.i)) return e;
780 // else graph->getFirst(e.o,e.n);
783 // while(graph->valid(e.o) && fmap.get(e.o)<=lomap.get(e.o))
784 // graph->goNext(e.o);
788 // InEdgeIt Next(const InEdgeIt &e) {InEdgeIt t(e); return goNext(t);}
790 // //bool valid(const InEdgeIt e) { return graph->valid(e.i)||graph->valid(e.o);}
792 // //template<typename I> I &goNext(I &i); { return graph->goNext(i); }
793 // //template<typename I> I next(const I i); { return graph->goNext(i); }
795 // template< typename It > It first() const {
796 // It e; getFirst(e); return e; }
798 // template< typename It > It first(NodeIt v) const {
799 // It e; getFirst(e, v); return e; }
801 // NodeIt head(const EdgeIt& e) const { return graph->head(e); }
802 // NodeIt tail(const EdgeIt& e) const { return graph->tail(e); }
804 // template<typename I> NodeIt aNode(const I& e) const {
805 // return graph->aNode(e); }
806 // template<typename I> NodeIt bNode(const I& e) const {
807 // return graph->bNode(e); }
809 // //template<typename I> bool valid(const I i);
810 // //{ return graph->valid(i); }
812 // //template<typename I> void setInvalid(const I &i);
813 // //{ return graph->setInvalid(i); }
815 // NodeIt addNode() { return graph->addNode(); }
816 // EdgeIt addEdge(const NodeIt& tail, const NodeIt& head) {
817 // return graph->addEdge(tail, head); }
819 // template<typename I> void erase(const I& i) { graph->erase(i); }
821 // void clear() { graph->clear(); }
823 // template<typename S> class NodeMap : public Graph::NodeMap<S> { };
824 // template<typename S> class EdgeMap : public Graph::EdgeMap<S> { };
826 // void setGraph(Graph& _graph) { graph = &_graph; }
827 // Graph& getGraph() { return (*graph); }
829 // //ResGraphWrapper() : graph(0) { }
830 // ResGraphWrapper(Graph& _graph) : graph(&_graph) { }
835 #endif //GRAPH_WRAPPER_H