1.1 --- a/src/work/marci/graph_wrapper.h Thu Mar 11 23:31:13 2004 +0000
1.2 +++ b/src/work/marci/graph_wrapper.h Fri Mar 12 09:19:54 2004 +0000
1.3 @@ -1,7 +1,9 @@
1.4 -// -*-mode: c++; -*-
1.5 +// -*- c++ -*-
1.6 #ifndef GRAPH_WRAPPER_H
1.7 #define GRAPH_WRAPPER_H
1.8
1.9 +#include <invalid.h>
1.10 +
1.11 namespace hugo {
1.12
1.13 template<typename Graph>
1.14 @@ -11,14 +13,14 @@
1.15 public:
1.16 typedef Graph BaseGraph;
1.17
1.18 + typedef typename Graph::Node Node;
1.19 typedef typename Graph::NodeIt NodeIt;
1.20 - typedef typename Graph::EachNodeIt EachNodeIt;
1.21
1.22 - typedef typename Graph::EdgeIt EdgeIt;
1.23 + typedef typename Graph::Edge Edge;
1.24 typedef typename Graph::OutEdgeIt OutEdgeIt;
1.25 typedef typename Graph::InEdgeIt InEdgeIt;
1.26 //typedef typename Graph::SymEdgeIt SymEdgeIt;
1.27 - typedef typename Graph::EachEdgeIt EachEdgeIt;
1.28 + typedef typename Graph::EdgeIt EdgeIt;
1.29
1.30 //TrivGraphWrapper() : graph(0) { }
1.31 TrivGraphWrapper(Graph& _graph) : graph(&_graph) { }
1.32 @@ -26,22 +28,22 @@
1.33 void setGraph(Graph& _graph) { graph = &_graph; }
1.34 Graph& getGraph() const { return (*graph); }
1.35
1.36 - template<typename I> I& getFirst(I& i) const { return graph->getFirst(i); }
1.37 - template<typename I, typename P> I& getFirst(I& i, const P& p) const {
1.38 - return graph->getFirst(i, p); }
1.39 + template<typename I> I& /*getF*/first(I& i) const { return graph->/*getF*/first(i); }
1.40 + template<typename I, typename P> I& /*getF*/first(I& i, const P& p) const {
1.41 + return graph->/*getF*/first(i, p); }
1.42
1.43 template<typename I> I getNext(const I& i) const {
1.44 return graph->getNext(i); }
1.45 template<typename I> I& next(I &i) const { return graph->next(i); }
1.46
1.47 template< typename It > It first() const {
1.48 - It e; getFirst(e); return e; }
1.49 + It e; /*getF*/first(e); return e; }
1.50
1.51 - template< typename It > It first(const NodeIt& v) const {
1.52 - It e; getFirst(e, v); return e; }
1.53 + template< typename It > It first(const Node& v) const {
1.54 + It e; /*getF*/first(e, v); return e; }
1.55
1.56 - NodeIt head(const EdgeIt& e) const { return graph->head(e); }
1.57 - NodeIt tail(const EdgeIt& e) const { return graph->tail(e); }
1.58 + Node head(const Edge& e) const { return graph->head(e); }
1.59 + Node tail(const Edge& e) const { return graph->tail(e); }
1.60
1.61 template<typename I> bool valid(const I& i) const
1.62 { return graph->valid(i); }
1.63 @@ -52,13 +54,13 @@
1.64 int nodeNum() const { return graph->nodeNum(); }
1.65 int edgeNum() const { return graph->edgeNum(); }
1.66
1.67 - template<typename I> NodeIt aNode(const I& e) const {
1.68 + template<typename I> Node aNode(const I& e) const {
1.69 return graph->aNode(e); }
1.70 - template<typename I> NodeIt bNode(const I& e) const {
1.71 + template<typename I> Node bNode(const I& e) const {
1.72 return graph->bNode(e); }
1.73
1.74 - NodeIt addNode() const { return graph->addNode(); }
1.75 - EdgeIt addEdge(const NodeIt& tail, const NodeIt& head) const {
1.76 + Node addNode() const { return graph->addNode(); }
1.77 + Edge addEdge(const Node& tail, const Node& head) const {
1.78 return graph->addEdge(tail, head); }
1.79
1.80 template<typename I> void erase(const I& i) const { graph->erase(i); }
1.81 @@ -90,14 +92,14 @@
1.82 public:
1.83 typedef Graph BaseGraph;
1.84
1.85 - typedef typename Graph::NodeIt NodeIt;
1.86 - typedef typename Graph::EachNodeIt EachNodeIt;
1.87 + typedef typename Graph::Node Node;
1.88 + typedef typename Graph::NodeIt NodeIt;
1.89
1.90 - typedef typename Graph::EdgeIt EdgeIt;
1.91 + typedef typename Graph::Edge Edge;
1.92 typedef typename Graph::OutEdgeIt InEdgeIt;
1.93 typedef typename Graph::InEdgeIt OutEdgeIt;
1.94 //typedef typename Graph::SymEdgeIt SymEdgeIt;
1.95 - typedef typename Graph::EachEdgeIt EachEdgeIt;
1.96 + typedef typename Graph::EdgeIt EdgeIt;
1.97
1.98 //RevGraphWrapper() : graph(0) { }
1.99 RevGraphWrapper(Graph& _graph) : graph(&_graph) { }
1.100 @@ -105,22 +107,22 @@
1.101 void setGraph(Graph& _graph) { graph = &_graph; }
1.102 Graph& getGraph() const { return (*graph); }
1.103
1.104 - template<typename I> I& getFirst(I& i) const { return graph->getFirst(i); }
1.105 - template<typename I, typename P> I& getFirst(I& i, const P& p) const {
1.106 - return graph->getFirst(i, p); }
1.107 + template<typename I> I& /*getF*/first(I& i) const { return graph->/*getF*/first(i); }
1.108 + template<typename I, typename P> I& /*getF*/first(I& i, const P& p) const {
1.109 + return graph->/*getF*/first(i, p); }
1.110
1.111 template<typename I> I getNext(const I& i) const {
1.112 return graph->getNext(i); }
1.113 template<typename I> I& next(I &i) const { return graph->next(i); }
1.114
1.115 template< typename It > It first() const {
1.116 - It e; getFirst(e); return e; }
1.117 + It e; /*getF*/first(e); return e; }
1.118
1.119 - template< typename It > It first(const NodeIt& v) const {
1.120 - It e; getFirst(e, v); return e; }
1.121 + template< typename It > It first(const Node& v) const {
1.122 + It e; /*getF*/first(e, v); return e; }
1.123
1.124 - NodeIt head(const EdgeIt& e) const { return graph->tail(e); }
1.125 - NodeIt tail(const EdgeIt& e) const { return graph->head(e); }
1.126 + Node head(const Edge& e) const { return graph->tail(e); }
1.127 + Node tail(const Edge& e) const { return graph->head(e); }
1.128
1.129 template<typename I> bool valid(const I& i) const
1.130 { return graph->valid(i); }
1.131 @@ -128,13 +130,13 @@
1.132 //template<typename I> void setInvalid(const I &i);
1.133 //{ return graph->setInvalid(i); }
1.134
1.135 - template<typename I> NodeIt aNode(const I& e) const {
1.136 + template<typename I> Node aNode(const I& e) const {
1.137 return graph->aNode(e); }
1.138 - template<typename I> NodeIt bNode(const I& e) const {
1.139 + template<typename I> Node bNode(const I& e) const {
1.140 return graph->bNode(e); }
1.141
1.142 - NodeIt addNode() const { return graph->addNode(); }
1.143 - EdgeIt addEdge(const NodeIt& tail, const NodeIt& head) const {
1.144 + Node addNode() const { return graph->addNode(); }
1.145 + Edge addEdge(const Node& tail, const Node& head) const {
1.146 return graph->addEdge(tail, head); }
1.147
1.148 int nodeNum() const { return graph->nodeNum(); }
1.149 @@ -169,17 +171,17 @@
1.150 public:
1.151 typedef Graph BaseGraph;
1.152
1.153 + typedef typename Graph::Node Node;
1.154 typedef typename Graph::NodeIt NodeIt;
1.155 - typedef typename Graph::EachNodeIt EachNodeIt;
1.156
1.157 - //typedef typename Graph::EdgeIt EdgeIt;
1.158 + //typedef typename Graph::Edge Edge;
1.159 //typedef typename Graph::OutEdgeIt OutEdgeIt;
1.160 //typedef typename Graph::InEdgeIt InEdgeIt;
1.161 //typedef typename Graph::SymEdgeIt SymEdgeIt;
1.162 - //typedef typename Graph::EachEdgeIt EachEdgeIt;
1.163 + //typedef typename Graph::EdgeIt EdgeIt;
1.164
1.165 //private:
1.166 - typedef typename Graph::EdgeIt GraphEdgeIt;
1.167 + typedef typename Graph::Edge GraphEdge;
1.168 typedef typename Graph::OutEdgeIt GraphOutEdgeIt;
1.169 typedef typename Graph::InEdgeIt GraphInEdgeIt;
1.170 //public:
1.171 @@ -190,48 +192,63 @@
1.172 void setGraph(Graph& _graph) { graph = &_graph; }
1.173 Graph& getGraph() const { return (*graph); }
1.174
1.175 - class EdgeIt {
1.176 + class Edge {
1.177 friend class UndirGraphWrapper<Graph>;
1.178 bool out_or_in; //true iff out
1.179 GraphOutEdgeIt out;
1.180 GraphInEdgeIt in;
1.181 public:
1.182 - EdgeIt() : out_or_in(true), out(), in() { }
1.183 - operator GraphEdgeIt() const {
1.184 + Edge() : out_or_in(), out(), in() { }
1.185 + Edge(const Invalid& i) : out_or_in(false), out(), in(i) { }
1.186 + operator GraphEdge() const {
1.187 if (out_or_in) return(out); else return(in);
1.188 }
1.189 + friend bool operator==(const Edge& u, const Edge& v) {
1.190 + if (v.out_or_in)
1.191 + return (u.out_or_in && u.out==v.out);
1.192 + else
1.193 + return (!u.out_or_in && u.in==v.in);
1.194 + }
1.195 + friend bool operator!=(const Edge& u, const Edge& v) {
1.196 + if (v.out_or_in)
1.197 + return (!u.out_or_in || u.out!=v.out);
1.198 + else
1.199 + return (u.out_or_in || u.in!=v.in);
1.200 + }
1.201 };
1.202
1.203 - class OutEdgeIt : public EdgeIt {
1.204 + class OutEdgeIt : public Edge {
1.205 friend class UndirGraphWrapper<Graph>;
1.206 public:
1.207 - OutEdgeIt() : EdgeIt() { }
1.208 - OutEdgeIt(const UndirGraphWrapper& _G, const NodeIt& n) : EdgeIt() {
1.209 - _G.graph->getFirst(out, n);
1.210 + OutEdgeIt() : Edge() { }
1.211 + OutEdgeIt(const Invalid& i) : Edge(i) { }
1.212 + OutEdgeIt(const UndirGraphWrapper& _G, const Node& n) : Edge() {
1.213 + out_or_in=true;
1.214 + _G.graph->/*getF*/first(out, n);
1.215 if (!(_G.graph->valid(out))) {
1.216 out_or_in=false;
1.217 - _G.graph->getFirst(in, n);
1.218 + _G.graph->/*getF*/first(in, n);
1.219 }
1.220 }
1.221 };
1.222
1.223 - OutEdgeIt& getFirst(OutEdgeIt& e, const NodeIt& n) const {
1.224 + OutEdgeIt& /*getF*/first(OutEdgeIt& e, const Node& n) const {
1.225 e.out_or_in=true;
1.226 - graph->getFirst(e.out, n);
1.227 + graph->/*getF*/first(e.out, n);
1.228 if (!(graph->valid(e.out))) {
1.229 e.out_or_in=false;
1.230 - graph->getFirst(e.in, n);
1.231 + graph->/*getF*/first(e.in, n);
1.232 }
1.233 return e;
1.234 }
1.235
1.236 OutEdgeIt& next(OutEdgeIt& e) const {
1.237 if (e.out_or_in) {
1.238 - NodeIt n=graph->tail(e.out);
1.239 + Node n=graph->tail(e.out);
1.240 graph->next(e.out);
1.241 if (!graph->valid(e.out)) {
1.242 e.out_or_in=false;
1.243 - graph->getFirst(e.in, n);
1.244 + graph->/*getF*/first(e.in, n);
1.245 }
1.246 } else {
1.247 graph->next(e.in);
1.248 @@ -239,29 +256,29 @@
1.249 return e;
1.250 }
1.251
1.252 - NodeIt aNode(const OutEdgeIt& e) const {
1.253 + Node aNode(const OutEdgeIt& e) const {
1.254 if (e.out_or_in) return graph->tail(e); else return graph->head(e); }
1.255 - NodeIt bNode(const OutEdgeIt& e) const {
1.256 + Node bNode(const OutEdgeIt& e) const {
1.257 if (e.out_or_in) return graph->head(e); else return graph->tail(e); }
1.258
1.259 typedef OutEdgeIt InEdgeIt;
1.260
1.261 - template<typename I> I& getFirst(I& i) const { return graph->getFirst(i); }
1.262 -// template<typename I, typename P> I& getFirst(I& i, const P& p) const {
1.263 -// return graph->getFirst(i, p); }
1.264 + template<typename I> I& /*getF*/first(I& i) const { return graph->/*getF*/first(i); }
1.265 +// template<typename I, typename P> I& /*getF*/first(I& i, const P& p) const {
1.266 +// return graph->/*getF*/first(i, p); }
1.267
1.268 template<typename I> I getNext(const I& i) const {
1.269 return graph->getNext(i); }
1.270 template<typename I> I& next(I &i) const { return graph->next(i); }
1.271
1.272 template< typename It > It first() const {
1.273 - It e; getFirst(e); return e; }
1.274 + It e; /*getF*/first(e); return e; }
1.275
1.276 - template< typename It > It first(const NodeIt& v) const {
1.277 - It e; getFirst(e, v); return e; }
1.278 + template< typename It > It first(const Node& v) const {
1.279 + It e; /*getF*/first(e, v); return e; }
1.280
1.281 - NodeIt head(const EdgeIt& e) const { return graph->head(e); }
1.282 - NodeIt tail(const EdgeIt& e) const { return graph->tail(e); }
1.283 + Node head(const Edge& e) const { return graph->head(e); }
1.284 + Node tail(const Edge& e) const { return graph->tail(e); }
1.285
1.286 template<typename I> bool valid(const I& i) const
1.287 { return graph->valid(i); }
1.288 @@ -272,13 +289,13 @@
1.289 int nodeNum() const { return graph->nodeNum(); }
1.290 int edgeNum() const { return graph->edgeNum(); }
1.291
1.292 -// template<typename I> NodeIt aNode(const I& e) const {
1.293 +// template<typename I> Node aNode(const I& e) const {
1.294 // return graph->aNode(e); }
1.295 -// template<typename I> NodeIt bNode(const I& e) const {
1.296 +// template<typename I> Node bNode(const I& e) const {
1.297 // return graph->bNode(e); }
1.298
1.299 - NodeIt addNode() const { return graph->addNode(); }
1.300 - EdgeIt addEdge(const NodeIt& tail, const NodeIt& head) const {
1.301 + Node addNode() const { return graph->addNode(); }
1.302 + Edge addEdge(const Node& tail, const Node& head) const {
1.303 return graph->addEdge(tail, head); }
1.304
1.305 template<typename I> void erase(const I& i) const { graph->erase(i); }
1.306 @@ -312,10 +329,10 @@
1.307 // public:
1.308 // typedef Graph BaseGraph;
1.309
1.310 +// typedef typename Graph::Node Node;
1.311 +// typedef typename Graph::Edge Edge;
1.312 +
1.313 // typedef typename Graph::NodeIt NodeIt;
1.314 -// typedef typename Graph::EdgeIt EdgeIt;
1.315 -
1.316 -// typedef typename Graph::EachNodeIt EachNodeIt;
1.317
1.318 // //FIXME tag-ekkel megcsinalni, hogy abbol csinaljon
1.319 // //iranyitatlant, ami van
1.320 @@ -323,29 +340,29 @@
1.321 // typedef typename Graph::OutEdgeIt SymEdgeIt;
1.322 // //typedef typename Graph::InEdgeIt SymEdgeIt;
1.323 // //typedef typename Graph::SymEdgeIt SymEdgeIt;
1.324 -// typedef typename Graph::EachEdgeIt EachEdgeIt;
1.325 +// typedef typename Graph::EdgeIt EdgeIt;
1.326
1.327 // int nodeNum() const { return graph->nodeNum(); }
1.328 // int edgeNum() const { return graph->edgeNum(); }
1.329
1.330 -// template<typename I> I& getFirst(I& i) const { return graph->getFirst(i); }
1.331 -// template<typename I, typename P> I& getFirst(I& i, const P& p) const {
1.332 -// return graph->getFirst(i, p); }
1.333 +// template<typename I> I& /*getF*/first(I& i) const { return graph->/*getF*/first(i); }
1.334 +// template<typename I, typename P> I& /*getF*/first(I& i, const P& p) const {
1.335 +// return graph->/*getF*/first(i, p); }
1.336 // //template<typename I> I next(const I i); { return graph->goNext(i); }
1.337 // //template<typename I> I &goNext(I &i); { return graph->goNext(i); }
1.338
1.339 // template< typename It > It first() const {
1.340 -// It e; getFirst(e); return e; }
1.341 +// It e; /*getF*/first(e); return e; }
1.342
1.343 -// template< typename It > It first(NodeIt v) const {
1.344 -// It e; getFirst(e, v); return e; }
1.345 +// template< typename It > It first(Node v) const {
1.346 +// It e; /*getF*/first(e, v); return e; }
1.347
1.348 -// NodeIt head(const EdgeIt& e) const { return graph->head(e); }
1.349 -// NodeIt tail(const EdgeIt& e) const { return graph->tail(e); }
1.350 +// Node head(const Edge& e) const { return graph->head(e); }
1.351 +// Node tail(const Edge& e) const { return graph->tail(e); }
1.352
1.353 -// template<typename I> NodeIt aNode(const I& e) const {
1.354 +// template<typename I> Node aNode(const I& e) const {
1.355 // return graph->aNode(e); }
1.356 -// template<typename I> NodeIt bNode(const I& e) const {
1.357 +// template<typename I> Node bNode(const I& e) const {
1.358 // return graph->bNode(e); }
1.359
1.360 // //template<typename I> bool valid(const I i);
1.361 @@ -354,8 +371,8 @@
1.362 // //template<typename I> void setInvalid(const I &i);
1.363 // //{ return graph->setInvalid(i); }
1.364
1.365 -// NodeIt addNode() { return graph->addNode(); }
1.366 -// EdgeIt addEdge(const NodeIt& tail, const NodeIt& head) {
1.367 +// Node addNode() { return graph->addNode(); }
1.368 +// Edge addEdge(const Node& tail, const Node& head) {
1.369 // return graph->addEdge(tail, head); }
1.370
1.371 // template<typename I> void erase(const I& i) { graph->erase(i); }
1.372 @@ -377,192 +394,207 @@
1.373 class ResGraphWrapper {
1.374 public:
1.375 typedef Graph BaseGraph;
1.376 + typedef typename Graph::Node Node;
1.377 typedef typename Graph::NodeIt NodeIt;
1.378 - typedef typename Graph::EachNodeIt EachNodeIt;
1.379 private:
1.380 typedef typename Graph::OutEdgeIt OldOutEdgeIt;
1.381 typedef typename Graph::InEdgeIt OldInEdgeIt;
1.382 - const Graph* G;
1.383 + const Graph* graph;
1.384 FlowMap* flow;
1.385 const CapacityMap* capacity;
1.386 public:
1.387
1.388 ResGraphWrapper(const Graph& _G, FlowMap& _flow,
1.389 const CapacityMap& _capacity) :
1.390 - G(&_G), flow(&_flow), capacity(&_capacity) { }
1.391 -// ResGraphWrapper(const ResGraphWrapper& res_graph_wrapper) :
1.392 -// G(res_graph_wrapper.G), flow(res_graph_wrapper.flow), capacity(res_graph_wrapper.capacity) { }
1.393 + graph(&_G), flow(&_flow), capacity(&_capacity) { }
1.394
1.395 void setGraph(const Graph& _graph) { graph = &_graph; }
1.396 - const Graph& getGraph() const { return (*G); }
1.397 + const Graph& getGraph() const { return (*graph); }
1.398
1.399 - class EdgeIt;
1.400 + class Edge;
1.401 class OutEdgeIt;
1.402 - friend class EdgeIt;
1.403 + friend class Edge;
1.404 friend class OutEdgeIt;
1.405
1.406 - class EdgeIt {
1.407 + class Edge {
1.408 friend class ResGraphWrapper<Graph, Number, FlowMap, CapacityMap>;
1.409 protected:
1.410 bool out_or_in; //true, iff out
1.411 OldOutEdgeIt out;
1.412 OldInEdgeIt in;
1.413 public:
1.414 - EdgeIt() : out_or_in(true) { }
1.415 + Edge() : out_or_in(true) { }
1.416 + Edge(const Invalid& i) : out_or_in(false), out(), in(i) { }
1.417 // bool valid() const {
1.418 // return out_or_in && out.valid() || in.valid(); }
1.419 + friend bool operator==(const Edge& u, const Edge& v) {
1.420 + if (v.out_or_in)
1.421 + return (u.out_or_in && u.out==v.out);
1.422 + else
1.423 + return (!u.out_or_in && u.in==v.in);
1.424 + }
1.425 + friend bool operator!=(const Edge& u, const Edge& v) {
1.426 + if (v.out_or_in)
1.427 + return (!u.out_or_in || u.out!=v.out);
1.428 + else
1.429 + return (u.out_or_in || u.in!=v.in);
1.430 + }
1.431 };
1.432
1.433
1.434 - class OutEdgeIt : public EdgeIt {
1.435 + class OutEdgeIt : public Edge {
1.436 friend class ResGraphWrapper<Graph, Number, FlowMap, CapacityMap>;
1.437 public:
1.438 OutEdgeIt() { }
1.439 //FIXME
1.440 - OutEdgeIt(const EdgeIt& e) : EdgeIt(e) { }
1.441 + OutEdgeIt(const Edge& e) : Edge(e) { }
1.442 + OutEdgeIt(const Invalid& i) : Edge(i) { }
1.443 private:
1.444 - OutEdgeIt(const ResGraphWrapper<Graph, Number, FlowMap, CapacityMap>& resG, NodeIt v) : EdgeIt() {
1.445 - resG.G->getFirst(out, v);
1.446 - while( out.valid() && !(resG.free(out)>0) ) { ++out; }
1.447 - if (!out.valid()) {
1.448 + OutEdgeIt(const ResGraphWrapper<Graph, Number, FlowMap, CapacityMap>& resG, Node v) : Edge() {
1.449 + resG.graph->/*getF*/first(out, v);
1.450 + while( resG.graph->valid(out) && !(resG.free(out)>0) ) { resG.graph->next(out); }
1.451 + if (!resG.graph->valid(out)) {
1.452 out_or_in=0;
1.453 - resG.G->getFirst(in, v);
1.454 - while( in.valid() && !(resG.free(in)>0) ) { ++in; }
1.455 + resG.graph->/*getF*/first(in, v);
1.456 + while( resG.graph->valid(in) && !(resG.free(in)>0) ) { resG.graph->next(in); }
1.457 }
1.458 }
1.459 // public:
1.460 // OutEdgeIt& operator++() {
1.461 // if (out_or_in) {
1.462 -// NodeIt v=/*resG->*/G->aNode(out);
1.463 +// Node v=/*resG->*/G->aNode(out);
1.464 // ++out;
1.465 -// while( out.valid() && !(EdgeIt::free()>0) ) { ++out; }
1.466 +// while( out.valid() && !(Edge::free()>0) ) { ++out; }
1.467 // if (!out.valid()) {
1.468 // out_or_in=0;
1.469 -// G->getFirst(in, v);
1.470 -// while( in.valid() && !(EdgeIt::free()>0) ) { ++in; }
1.471 +// G->/*getF*/first(in, v);
1.472 +// while( in.valid() && !(Edge::free()>0) ) { ++in; }
1.473 // }
1.474 // } else {
1.475 // ++in;
1.476 -// while( in.valid() && !(EdgeIt::free()>0) ) { ++in; }
1.477 +// while( in.valid() && !(Edge::free()>0) ) { ++in; }
1.478 // }
1.479 // return *this;
1.480 // }
1.481 };
1.482
1.483 - class EachEdgeIt : public EdgeIt {
1.484 + class EdgeIt : public Edge {
1.485 friend class ResGraphWrapper<Graph, Number, FlowMap, CapacityMap>;
1.486 - typename Graph::EachNodeIt v;
1.487 + typename Graph::NodeIt v;
1.488 public:
1.489 - EachEdgeIt() { }
1.490 - //EachEdgeIt(const EachEdgeIt& e) : EdgeIt(e), v(e.v) { }
1.491 - EachEdgeIt(const ResGraphWrapper<Graph, Number, FlowMap, CapacityMap>& resG) : EdgeIt() {
1.492 - resG.G->getFirst(v);
1.493 - if (v.valid()) resG.G->getFirst(out, v); else out=OldOutEdgeIt();
1.494 - while (out.valid() && !(resG.free(out)>0) ) { ++out; }
1.495 - while (v.valid() && !out.valid()) {
1.496 - ++v;
1.497 - if (v.valid()) resG.G->getFirst(out, v);
1.498 - while (out.valid() && !(resG.free(out)>0) ) { ++out; }
1.499 + EdgeIt() { }
1.500 + //EdgeIt(const EdgeIt& e) : Edge(e), v(e.v) { }
1.501 + EdgeIt(const Invalid& i) : Edge(i) { }
1.502 + EdgeIt(const ResGraphWrapper<Graph, Number, FlowMap, CapacityMap>& resG) : Edge() {
1.503 + resG.graph->/*getF*/first(v);
1.504 + if (resG.graph->valid(v)) resG.graph->/*getF*/first(out, v); else out=OldOutEdgeIt(INVALID);
1.505 + while (resG.graph->valid(out) && !(resG.free(out)>0) ) { resG.graph->next(out); }
1.506 + while (resG.graph->valid(v) && !resG.graph->valid(out)) {
1.507 + resG.graph->next(v);
1.508 + if (resG.graph->valid(v)) resG.graph->/*getF*/first(out, v);
1.509 + while (resG.graph->valid(out) && !(resG.free(out)>0) ) { resG.graph->next(out); }
1.510 }
1.511 - if (!out.valid()) {
1.512 + if (!resG.graph->valid(out)) {
1.513 out_or_in=0;
1.514 - resG.G->getFirst(v);
1.515 - if (v.valid()) resG.G->getFirst(in, v); else in=OldInEdgeIt();
1.516 - while (in.valid() && !(resG.free(in)>0) ) { ++in; }
1.517 - while (v.valid() && !in.valid()) {
1.518 - ++v;
1.519 - if (v.valid()) resG.G->getFirst(in, v);
1.520 - while (in.valid() && !(resG.free(in)>0) ) { ++in; }
1.521 + resG.graph->/*getF*/first(v);
1.522 + if (resG.graph->valid(v)) resG.graph->/*getF*/first(in, v); else in=OldInEdgeIt(INVALID);
1.523 + while (resG.graph->valid(in) && !(resG.free(in)>0) ) { resG.graph->next(in); }
1.524 + while (resG.graph->valid(v) && !resG.graph->valid(in)) {
1.525 + resG.graph->next(v);
1.526 + if (resG.graph->valid(v)) resG.graph->/*getF*/first(in, v);
1.527 + while (resG.graph->valid(in) && !(resG.free(in)>0) ) { resG.graph->next(in); }
1.528 }
1.529 }
1.530 }
1.531 -// EachEdgeIt& operator++() {
1.532 +// EdgeIt& operator++() {
1.533 // if (out_or_in) {
1.534 // ++out;
1.535 -// while (out.valid() && !(EdgeIt::free()>0) ) { ++out; }
1.536 +// while (out.valid() && !(Edge::free()>0) ) { ++out; }
1.537 // while (v.valid() && !out.valid()) {
1.538 // ++v;
1.539 -// if (v.valid()) G->getFirst(out, v);
1.540 -// while (out.valid() && !(EdgeIt::free()>0) ) { ++out; }
1.541 +// if (v.valid()) G->/*getF*/first(out, v);
1.542 +// while (out.valid() && !(Edge::free()>0) ) { ++out; }
1.543 // }
1.544 // if (!out.valid()) {
1.545 // out_or_in=0;
1.546 -// G->getFirst(v);
1.547 -// if (v.valid()) G->getFirst(in, v); else in=OldInEdgeIt();
1.548 -// while (in.valid() && !(EdgeIt::free()>0) ) { ++in; }
1.549 +// G->/*getF*/first(v);
1.550 +// if (v.valid()) G->/*getF*/first(in, v); else in=OldInEdgeIt();
1.551 +// while (in.valid() && !(Edge::free()>0) ) { ++in; }
1.552 // while (v.valid() && !in.valid()) {
1.553 // ++v;
1.554 -// if (v.valid()) G->getFirst(in, v);
1.555 -// while (in.valid() && !(EdgeIt::free()>0) ) { ++in; }
1.556 +// if (v.valid()) G->/*getF*/first(in, v);
1.557 +// while (in.valid() && !(Edge::free()>0) ) { ++in; }
1.558 // }
1.559 // }
1.560 // } else {
1.561 // ++in;
1.562 -// while (in.valid() && !(EdgeIt::free()>0) ) { ++in; }
1.563 +// while (in.valid() && !(Edge::free()>0) ) { ++in; }
1.564 // while (v.valid() && !in.valid()) {
1.565 // ++v;
1.566 -// if (v.valid()) G->getFirst(in, v);
1.567 -// while (in.valid() && !(EdgeIt::free()>0) ) { ++in; }
1.568 +// if (v.valid()) G->/*getF*/first(in, v);
1.569 +// while (in.valid() && !(Edge::free()>0) ) { ++in; }
1.570 // }
1.571 // }
1.572 // return *this;
1.573 // }
1.574 };
1.575
1.576 - EachNodeIt& getFirst(EachNodeIt& v) const { G->getFirst(v); }
1.577 - OutEdgeIt& getFirst(OutEdgeIt& e, NodeIt v) const {
1.578 + NodeIt& /*getF*/first(NodeIt& v) const { return graph->/*getF*/first(v); }
1.579 + OutEdgeIt& /*getF*/first(OutEdgeIt& e, Node v) const {
1.580 e=OutEdgeIt(*this, v);
1.581 + return e;
1.582 }
1.583 - EachEdgeIt& getFirst(EachEdgeIt& e) const {
1.584 - e=EachEdgeIt(*this);
1.585 + EdgeIt& /*getF*/first(EdgeIt& e) const {
1.586 + e=EdgeIt(*this);
1.587 + return e;
1.588 }
1.589
1.590 - EachNodeIt& next(EachNodeIt& n) const { return G->next(n); }
1.591 + NodeIt& next(NodeIt& n) const { return graph->next(n); }
1.592
1.593 OutEdgeIt& next(OutEdgeIt& e) const {
1.594 if (e.out_or_in) {
1.595 - NodeIt v=G->aNode(e.out);
1.596 - ++(e.out);
1.597 - while( G->valid(e.out) && !(free(e.out)>0) ) { ++(e.out); }
1.598 - if (!G->valid(e.out)) {
1.599 + Node v=graph->aNode(e.out);
1.600 + graph->next(e.out);
1.601 + while( graph->valid(e.out) && !(free(e.out)>0) ) { graph->next(e.out); }
1.602 + if (!graph->valid(e.out)) {
1.603 e.out_or_in=0;
1.604 - G->getFirst(e.in, v);
1.605 - while( G->valid(e.in) && !(free(e.in)>0) ) { ++(e.in); }
1.606 + graph->/*getF*/first(e.in, v);
1.607 + while( graph->valid(e.in) && !(free(e.in)>0) ) { graph->next(e.in); }
1.608 }
1.609 } else {
1.610 - ++(e.in);
1.611 - while( G->valid(e.in) && !(free(e.in)>0) ) { ++(e.in); }
1.612 + graph->next(e.in);
1.613 + while( graph->valid(e.in) && !(free(e.in)>0) ) { graph->next(e.in); }
1.614 }
1.615 return e;
1.616 }
1.617
1.618 - EachEdgeIt& next(EachEdgeIt& e) const {
1.619 + EdgeIt& next(EdgeIt& e) const {
1.620 if (e.out_or_in) {
1.621 - ++(e.out);
1.622 - while (G->valid(e.out) && !(free(e.out)>0) ) { ++(e.out); }
1.623 - while (G->valid(e.v) && !G->valid(e.out)) {
1.624 - ++(e.v);
1.625 - if (G->valid(e.v)) G->getFirst(e.out, e.v);
1.626 - while (G->valid(e.out) && !(free(e.out)>0) ) { ++(e.out); }
1.627 + graph->next(e.out);
1.628 + while (graph->valid(e.out) && !(free(e.out)>0) ) { graph->next(e.out); }
1.629 + while (graph->valid(e.v) && !graph->valid(e.out)) {
1.630 + graph->next(e.v);
1.631 + if (graph->valid(e.v)) graph->/*getF*/first(e.out, e.v);
1.632 + while (graph->valid(e.out) && !(free(e.out)>0) ) { graph->next(e.out); }
1.633 }
1.634 - if (!G->valid(e.out)) {
1.635 + if (!graph->valid(e.out)) {
1.636 e.out_or_in=0;
1.637 - G->getFirst(e.v);
1.638 - if (G->valid(e.v)) G->getFirst(e.in, e.v); else e.in=OldInEdgeIt();
1.639 - while (G->valid(e.in) && !(free(e.in)>0) ) { ++(e.in); }
1.640 - while (G->valid(e.v) && !G->valid(e.in)) {
1.641 - ++(e.v);
1.642 - if (G->valid(e.v)) G->getFirst(e.in, e.v);
1.643 - while (G->valid(e.in) && !(free(e.in)>0) ) { ++(e.in); }
1.644 + graph->/*getF*/first(e.v);
1.645 + if (graph->valid(e.v)) graph->/*getF*/first(e.in, e.v); else e.in=OldInEdgeIt(INVALID);
1.646 + while (graph->valid(e.in) && !(free(e.in)>0) ) { graph->next(e.in); }
1.647 + while (graph->valid(e.v) && !graph->valid(e.in)) {
1.648 + graph->next(e.v);
1.649 + if (graph->valid(e.v)) graph->/*getF*/first(e.in, e.v);
1.650 + while (graph->valid(e.in) && !(free(e.in)>0) ) { graph->next(e.in); }
1.651 }
1.652 }
1.653 } else {
1.654 - ++(e.in);
1.655 - while (G->valid(e.in) && !(free(e.in)>0) ) { ++(e.in); }
1.656 - while (G->valid(e.v) && !G->valid(e.in)) {
1.657 - ++(e.v);
1.658 - if (G->valid(e.v)) G->getFirst(e.in, e.v);
1.659 - while (G->valid(e.in) && !(free(e.in)>0) ) { ++(e.in); }
1.660 + graph->next(e.in);
1.661 + while (graph->valid(e.in) && !(free(e.in)>0) ) { graph->next(e.in); }
1.662 + while (graph->valid(e.v) && !graph->valid(e.in)) {
1.663 + graph->next(e.v);
1.664 + if (graph->valid(e.v)) graph->/*getF*/first(e.in, e.v);
1.665 + while (graph->valid(e.in) && !(free(e.in)>0) ) { graph->next(e.in); }
1.666 }
1.667 }
1.668 return e;
1.669 @@ -572,41 +604,41 @@
1.670 template< typename It >
1.671 It first() const {
1.672 It e;
1.673 - getFirst(e);
1.674 + /*getF*/first(e);
1.675 return e;
1.676 }
1.677
1.678 template< typename It >
1.679 - It first(NodeIt v) const {
1.680 + It first(Node v) const {
1.681 It e;
1.682 - getFirst(e, v);
1.683 + /*getF*/first(e, v);
1.684 return e;
1.685 }
1.686
1.687 - NodeIt tail(EdgeIt e) const {
1.688 - return ((e.out_or_in) ? G->aNode(e.out) : G->aNode(e.in)); }
1.689 - NodeIt head(EdgeIt e) const {
1.690 - return ((e.out_or_in) ? G->bNode(e.out) : G->bNode(e.in)); }
1.691 + Node tail(Edge e) const {
1.692 + return ((e.out_or_in) ? graph->aNode(e.out) : graph->aNode(e.in)); }
1.693 + Node head(Edge e) const {
1.694 + return ((e.out_or_in) ? graph->bNode(e.out) : graph->bNode(e.in)); }
1.695
1.696 - NodeIt aNode(OutEdgeIt e) const {
1.697 - return ((e.out_or_in) ? G->aNode(e.out) : G->aNode(e.in)); }
1.698 - NodeIt bNode(OutEdgeIt e) const {
1.699 - return ((e.out_or_in) ? G->bNode(e.out) : G->bNode(e.in)); }
1.700 + Node aNode(OutEdgeIt e) const {
1.701 + return ((e.out_or_in) ? graph->aNode(e.out) : graph->aNode(e.in)); }
1.702 + Node bNode(OutEdgeIt e) const {
1.703 + return ((e.out_or_in) ? graph->bNode(e.out) : graph->bNode(e.in)); }
1.704
1.705 - int id(NodeIt v) const { return G->id(v); }
1.706 + int id(Node v) const { return graph->id(v); }
1.707
1.708 - bool valid(NodeIt n) const { return G->valid(n); }
1.709 - bool valid(EdgeIt e) const {
1.710 - return e.out_or_in ? G->valid(e.out) : G->valid(e.in); }
1.711 + bool valid(Node n) const { return graph->valid(n); }
1.712 + bool valid(Edge e) const {
1.713 + return e.out_or_in ? graph->valid(e.out) : graph->valid(e.in); }
1.714
1.715 - void augment(const EdgeIt& e, Number a) const {
1.716 + void augment(const Edge& e, Number a) const {
1.717 if (e.out_or_in)
1.718 flow->set(e.out, flow->get(e.out)+a);
1.719 else
1.720 flow->set(e.in, flow->get(e.in)-a);
1.721 }
1.722
1.723 - Number free(const EdgeIt& e) const {
1.724 + Number free(const Edge& e) const {
1.725 if (e.out_or_in)
1.726 return (capacity->get(e.out)-flow->get(e.out));
1.727 else
1.728 @@ -633,10 +665,10 @@
1.729 // class NodeMap {
1.730 // typename Graph::NodeMap<T> node_map;
1.731 // public:
1.732 -// NodeMap(const ResGraphWrapper<Graph, Number, FlowMap, CapacityMap>& _G) : node_map(*(_G.G)) { }
1.733 -// NodeMap(const ResGraphWrapper<Graph, Number, FlowMap, CapacityMap>& _G, T a) : node_map(*(_G.G), a) { }
1.734 -// void set(NodeIt nit, T a) { node_map.set(nit, a); }
1.735 -// T get(NodeIt nit) const { return node_map.get(nit); }
1.736 +// NodeMap(const ResGraphWrapper<Graph, Number, FlowMap, CapacityMap>& _G) : node_map(*(_G.graph)) { }
1.737 +// NodeMap(const ResGraphWrapper<Graph, Number, FlowMap, CapacityMap>& _G, T a) : node_map(*(_G.graph), a) { }
1.738 +// void set(Node nit, T a) { node_map.set(nit, a); }
1.739 +// T get(Node nit) const { return node_map.get(nit); }
1.740 // };
1.741
1.742 template <typename T>
1.743 @@ -645,13 +677,13 @@
1.744 public:
1.745 EdgeMap(const ResGraphWrapper<Graph, Number, FlowMap, CapacityMap>& _G) : forward_map(_G.getGraph()), backward_map(_G.getGraph()) { }
1.746 EdgeMap(const ResGraphWrapper<Graph, Number, FlowMap, CapacityMap>& _G, T a) : forward_map(_G.getGraph(), a), backward_map(_G.getGraph(), a) { }
1.747 - void set(EdgeIt e, T a) {
1.748 + void set(Edge e, T a) {
1.749 if (e.out_or_in)
1.750 forward_map.set(e.out, a);
1.751 else
1.752 backward_map.set(e.in, a);
1.753 }
1.754 - T get(EdgeIt e) {
1.755 + T get(Edge e) {
1.756 if (e.out_or_in)
1.757 return forward_map.get(e.out);
1.758 else
1.759 @@ -670,9 +702,9 @@
1.760 const CapacityMap& _capacity) :
1.761 ResGraphWrapper<Graph, Number, FlowMap, CapacityMap>(_G, _flow, _capacity),
1.762 first_out_edges(*this) /*, dist(*this)*/ {
1.763 - for(EachNodeIt n=this->template first<EachNodeIt>(); this->valid(n); this->next(n)) {
1.764 + for(NodeIt n=this->template first<NodeIt>(); this->valid(n); this->next(n)) {
1.765 OutEdgeIt e;
1.766 - ResGraphWrapper<Graph, Number, FlowMap, CapacityMap>::getFirst(e, n);
1.767 + ResGraphWrapper<Graph, Number, FlowMap, CapacityMap>::/*getF*/first(e, n);
1.768 first_out_edges.set(n, e);
1.769 }
1.770 }
1.771 @@ -685,49 +717,49 @@
1.772
1.773 //typedef Graph BaseGraph;
1.774
1.775 + //typedef typename Graph::Node Node;
1.776 //typedef typename Graph::NodeIt NodeIt;
1.777 - //typedef typename Graph::EachNodeIt EachNodeIt;
1.778
1.779 - //typedef typename Graph::EdgeIt EdgeIt;
1.780 + //typedef typename Graph::Edge Edge;
1.781 //typedef typename Graph::OutEdgeIt OutEdgeIt;
1.782 //typedef typename Graph::InEdgeIt InEdgeIt;
1.783 //typedef typename Graph::SymEdgeIt SymEdgeIt;
1.784 - //typedef typename Graph::EachEdgeIt EachEdgeIt;
1.785 + //typedef typename Graph::EdgeIt EdgeIt;
1.786
1.787 + typedef typename ResGraphWrapper<Graph, Number, FlowMap, CapacityMap>::Node Node;
1.788 typedef typename ResGraphWrapper<Graph, Number, FlowMap, CapacityMap>::NodeIt NodeIt;
1.789 - typedef typename ResGraphWrapper<Graph, Number, FlowMap, CapacityMap>::EachNodeIt EachNodeIt;
1.790
1.791 - typedef typename ResGraphWrapper<Graph, Number, FlowMap, CapacityMap>::EdgeIt EdgeIt;
1.792 + typedef typename ResGraphWrapper<Graph, Number, FlowMap, CapacityMap>::Edge Edge;
1.793 typedef typename ResGraphWrapper<Graph, Number, FlowMap, CapacityMap>::OutEdgeIt OutEdgeIt;
1.794 //typedef typename ResGraphWrapper<Graph, Number, FlowMap, CapacityMap>::InEdgeIt InEdgeIt;
1.795 //typedef typename Graph::SymEdgeIt SymEdgeIt;
1.796 - //typedef typename ResGraphWrapper<Graph, Number, FlowMap, CapacityMap>::EachEdgeIt EachEdgeIt;
1.797 + //typedef typename ResGraphWrapper<Graph, Number, FlowMap, CapacityMap>::EdgeIt EdgeIt;
1.798
1.799 - EachNodeIt& getFirst(EachNodeIt& n) const {
1.800 - return ResGraphWrapper<Graph, Number, FlowMap, CapacityMap>::getFirst(n);
1.801 + NodeIt& /*getF*/first(NodeIt& n) const {
1.802 + return ResGraphWrapper<Graph, Number, FlowMap, CapacityMap>::/*getF*/first(n);
1.803 }
1.804
1.805 - OutEdgeIt& getFirst(OutEdgeIt& e, const NodeIt& n) const {
1.806 + OutEdgeIt& /*getF*/first(OutEdgeIt& e, const Node& n) const {
1.807 e=first_out_edges.get(n);
1.808 return e;
1.809 }
1.810
1.811 - //ROSSZ template<typename I> I& getFirst(I& i) const { return getFirst(i); }
1.812 - //ROSSZ template<typename I, typename P> I& getFirst(I& i, const P& p) const {
1.813 - // return getFirst(i, p); }
1.814 + //ROSSZ template<typename I> I& /*getF*/first(I& i) const { return /*getF*/first(i); }
1.815 + //ROSSZ template<typename I, typename P> I& /*getF*/first(I& i, const P& p) const {
1.816 + // return /*getF*/first(i, p); }
1.817
1.818 //template<typename I> I getNext(const I& i) const {
1.819 // return graph->getNext(i); }
1.820 //template<typename I> I& next(I &i) const { return graph->next(i); }
1.821
1.822 template< typename It > It first() const {
1.823 - It e; getFirst(e); return e; }
1.824 + It e; /*getF*/first(e); return e; }
1.825
1.826 - template< typename It > It first(const NodeIt& v) const {
1.827 - It e; getFirst(e, v); return e; }
1.828 + template< typename It > It first(const Node& v) const {
1.829 + It e; /*getF*/first(e, v); return e; }
1.830
1.831 - //NodeIt head(const EdgeIt& e) const { return graph->head(e); }
1.832 - //NodeIt tail(const EdgeIt& e) const { return graph->tail(e); }
1.833 + //Node head(const Edge& e) const { return graph->head(e); }
1.834 + //Node tail(const Edge& e) const { return graph->tail(e); }
1.835
1.836 //template<typename I> bool valid(const I& i) const
1.837 // { return graph->valid(i); }
1.838 @@ -735,19 +767,19 @@
1.839 //int nodeNum() const { return graph->nodeNum(); }
1.840 //int edgeNum() const { return graph->edgeNum(); }
1.841
1.842 - //template<typename I> NodeIt aNode(const I& e) const {
1.843 + //template<typename I> Node aNode(const I& e) const {
1.844 // return graph->aNode(e); }
1.845 - //template<typename I> NodeIt bNode(const I& e) const {
1.846 + //template<typename I> Node bNode(const I& e) const {
1.847 // return graph->bNode(e); }
1.848
1.849 - //NodeIt addNode() const { return graph->addNode(); }
1.850 - //EdgeIt addEdge(const NodeIt& tail, const NodeIt& head) const {
1.851 + //Node addNode() const { return graph->addNode(); }
1.852 + //Edge addEdge(const Node& tail, const Node& head) const {
1.853 // return graph->addEdge(tail, head); }
1.854
1.855 //void erase(const OutEdgeIt& e) {
1.856 // first_out_edge(this->tail(e))=e;
1.857 //}
1.858 - void erase(const EdgeIt& e) {
1.859 + void erase(const Edge& e) {
1.860 OutEdgeIt f(e);
1.861 next(f);
1.862 first_out_edges.set(this->tail(e), f);
1.863 @@ -785,14 +817,14 @@
1.864 public:
1.865 //typedef Graph BaseGraph;
1.866
1.867 + typedef typename ErasingResGraphWrapper<Graph, Number, FlowMap, CapacityMap>::Node Node;
1.868 typedef typename ErasingResGraphWrapper<Graph, Number, FlowMap, CapacityMap>::NodeIt NodeIt;
1.869 - typedef typename ErasingResGraphWrapper<Graph, Number, FlowMap, CapacityMap>::EachNodeIt EachNodeIt;
1.870
1.871 - typedef typename ErasingResGraphWrapper<Graph, Number, FlowMap, CapacityMap>::EdgeIt EdgeIt;
1.872 + typedef typename ErasingResGraphWrapper<Graph, Number, FlowMap, CapacityMap>::Edge Edge;
1.873 typedef typename ErasingResGraphWrapper<Graph, Number, FlowMap, CapacityMap>::OutEdgeIt OutEdgeIt;
1.874 //typedef typename ErasingResGraphWrapper<Graph, Number, FlowMap, CapacityMap>::InEdgeIt InEdgeIt;
1.875 //typedef typename Graph::SymEdgeIt SymEdgeIt;
1.876 - typedef typename ErasingResGraphWrapper<Graph, Number, FlowMap, CapacityMap>::EachEdgeIt EachEdgeIt;
1.877 + typedef typename ErasingResGraphWrapper<Graph, Number, FlowMap, CapacityMap>::EdgeIt EdgeIt;
1.878
1.879 //FilterGraphWrapper<Graph, Number, FlowMap, CapacityMap>::NodeMap<typename ResGraphWrapper<Graph, Number, FlowMap, CapacityMap>::OutEdgeIt> first_out_edges;
1.880
1.881 @@ -802,14 +834,14 @@
1.882 ErasingResGraphWrapper<Graph, Number, FlowMap, CapacityMap>(_G, _flow, _capacity), dist(*this) {
1.883 }
1.884
1.885 - OutEdgeIt& getFirst(OutEdgeIt& e, const NodeIt& n) const {
1.886 - ErasingResGraphWrapper<Graph, Number, FlowMap, CapacityMap>::getFirst(e, n);
1.887 + OutEdgeIt& /*getF*/first(OutEdgeIt& e, const Node& n) const {
1.888 + ErasingResGraphWrapper<Graph, Number, FlowMap, CapacityMap>::/*getF*/first(e, n);
1.889 while (valid(e) && (dist.get(tail(e))+1!=dist.get(head(e))))
1.890 ErasingResGraphWrapper<Graph, Number, FlowMap, CapacityMap>::next(e);
1.891 return e;
1.892 }
1.893
1.894 - EachNodeIt& next(EachNodeIt& e) const {
1.895 + NodeIt& next(NodeIt& e) const {
1.896 return ErasingResGraphWrapper<Graph, Number, FlowMap, CapacityMap>::next(e);
1.897 }
1.898
1.899 @@ -820,11 +852,11 @@
1.900 return e;
1.901 }
1.902
1.903 - EachNodeIt& getFirst(EachNodeIt& n) const {
1.904 - return ErasingResGraphWrapper<Graph, Number, FlowMap, CapacityMap>::getFirst(n);
1.905 + NodeIt& /*getF*/first(NodeIt& n) const {
1.906 + return ErasingResGraphWrapper<Graph, Number, FlowMap, CapacityMap>::/*getF*/first(n);
1.907 }
1.908
1.909 - void erase(const EdgeIt& e) {
1.910 + void erase(const Edge& e) {
1.911 OutEdgeIt f(e);
1.912 ErasingResGraphWrapper<Graph, Number, FlowMap, CapacityMap>::next(f);
1.913 while (valid(f) && (dist.get(tail(f))+1!=dist.get(head(f))))
1.914 @@ -838,22 +870,22 @@
1.915 //void setGraph(Graph& _graph) { graph = &_graph; }
1.916 //Graph& getGraph() const { return (*graph); }
1.917
1.918 - //template<typename I> I& getFirst(I& i) const { return graph->getFirst(i); }
1.919 - //template<typename I, typename P> I& getFirst(I& i, const P& p) const {
1.920 - // return graph->getFirst(i, p); }
1.921 + //template<typename I> I& /*getF*/first(I& i) const { return graph->/*getF*/first(i); }
1.922 + //template<typename I, typename P> I& /*getF*/first(I& i, const P& p) const {
1.923 + // return graph->/*getF*/first(i, p); }
1.924
1.925 //template<typename I> I getNext(const I& i) const {
1.926 // return graph->getNext(i); }
1.927 //template<typename I> I& next(I &i) const { return graph->next(i); }
1.928
1.929 template< typename It > It first() const {
1.930 - It e; getFirst(e); return e; }
1.931 + It e; /*getF*/first(e); return e; }
1.932
1.933 - template< typename It > It first(const NodeIt& v) const {
1.934 - It e; getFirst(e, v); return e; }
1.935 + template< typename It > It first(const Node& v) const {
1.936 + It e; /*getF*/first(e, v); return e; }
1.937
1.938 - //NodeIt head(const EdgeIt& e) const { return graph->head(e); }
1.939 - //NodeIt tail(const EdgeIt& e) const { return graph->tail(e); }
1.940 + //Node head(const Edge& e) const { return graph->head(e); }
1.941 + //Node tail(const Edge& e) const { return graph->tail(e); }
1.942
1.943 //template<typename I> bool valid(const I& i) const
1.944 // { return graph->valid(i); }
1.945 @@ -864,13 +896,13 @@
1.946 //int nodeNum() const { return graph->nodeNum(); }
1.947 //int edgeNum() const { return graph->edgeNum(); }
1.948
1.949 - //template<typename I> NodeIt aNode(const I& e) const {
1.950 + //template<typename I> Node aNode(const I& e) const {
1.951 // return graph->aNode(e); }
1.952 - //template<typename I> NodeIt bNode(const I& e) const {
1.953 + //template<typename I> Node bNode(const I& e) const {
1.954 // return graph->bNode(e); }
1.955
1.956 - //NodeIt addNode() const { return graph->addNode(); }
1.957 - //EdgeIt addEdge(const NodeIt& tail, const NodeIt& head) const {
1.958 + //Node addNode() const { return graph->addNode(); }
1.959 + //Edge addEdge(const Node& tail, const Node& head) const {
1.960 // return graph->addEdge(tail, head); }
1.961
1.962 //template<typename I> void erase(const I& i) const { graph->erase(i); }
1.963 @@ -909,45 +941,45 @@
1.964 // public:
1.965 // typedef Graph BaseGraph;
1.966
1.967 +// typedef typename Graph::Node Node;
1.968 +// typedef typename Graph::Edge Edge;
1.969 +
1.970 // typedef typename Graph::NodeIt NodeIt;
1.971 -// typedef typename Graph::EdgeIt EdgeIt;
1.972 -
1.973 -// typedef typename Graph::EachNodeIt EachNodeIt;
1.974
1.975 // class OutEdgeIt {
1.976 // public:
1.977 -// //Graph::NodeIt n;
1.978 +// //Graph::Node n;
1.979 // bool out_or_in;
1.980 // typename Graph::OutEdgeIt o;
1.981 // typename Graph::InEdgeIt i;
1.982 // };
1.983 // class InEdgeIt {
1.984 // public:
1.985 -// //Graph::NodeIt n;
1.986 +// //Graph::Node n;
1.987 // bool out_or_in;
1.988 // typename Graph::OutEdgeIt o;
1.989 // typename Graph::InEdgeIt i;
1.990 // };
1.991 // typedef typename Graph::SymEdgeIt SymEdgeIt;
1.992 -// typedef typename Graph::EachEdgeIt EachEdgeIt;
1.993 +// typedef typename Graph::EdgeIt EdgeIt;
1.994
1.995 // int nodeNum() const { return graph->nodeNum(); }
1.996 // int edgeNum() const { return graph->edgeNum(); }
1.997
1.998 -// NodeIt& getFirst(NodeIt& n) const { return graph->getFirst(n); }
1.999 +// Node& /*getF*/first(Node& n) const { return graph->/*getF*/first(n); }
1.1000
1.1001 -// // EachEdge and SymEdge is missing!!!!
1.1002 -// // EdgeIt <-> In/OutEdgeIt conversion is missing!!!!
1.1003 +// // Edge and SymEdge is missing!!!!
1.1004 +// // Edge <-> In/OutEdgeIt conversion is missing!!!!
1.1005
1.1006 // //FIXME
1.1007 -// OutEdgeIt& getFirst(OutEdgeIt& e, const NodeIt& n) const
1.1008 +// OutEdgeIt& /*getF*/first(OutEdgeIt& e, const Node& n) const
1.1009 // {
1.1010 // e.n=n;
1.1011 -// graph->getFirst(e.o,n);
1.1012 +// graph->/*getF*/first(e.o,n);
1.1013 // while(graph->valid(e.o) && fmap.get(e.o)>=himap.get(e.o))
1.1014 // graph->goNext(e.o);
1.1015 // if(!graph->valid(e.o)) {
1.1016 -// graph->getFirst(e.i,n);
1.1017 +// graph->/*getF*/first(e.i,n);
1.1018 // while(graph->valid(e.i) && fmap.get(e.i)<=lomap.get(e.i))
1.1019 // graph->goNext(e.i);
1.1020 // }
1.1021 @@ -960,7 +992,7 @@
1.1022 // while(graph->valid(e.o) && fmap.get(e.o)>=himap.get(e.o))
1.1023 // graph->goNext(e.o);
1.1024 // if(graph->valid(e.o)) return e;
1.1025 -// else graph->getFirst(e.i,e.n);
1.1026 +// else graph->/*getF*/first(e.i,e.n);
1.1027 // }
1.1028 // else {
1.1029 // while(graph->valid(e.i) && fmap.get(e.i)<=lomap.get(e.i))
1.1030 @@ -973,14 +1005,14 @@
1.1031 // //bool valid(const OutEdgeIt e) { return graph->valid(e.o)||graph->valid(e.i);}
1.1032
1.1033 // //FIXME
1.1034 -// InEdgeIt& getFirst(InEdgeIt& e, const NodeIt& n) const
1.1035 +// InEdgeIt& /*getF*/first(InEdgeIt& e, const Node& n) const
1.1036 // {
1.1037 // e.n=n;
1.1038 -// graph->getFirst(e.i,n);
1.1039 +// graph->/*getF*/first(e.i,n);
1.1040 // while(graph->valid(e.i) && fmap.get(e.i)>=himap.get(e.i))
1.1041 // graph->goNext(e.i);
1.1042 // if(!graph->valid(e.i)) {
1.1043 -// graph->getFirst(e.o,n);
1.1044 +// graph->/*getF*/first(e.o,n);
1.1045 // while(graph->valid(e.o) && fmap.get(e.o)<=lomap.get(e.o))
1.1046 // graph->goNext(e.o);
1.1047 // }
1.1048 @@ -993,7 +1025,7 @@
1.1049 // while(graph->valid(e.i) && fmap.get(e.i)>=himap.get(e.i))
1.1050 // graph->goNext(e.i);
1.1051 // if(graph->valid(e.i)) return e;
1.1052 -// else graph->getFirst(e.o,e.n);
1.1053 +// else graph->/*getF*/first(e.o,e.n);
1.1054 // }
1.1055 // else {
1.1056 // while(graph->valid(e.o) && fmap.get(e.o)<=lomap.get(e.o))
1.1057 @@ -1009,17 +1041,17 @@
1.1058 // //template<typename I> I next(const I i); { return graph->goNext(i); }
1.1059
1.1060 // template< typename It > It first() const {
1.1061 -// It e; getFirst(e); return e; }
1.1062 +// It e; /*getF*/first(e); return e; }
1.1063
1.1064 -// template< typename It > It first(NodeIt v) const {
1.1065 -// It e; getFirst(e, v); return e; }
1.1066 +// template< typename It > It first(Node v) const {
1.1067 +// It e; /*getF*/first(e, v); return e; }
1.1068
1.1069 -// NodeIt head(const EdgeIt& e) const { return graph->head(e); }
1.1070 -// NodeIt tail(const EdgeIt& e) const { return graph->tail(e); }
1.1071 +// Node head(const Edge& e) const { return graph->head(e); }
1.1072 +// Node tail(const Edge& e) const { return graph->tail(e); }
1.1073
1.1074 -// template<typename I> NodeIt aNode(const I& e) const {
1.1075 +// template<typename I> Node aNode(const I& e) const {
1.1076 // return graph->aNode(e); }
1.1077 -// template<typename I> NodeIt bNode(const I& e) const {
1.1078 +// template<typename I> Node bNode(const I& e) const {
1.1079 // return graph->bNode(e); }
1.1080
1.1081 // //template<typename I> bool valid(const I i);
1.1082 @@ -1028,8 +1060,8 @@
1.1083 // //template<typename I> void setInvalid(const I &i);
1.1084 // //{ return graph->setInvalid(i); }
1.1085
1.1086 -// NodeIt addNode() { return graph->addNode(); }
1.1087 -// EdgeIt addEdge(const NodeIt& tail, const NodeIt& head) {
1.1088 +// Node addNode() { return graph->addNode(); }
1.1089 +// Edge addEdge(const Node& tail, const Node& head) {
1.1090 // return graph->addEdge(tail, head); }
1.1091
1.1092 // template<typename I> void erase(const I& i) { graph->erase(i); }