Timer class for measuring user/system time added.
2 #ifndef GRAPH_WRAPPER_H
3 #define GRAPH_WRAPPER_H
15 typedef typename G::EdgeIt EdgeIt;
17 typedef typename G::InEdgeIt InEdgeIt;
18 typedef typename G::OutEdgeIt OutEdgeIt;
19 typedef typename G::SymEdgeIt SymEdgeIt;
20 typedef typename G::EachEdgeIt EachEdgeIt;
22 typedef typename G::NodeIt NodeIt;
24 template<typename I> I &getFirst(I &i); { return graph->getFirst(i); }
25 template<typename I,typename P> I &getFirst(I &i,const P &p);
26 { return graph->getFirst(i,p); }
27 template<typename I> I next(const I i); { return graph->goNext(i); }
28 template<typename I> I &goNext(I &i); { return graph->goNext(i); }
30 NodeIt head(const EdgeIt &e);
31 { return graph->head(e); }
32 NodeIt tail(const EdgeIt &e);
33 { return graph->tail(e); }
35 template<typename I> NodeIt aNode(const I e);
36 { return graph->aNode(e); }
37 template<typename I> NodeIt bNode(const I e);
38 { return graph->bNode(e); }
40 template<typename I> bool valid(const I i);
41 { return graph->valid(i); }
43 template<typename I> void setInvalid(const I &i);
44 { return graph->setInvalid(i); }
46 NodeIt addNode(); { return graph->addNode(); }
47 EdgeIt addEdge(const NodeIt from,const NodeIt to);
48 { return graph->addEdge(ftom,to); }
50 template<I> void delete(I i); { graph->delete(i); }
52 void clean(); { graph->clean(); }
54 template<class T> class NodeMap : public typename G::NodeMap<T>;
55 template<class T> class EdgeMap : public typename G::EdgeMap<T>;
57 void SetG(G &g) {graph = &g;}
59 TrivGraphWrapper() {graph = NULL;}
60 TrivGraphWrapper(G &g) {graph = &g;}
71 typedef typename G::EdgeIt EdgeIt;
73 typedef typename G::InEdgeIt OutEdgeIt;
74 typedef typename G::OutEdgeIt InEdgeIt;
75 typedef typename G::SymEdgeIt SymEdgeIt;
76 typedef typename G::EachEdgeIt EachEdgeIt;
78 typedef typename G::NodeIt NodeIt;
80 template<typename I> I &getFirst(I &i); { return graph->getFirst(i); }
81 template<typename I,typename P> I &getFirst(I &i,const P &p);
82 { return graph->getFirst(i,p); }
83 template<typename I> I next(const I i); { return graph->goNext(i); }
84 template<typename I> I &goNext(I &i); { return graph->goNext(i); }
86 NodeIt head(const EdgeIt &e);
87 { return graph->tail(e); }
88 NodeIt tail(const EdgeIt &e);
89 { return graph->head(e); }
91 template<typename I> NodeIt aNode(const I e);
92 { return graph->aNode(e); }
93 template<typename I> NodeIt bNode(const I e);
94 { return graph->bNode(e); }
96 template<typename I> bool valid(const I i);
97 { return graph->valid(i); }
99 template<typename I> void setInvalid(const I &i);
100 { return graph->setInvalid(i); }
102 NodeIt addNode(); { return graph->addNode(); }
103 EdgeIt addEdge(const NodeIt from,const NodeIt to);
104 { return graph->addEdge(to,from); }
106 template<I> void delete(I i); { graph->delete(i); }
108 void clean(); { graph->clean(); }
110 template<class T> class NodeMap : public typename G::NodeMap<T>;
111 template<class T> class EdgeMap : public typename G::EdgeMap<T>;
113 void SetG(G &g) {graph = &g;}
115 RevGraphWrapper() {graph = NULL;}
116 RevGraphWrapper(G &g) {graph = &g;}
120 class SymGraphWrapper
127 typedef typename G::EdgeIt EdgeIt;
129 typedef typename G::InEdgeIt SymEdgeIt;
130 typedef typename G::OutEdgeIt SymEdgeIt;
131 typedef typename G::SymEdgeIt SymEdgeIt;
132 typedef typename G::EachEdgeIt EachEdgeIt;
134 typedef typename G::NodeIt NodeIt;
136 template<typename I> I &getFirst(I &i); { return graph->getFirst(i); }
137 template<typename I,typename P> I &getFirst(I &i,const P &p);
138 { return graph->getFirst(i,p); }
139 template<typename I> I next(const I i); { return graph->goNext(i); }
140 template<typename I> I &goNext(I &i); { return graph->goNext(i); }
142 NodeIt head(const EdgeIt &e);
143 { return graph->head(e); }
144 NodeIt tail(const EdgeIt &e);
145 { return graph->tail(e); }
147 template<typename I> NodeIt aNode(const I e);
148 { return graph->aNode(e); }
149 template<typename I> NodeIt bNode(const I e);
150 { return graph->bNode(e); }
152 template<typename I> bool valid(const I i);
153 { return graph->valid(i); }
155 template<typename I> void setInvalid(const I &i);
156 { return graph->setInvalid(i); }
158 NodeIt addNode(); { return graph->addNode(); }
159 EdgeIt addEdge(const NodeIt from,const NodeIt to);
160 { return graph->addEdge(to,from); }
162 template<I> void delete(I i); { graph->delete(i); }
164 void clean(); { graph->clean(); }
166 template<class T> class NodeMap : public typename G::NodeMap<T>;
167 template<class T> class EdgeMap : public typename G::EdgeMap<T>;
169 void SetG(G &g) {graph = &g;}
171 RevGraphWrapper() {graph = NULL;}
172 RevGraphWrapper(G &g) {graph = &g;}
176 // FIXME: comparison should be made better!!!
177 template<typename G, typename lomap, typename fmap, typename himap>
178 class ResGraphWrapper
185 typedef typename G::EdgeIt EdgeIt;
201 typedef typename G::SymEdgeIt SymEdgeIt;
202 typedef typename G::EachEdgeIt EachEdgeIt;
204 typedef typename G::NodeIt NodeIt;
206 NodeIt &getFirst(NodeIt &n); { return graph->getFirst(n); }
208 // EachEdge and SymEdge is missing!!!!
209 // EdgeIt <-> In/OutEdgeIt conversion is missing!!!!
211 InEdgeIt &getFirst(InEdgeIt &e,const NodeIt &n)
214 graph->getFirst(e.i,n);
215 while(graph->valid(e.i) && fmap.get(e.i)>=himap.get(e.i))
217 if(!graph->valid(e.i)) {
218 graph->getFirst(e.o,n);
219 while(graph->valid(e.o) && fmap.get(e.o)<=lomap.get(e.o))
224 InEdgeIt &goNext(InEdgeIt &e)
226 if(graph->valid(e.i)) {
227 while(graph->valid(e.i) && fmap.get(e.i)>=himap.get(e.i))
229 if(graph->valid(e.i)) return e;
230 else graph->getFirst(e.o,e.n);
233 while(graph->valid(e.o) && fmap.get(e.o)<=lomap.get(e.o))
238 InEdgeIt Next(const InEdgeIt &e) {InEdgeIt t(e); return goNext(t);}
239 bool valid(const InEdgeIt e) { return graph->valid(e.i)||graph->valid(e.o);}
241 OutEdgeIt &getFirst(OutEdgeIt &e,const NodeIt &n)
244 graph->getFirst(e.o,n);
245 while(graph->valid(e.o) && fmap.get(e.o)>=himap.get(e.o))
247 if(!graph->valid(e.o)) {
248 graph->getFirst(e.i,n);
249 while(graph->valid(e.i) && fmap.get(e.i)<=lomap.get(e.i))
254 OutEdgeIt &goNext(OutEdgeIt &e)
256 if(graph->valid(e.o)) {
257 while(graph->valid(e.o) && fmap.get(e.o)>=himap.get(e.o))
259 if(graph->valid(e.o)) return e;
260 else graph->getFirst(e.i,e.n);
263 while(graph->valid(e.i) && fmap.get(e.i)<=lomap.get(e.i))
268 OutEdgeIt Next(const OutEdgeIt &e) {OutEdgeIt t(e); return goNext(t);}
269 bool valid(const OutEdgeIt e) { return graph->valid(e.o)||graph->valid(e.i);}
271 template<typename I> I &goNext(I &i); { return graph->goNext(i); }
272 template<typename I> I next(const I i); { return graph->goNext(i); }
274 NodeIt head(const EdgeIt &e);
275 { return graph->head(e); }
276 NodeIt tail(const EdgeIt &e);
277 { return graph->tail(e); }
279 template<typename I> NodeIt aNode(const I e);
280 { return graph->aNode(e); }
281 template<typename I> NodeIt bNode(const I e);
282 { return graph->bNode(e); }
284 template<typename I> bool valid(const I i);
285 { return graph->valid(i); }
287 template<typename I> void setInvalid(const I &i);
288 { return graph->setInvalid(i); }
290 NodeIt addNode(); { return graph->addNode(); }
291 EdgeIt addEdge(const NodeIt from,const NodeIt to);
292 { return graph->addEdge(to,from); }
294 template<I> void delete(I i); { graph->delete(i); }
296 void clean(); { graph->clean(); }
298 template<class T> class NodeMap : public typename G::NodeMap<T>;
299 template<class T> class EdgeMap : public typename G::EdgeMap<T>;
301 void SetG(G &g) {graph = &g;}
303 RevGraphWrapper() {graph = NULL;}
304 RevGraphWrapper(G &g) {graph = &g;}
309 // NodeIt &getFirst(NodeIt &n) { return graph->getFirst(n); }
310 // InEdgeIt &getFirst(InEdgeIt &e,const NodeIt &n);
311 // { return graph->getFirst(e,n); }
312 // OutEdgeIt &getFirst(OutEdgeIt &e,const NodeIt &n);
313 // { return graph->getFirst(e,n); }
314 // SymEdgeIt &getFirst(SymEdgeIt &e,const NodeIt &n);
315 // { return graph->getFirst(e,n); }
316 // EachEdgeIt &getFirst(EachEdgeIt &e);
317 // { return graph->getFirst(e); }
319 // NodeIt next(const NodeIt &n);
320 // { return graph->next(n); }
321 // InEdgeIt next(const InEdgeIt &e);
322 // { return graph->next(e); }
323 // OutEdgeIt next(const OutEdgeIt &e);
324 // { return graph->next(e); }
325 // SymEdgeIt next(const SymEdgeIt &e);
326 // { return graph->next(e); }
327 // EachEdgeIt next(const EachEdgeIt &e);
328 // { return graph->next(e); }
330 // NodeIt &goNext(NodeIt &n);
331 // { return graph->goNext(n); }
332 // InEdgeIt &goNext(InEdgeIt &e);
333 // { return graph->goNext(e); }
334 // OutEdgeIt &goNext(OutEdgeIt &e);
335 // { return graph->goNext(e); }
336 // SymEdgeIt &goNext(SymEdgeIt &e);
337 // { return graph->goNext(e); }
338 // EachEdgeIt &goNext(EachEdgeIt &e);
339 // { return graph->goNext(e); }