1.1 --- a/lemon/bits/edge_set_extender.h Fri Aug 09 11:07:27 2013 +0200
1.2 +++ b/lemon/bits/edge_set_extender.h Sun Aug 11 15:28:12 2013 +0200
1.3 @@ -1,8 +1,8 @@
1.4 -/* -*- C++ -*-
1.5 +/* -*- mode: C++; indent-tabs-mode: nil; -*-
1.6 *
1.7 - * This file is a part of LEMON, a generic C++ optimization library
1.8 + * This file is a part of LEMON, a generic C++ optimization library.
1.9 *
1.10 - * Copyright (C) 2003-2008
1.11 + * Copyright (C) 2003-2010
1.12 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
1.13 * (Egervary Research Group on Combinatorial Optimization, EGRES).
1.14 *
1.15 @@ -63,11 +63,11 @@
1.16
1.17 Node oppositeNode(const Node &n, const Arc &e) const {
1.18 if (n == Parent::source(e))
1.19 - return Parent::target(e);
1.20 + return Parent::target(e);
1.21 else if(n==Parent::target(e))
1.22 - return Parent::source(e);
1.23 + return Parent::source(e);
1.24 else
1.25 - return INVALID;
1.26 + return INVALID;
1.27 }
1.28
1.29
1.30 @@ -91,7 +91,7 @@
1.31
1.32 // Iterable extensions
1.33
1.34 - class NodeIt : public Node {
1.35 + class NodeIt : public Node {
1.36 const Digraph* digraph;
1.37 public:
1.38
1.39 @@ -100,21 +100,21 @@
1.40 NodeIt(Invalid i) : Node(i) { }
1.41
1.42 explicit NodeIt(const Digraph& _graph) : digraph(&_graph) {
1.43 - _graph.first(static_cast<Node&>(*this));
1.44 + _graph.first(static_cast<Node&>(*this));
1.45 }
1.46
1.47 - NodeIt(const Digraph& _graph, const Node& node)
1.48 - : Node(node), digraph(&_graph) {}
1.49 + NodeIt(const Digraph& _graph, const Node& node)
1.50 + : Node(node), digraph(&_graph) {}
1.51
1.52 - NodeIt& operator++() {
1.53 - digraph->next(*this);
1.54 - return *this;
1.55 + NodeIt& operator++() {
1.56 + digraph->next(*this);
1.57 + return *this;
1.58 }
1.59
1.60 };
1.61
1.62
1.63 - class ArcIt : public Arc {
1.64 + class ArcIt : public Arc {
1.65 const Digraph* digraph;
1.66 public:
1.67
1.68 @@ -123,21 +123,21 @@
1.69 ArcIt(Invalid i) : Arc(i) { }
1.70
1.71 explicit ArcIt(const Digraph& _graph) : digraph(&_graph) {
1.72 - _graph.first(static_cast<Arc&>(*this));
1.73 + _graph.first(static_cast<Arc&>(*this));
1.74 }
1.75
1.76 - ArcIt(const Digraph& _graph, const Arc& e) :
1.77 - Arc(e), digraph(&_graph) { }
1.78 + ArcIt(const Digraph& _graph, const Arc& e) :
1.79 + Arc(e), digraph(&_graph) { }
1.80
1.81 - ArcIt& operator++() {
1.82 - digraph->next(*this);
1.83 - return *this;
1.84 + ArcIt& operator++() {
1.85 + digraph->next(*this);
1.86 + return *this;
1.87 }
1.88
1.89 };
1.90
1.91
1.92 - class OutArcIt : public Arc {
1.93 + class OutArcIt : public Arc {
1.94 const Digraph* digraph;
1.95 public:
1.96
1.97 @@ -145,23 +145,23 @@
1.98
1.99 OutArcIt(Invalid i) : Arc(i) { }
1.100
1.101 - OutArcIt(const Digraph& _graph, const Node& node)
1.102 - : digraph(&_graph) {
1.103 - _graph.firstOut(*this, node);
1.104 + OutArcIt(const Digraph& _graph, const Node& node)
1.105 + : digraph(&_graph) {
1.106 + _graph.firstOut(*this, node);
1.107 }
1.108
1.109 - OutArcIt(const Digraph& _graph, const Arc& arc)
1.110 - : Arc(arc), digraph(&_graph) {}
1.111 + OutArcIt(const Digraph& _graph, const Arc& arc)
1.112 + : Arc(arc), digraph(&_graph) {}
1.113
1.114 - OutArcIt& operator++() {
1.115 - digraph->nextOut(*this);
1.116 - return *this;
1.117 + OutArcIt& operator++() {
1.118 + digraph->nextOut(*this);
1.119 + return *this;
1.120 }
1.121
1.122 };
1.123
1.124
1.125 - class InArcIt : public Arc {
1.126 + class InArcIt : public Arc {
1.127 const Digraph* digraph;
1.128 public:
1.129
1.130 @@ -169,17 +169,17 @@
1.131
1.132 InArcIt(Invalid i) : Arc(i) { }
1.133
1.134 - InArcIt(const Digraph& _graph, const Node& node)
1.135 - : digraph(&_graph) {
1.136 - _graph.firstIn(*this, node);
1.137 + InArcIt(const Digraph& _graph, const Node& node)
1.138 + : digraph(&_graph) {
1.139 + _graph.firstIn(*this, node);
1.140 }
1.141
1.142 - InArcIt(const Digraph& _graph, const Arc& arc) :
1.143 - Arc(arc), digraph(&_graph) {}
1.144 + InArcIt(const Digraph& _graph, const Arc& arc) :
1.145 + Arc(arc), digraph(&_graph) {}
1.146
1.147 - InArcIt& operator++() {
1.148 - digraph->nextIn(*this);
1.149 - return *this;
1.150 + InArcIt& operator++() {
1.151 + digraph->nextIn(*this);
1.152 + return *this;
1.153 }
1.154
1.155 };
1.156 @@ -215,26 +215,26 @@
1.157 using Parent::first;
1.158
1.159 // Mappable extension
1.160 -
1.161 +
1.162 template <typename _Value>
1.163 - class ArcMap
1.164 + class ArcMap
1.165 : public MapExtender<DefaultMap<Digraph, Arc, _Value> > {
1.166 typedef MapExtender<DefaultMap<Digraph, Arc, _Value> > Parent;
1.167
1.168 public:
1.169 - explicit ArcMap(const Digraph& _g)
1.170 - : Parent(_g) {}
1.171 - ArcMap(const Digraph& _g, const _Value& _v)
1.172 - : Parent(_g, _v) {}
1.173 + explicit ArcMap(const Digraph& _g)
1.174 + : Parent(_g) {}
1.175 + ArcMap(const Digraph& _g, const _Value& _v)
1.176 + : Parent(_g, _v) {}
1.177
1.178 ArcMap& operator=(const ArcMap& cmap) {
1.179 - return operator=<ArcMap>(cmap);
1.180 + return operator=<ArcMap>(cmap);
1.181 }
1.182
1.183 template <typename CMap>
1.184 ArcMap& operator=(const CMap& cmap) {
1.185 Parent::operator=(cmap);
1.186 - return *this;
1.187 + return *this;
1.188 }
1.189
1.190 };
1.191 @@ -247,7 +247,7 @@
1.192 notifier(Arc()).add(arc);
1.193 return arc;
1.194 }
1.195 -
1.196 +
1.197 void clear() {
1.198 notifier(Arc()).clear();
1.199 Parent::clear();
1.200 @@ -312,11 +312,11 @@
1.201
1.202 Node oppositeNode(const Node &n, const Edge &e) const {
1.203 if( n == Parent::u(e))
1.204 - return Parent::v(e);
1.205 + return Parent::v(e);
1.206 else if( n == Parent::v(e))
1.207 - return Parent::u(e);
1.208 + return Parent::u(e);
1.209 else
1.210 - return INVALID;
1.211 + return INVALID;
1.212 }
1.213
1.214 Arc oppositeArc(const Arc &e) const {
1.215 @@ -340,7 +340,7 @@
1.216 public:
1.217
1.218 using Parent::notifier;
1.219 -
1.220 +
1.221 ArcNotifier& notifier(Arc) const {
1.222 return arc_notifier;
1.223 }
1.224 @@ -350,7 +350,7 @@
1.225 }
1.226
1.227
1.228 - class NodeIt : public Node {
1.229 + class NodeIt : public Node {
1.230 const Graph* graph;
1.231 public:
1.232
1.233 @@ -359,21 +359,21 @@
1.234 NodeIt(Invalid i) : Node(i) { }
1.235
1.236 explicit NodeIt(const Graph& _graph) : graph(&_graph) {
1.237 - _graph.first(static_cast<Node&>(*this));
1.238 + _graph.first(static_cast<Node&>(*this));
1.239 }
1.240
1.241 - NodeIt(const Graph& _graph, const Node& node)
1.242 - : Node(node), graph(&_graph) {}
1.243 + NodeIt(const Graph& _graph, const Node& node)
1.244 + : Node(node), graph(&_graph) {}
1.245
1.246 - NodeIt& operator++() {
1.247 - graph->next(*this);
1.248 - return *this;
1.249 + NodeIt& operator++() {
1.250 + graph->next(*this);
1.251 + return *this;
1.252 }
1.253
1.254 };
1.255
1.256
1.257 - class ArcIt : public Arc {
1.258 + class ArcIt : public Arc {
1.259 const Graph* graph;
1.260 public:
1.261
1.262 @@ -382,21 +382,21 @@
1.263 ArcIt(Invalid i) : Arc(i) { }
1.264
1.265 explicit ArcIt(const Graph& _graph) : graph(&_graph) {
1.266 - _graph.first(static_cast<Arc&>(*this));
1.267 + _graph.first(static_cast<Arc&>(*this));
1.268 }
1.269
1.270 - ArcIt(const Graph& _graph, const Arc& e) :
1.271 - Arc(e), graph(&_graph) { }
1.272 + ArcIt(const Graph& _graph, const Arc& e) :
1.273 + Arc(e), graph(&_graph) { }
1.274
1.275 - ArcIt& operator++() {
1.276 - graph->next(*this);
1.277 - return *this;
1.278 + ArcIt& operator++() {
1.279 + graph->next(*this);
1.280 + return *this;
1.281 }
1.282
1.283 };
1.284
1.285
1.286 - class OutArcIt : public Arc {
1.287 + class OutArcIt : public Arc {
1.288 const Graph* graph;
1.289 public:
1.290
1.291 @@ -404,23 +404,23 @@
1.292
1.293 OutArcIt(Invalid i) : Arc(i) { }
1.294
1.295 - OutArcIt(const Graph& _graph, const Node& node)
1.296 - : graph(&_graph) {
1.297 - _graph.firstOut(*this, node);
1.298 + OutArcIt(const Graph& _graph, const Node& node)
1.299 + : graph(&_graph) {
1.300 + _graph.firstOut(*this, node);
1.301 }
1.302
1.303 - OutArcIt(const Graph& _graph, const Arc& arc)
1.304 - : Arc(arc), graph(&_graph) {}
1.305 + OutArcIt(const Graph& _graph, const Arc& arc)
1.306 + : Arc(arc), graph(&_graph) {}
1.307
1.308 - OutArcIt& operator++() {
1.309 - graph->nextOut(*this);
1.310 - return *this;
1.311 + OutArcIt& operator++() {
1.312 + graph->nextOut(*this);
1.313 + return *this;
1.314 }
1.315
1.316 };
1.317
1.318
1.319 - class InArcIt : public Arc {
1.320 + class InArcIt : public Arc {
1.321 const Graph* graph;
1.322 public:
1.323
1.324 @@ -428,23 +428,23 @@
1.325
1.326 InArcIt(Invalid i) : Arc(i) { }
1.327
1.328 - InArcIt(const Graph& _graph, const Node& node)
1.329 - : graph(&_graph) {
1.330 - _graph.firstIn(*this, node);
1.331 + InArcIt(const Graph& _graph, const Node& node)
1.332 + : graph(&_graph) {
1.333 + _graph.firstIn(*this, node);
1.334 }
1.335
1.336 - InArcIt(const Graph& _graph, const Arc& arc) :
1.337 - Arc(arc), graph(&_graph) {}
1.338 + InArcIt(const Graph& _graph, const Arc& arc) :
1.339 + Arc(arc), graph(&_graph) {}
1.340
1.341 - InArcIt& operator++() {
1.342 - graph->nextIn(*this);
1.343 - return *this;
1.344 + InArcIt& operator++() {
1.345 + graph->nextIn(*this);
1.346 + return *this;
1.347 }
1.348
1.349 };
1.350
1.351
1.352 - class EdgeIt : public Parent::Edge {
1.353 + class EdgeIt : public Parent::Edge {
1.354 const Graph* graph;
1.355 public:
1.356
1.357 @@ -453,15 +453,15 @@
1.358 EdgeIt(Invalid i) : Edge(i) { }
1.359
1.360 explicit EdgeIt(const Graph& _graph) : graph(&_graph) {
1.361 - _graph.first(static_cast<Edge&>(*this));
1.362 + _graph.first(static_cast<Edge&>(*this));
1.363 }
1.364
1.365 - EdgeIt(const Graph& _graph, const Edge& e) :
1.366 - Edge(e), graph(&_graph) { }
1.367 + EdgeIt(const Graph& _graph, const Edge& e) :
1.368 + Edge(e), graph(&_graph) { }
1.369
1.370 - EdgeIt& operator++() {
1.371 - graph->next(*this);
1.372 - return *this;
1.373 + EdgeIt& operator++() {
1.374 + graph->next(*this);
1.375 + return *this;
1.376 }
1.377
1.378 };
1.379 @@ -477,17 +477,17 @@
1.380 IncEdgeIt(Invalid i) : Edge(i), direction(false) { }
1.381
1.382 IncEdgeIt(const Graph& _graph, const Node &n) : graph(&_graph) {
1.383 - _graph.firstInc(*this, direction, n);
1.384 + _graph.firstInc(*this, direction, n);
1.385 }
1.386
1.387 IncEdgeIt(const Graph& _graph, const Edge &ue, const Node &n)
1.388 - : graph(&_graph), Edge(ue) {
1.389 - direction = (_graph.source(ue) == n);
1.390 + : graph(&_graph), Edge(ue) {
1.391 + direction = (_graph.source(ue) == n);
1.392 }
1.393
1.394 IncEdgeIt& operator++() {
1.395 - graph->nextInc(*this, direction);
1.396 - return *this;
1.397 + graph->nextInc(*this, direction);
1.398 + return *this;
1.399 }
1.400 };
1.401
1.402 @@ -534,49 +534,49 @@
1.403
1.404
1.405 template <typename _Value>
1.406 - class ArcMap
1.407 + class ArcMap
1.408 : public MapExtender<DefaultMap<Graph, Arc, _Value> > {
1.409 typedef MapExtender<DefaultMap<Graph, Arc, _Value> > Parent;
1.410
1.411 public:
1.412 - explicit ArcMap(const Graph& _g)
1.413 - : Parent(_g) {}
1.414 - ArcMap(const Graph& _g, const _Value& _v)
1.415 - : Parent(_g, _v) {}
1.416 + explicit ArcMap(const Graph& _g)
1.417 + : Parent(_g) {}
1.418 + ArcMap(const Graph& _g, const _Value& _v)
1.419 + : Parent(_g, _v) {}
1.420
1.421 ArcMap& operator=(const ArcMap& cmap) {
1.422 - return operator=<ArcMap>(cmap);
1.423 + return operator=<ArcMap>(cmap);
1.424 }
1.425
1.426 template <typename CMap>
1.427 ArcMap& operator=(const CMap& cmap) {
1.428 Parent::operator=(cmap);
1.429 - return *this;
1.430 + return *this;
1.431 }
1.432
1.433 };
1.434
1.435
1.436 template <typename _Value>
1.437 - class EdgeMap
1.438 + class EdgeMap
1.439 : public MapExtender<DefaultMap<Graph, Edge, _Value> > {
1.440 typedef MapExtender<DefaultMap<Graph, Edge, _Value> > Parent;
1.441
1.442 public:
1.443 - explicit EdgeMap(const Graph& _g)
1.444 - : Parent(_g) {}
1.445 + explicit EdgeMap(const Graph& _g)
1.446 + : Parent(_g) {}
1.447
1.448 - EdgeMap(const Graph& _g, const _Value& _v)
1.449 - : Parent(_g, _v) {}
1.450 + EdgeMap(const Graph& _g, const _Value& _v)
1.451 + : Parent(_g, _v) {}
1.452
1.453 EdgeMap& operator=(const EdgeMap& cmap) {
1.454 - return operator=<EdgeMap>(cmap);
1.455 + return operator=<EdgeMap>(cmap);
1.456 }
1.457
1.458 template <typename CMap>
1.459 EdgeMap& operator=(const CMap& cmap) {
1.460 Parent::operator=(cmap);
1.461 - return *this;
1.462 + return *this;
1.463 }
1.464
1.465 };
1.466 @@ -593,7 +593,7 @@
1.467 notifier(Arc()).add(arcs);
1.468 return edge;
1.469 }
1.470 -
1.471 +
1.472 void clear() {
1.473 notifier(Arc()).clear();
1.474 notifier(Edge()).clear();
1.475 @@ -619,7 +619,7 @@
1.476 edge_notifier.clear();
1.477 arc_notifier.clear();
1.478 }
1.479 -
1.480 +
1.481 };
1.482
1.483 }