1.1 --- a/lemon/preflow.h Sat Apr 18 21:54:30 2009 +0200
1.2 +++ b/lemon/preflow.h Tue Apr 21 10:34:49 2009 +0100
1.3 @@ -404,7 +404,7 @@
1.4
1.5 _phase = true;
1.6 for (NodeIt n(_graph); n != INVALID; ++n) {
1.7 - _excess->set(n, 0);
1.8 + (*_excess)[n] = 0;
1.9 }
1.10
1.11 for (ArcIt e(_graph); e != INVALID; ++e) {
1.12 @@ -417,10 +417,10 @@
1.13 _level->initAddItem(_target);
1.14
1.15 std::vector<Node> queue;
1.16 - reached.set(_source, true);
1.17 + reached[_source] = true;
1.18
1.19 queue.push_back(_target);
1.20 - reached.set(_target, true);
1.21 + reached[_target] = true;
1.22 while (!queue.empty()) {
1.23 _level->initNewLevel();
1.24 std::vector<Node> nqueue;
1.25 @@ -429,7 +429,7 @@
1.26 for (InArcIt e(_graph, n); e != INVALID; ++e) {
1.27 Node u = _graph.source(e);
1.28 if (!reached[u] && _tolerance.positive((*_capacity)[e])) {
1.29 - reached.set(u, true);
1.30 + reached[u] = true;
1.31 _level->initAddItem(u);
1.32 nqueue.push_back(u);
1.33 }
1.34 @@ -444,7 +444,7 @@
1.35 Node u = _graph.target(e);
1.36 if ((*_level)[u] == _level->maxLevel()) continue;
1.37 _flow->set(e, (*_capacity)[e]);
1.38 - _excess->set(u, (*_excess)[u] + (*_capacity)[e]);
1.39 + (*_excess)[u] += (*_capacity)[e];
1.40 if (u != _target && !_level->active(u)) {
1.41 _level->activate(u);
1.42 }
1.43 @@ -478,7 +478,7 @@
1.44 excess -= (*_flow)[e];
1.45 }
1.46 if (excess < 0 && n != _source) return false;
1.47 - _excess->set(n, excess);
1.48 + (*_excess)[n] = excess;
1.49 }
1.50
1.51 typename Digraph::template NodeMap<bool> reached(_graph, false);
1.52 @@ -487,10 +487,10 @@
1.53 _level->initAddItem(_target);
1.54
1.55 std::vector<Node> queue;
1.56 - reached.set(_source, true);
1.57 + reached[_source] = true;
1.58
1.59 queue.push_back(_target);
1.60 - reached.set(_target, true);
1.61 + reached[_target] = true;
1.62 while (!queue.empty()) {
1.63 _level->initNewLevel();
1.64 std::vector<Node> nqueue;
1.65 @@ -500,7 +500,7 @@
1.66 Node u = _graph.source(e);
1.67 if (!reached[u] &&
1.68 _tolerance.positive((*_capacity)[e] - (*_flow)[e])) {
1.69 - reached.set(u, true);
1.70 + reached[u] = true;
1.71 _level->initAddItem(u);
1.72 nqueue.push_back(u);
1.73 }
1.74 @@ -508,7 +508,7 @@
1.75 for (OutArcIt e(_graph, n); e != INVALID; ++e) {
1.76 Node v = _graph.target(e);
1.77 if (!reached[v] && _tolerance.positive((*_flow)[e])) {
1.78 - reached.set(v, true);
1.79 + reached[v] = true;
1.80 _level->initAddItem(v);
1.81 nqueue.push_back(v);
1.82 }
1.83 @@ -524,7 +524,7 @@
1.84 Node u = _graph.target(e);
1.85 if ((*_level)[u] == _level->maxLevel()) continue;
1.86 _flow->set(e, (*_capacity)[e]);
1.87 - _excess->set(u, (*_excess)[u] + rem);
1.88 + (*_excess)[u] += rem;
1.89 if (u != _target && !_level->active(u)) {
1.90 _level->activate(u);
1.91 }
1.92 @@ -536,7 +536,7 @@
1.93 Node v = _graph.source(e);
1.94 if ((*_level)[v] == _level->maxLevel()) continue;
1.95 _flow->set(e, 0);
1.96 - _excess->set(v, (*_excess)[v] + rem);
1.97 + (*_excess)[v] += rem;
1.98 if (v != _target && !_level->active(v)) {
1.99 _level->activate(v);
1.100 }
1.101 @@ -577,12 +577,12 @@
1.102 }
1.103 if (!_tolerance.less(rem, excess)) {
1.104 _flow->set(e, (*_flow)[e] + excess);
1.105 - _excess->set(v, (*_excess)[v] + excess);
1.106 + (*_excess)[v] += excess;
1.107 excess = 0;
1.108 goto no_more_push_1;
1.109 } else {
1.110 excess -= rem;
1.111 - _excess->set(v, (*_excess)[v] + rem);
1.112 + (*_excess)[v] += rem;
1.113 _flow->set(e, (*_capacity)[e]);
1.114 }
1.115 } else if (new_level > (*_level)[v]) {
1.116 @@ -600,12 +600,12 @@
1.117 }
1.118 if (!_tolerance.less(rem, excess)) {
1.119 _flow->set(e, (*_flow)[e] - excess);
1.120 - _excess->set(v, (*_excess)[v] + excess);
1.121 + (*_excess)[v] += excess;
1.122 excess = 0;
1.123 goto no_more_push_1;
1.124 } else {
1.125 excess -= rem;
1.126 - _excess->set(v, (*_excess)[v] + rem);
1.127 + (*_excess)[v] += rem;
1.128 _flow->set(e, 0);
1.129 }
1.130 } else if (new_level > (*_level)[v]) {
1.131 @@ -615,7 +615,7 @@
1.132
1.133 no_more_push_1:
1.134
1.135 - _excess->set(n, excess);
1.136 + (*_excess)[n] = excess;
1.137
1.138 if (excess != 0) {
1.139 if (new_level + 1 < _level->maxLevel()) {
1.140 @@ -650,12 +650,12 @@
1.141 }
1.142 if (!_tolerance.less(rem, excess)) {
1.143 _flow->set(e, (*_flow)[e] + excess);
1.144 - _excess->set(v, (*_excess)[v] + excess);
1.145 + (*_excess)[v] += excess;
1.146 excess = 0;
1.147 goto no_more_push_2;
1.148 } else {
1.149 excess -= rem;
1.150 - _excess->set(v, (*_excess)[v] + rem);
1.151 + (*_excess)[v] += rem;
1.152 _flow->set(e, (*_capacity)[e]);
1.153 }
1.154 } else if (new_level > (*_level)[v]) {
1.155 @@ -673,12 +673,12 @@
1.156 }
1.157 if (!_tolerance.less(rem, excess)) {
1.158 _flow->set(e, (*_flow)[e] - excess);
1.159 - _excess->set(v, (*_excess)[v] + excess);
1.160 + (*_excess)[v] += excess;
1.161 excess = 0;
1.162 goto no_more_push_2;
1.163 } else {
1.164 excess -= rem;
1.165 - _excess->set(v, (*_excess)[v] + rem);
1.166 + (*_excess)[v] += rem;
1.167 _flow->set(e, 0);
1.168 }
1.169 } else if (new_level > (*_level)[v]) {
1.170 @@ -688,7 +688,7 @@
1.171
1.172 no_more_push_2:
1.173
1.174 - _excess->set(n, excess);
1.175 + (*_excess)[n] = excess;
1.176
1.177 if (excess != 0) {
1.178 if (new_level + 1 < _level->maxLevel()) {
1.179 @@ -731,7 +731,7 @@
1.180
1.181 typename Digraph::template NodeMap<bool> reached(_graph);
1.182 for (NodeIt n(_graph); n != INVALID; ++n) {
1.183 - reached.set(n, (*_level)[n] < _level->maxLevel());
1.184 + reached[n] = (*_level)[n] < _level->maxLevel();
1.185 }
1.186
1.187 _level->initStart();
1.188 @@ -739,7 +739,7 @@
1.189
1.190 std::vector<Node> queue;
1.191 queue.push_back(_source);
1.192 - reached.set(_source, true);
1.193 + reached[_source] = true;
1.194
1.195 while (!queue.empty()) {
1.196 _level->initNewLevel();
1.197 @@ -749,7 +749,7 @@
1.198 for (OutArcIt e(_graph, n); e != INVALID; ++e) {
1.199 Node v = _graph.target(e);
1.200 if (!reached[v] && _tolerance.positive((*_flow)[e])) {
1.201 - reached.set(v, true);
1.202 + reached[v] = true;
1.203 _level->initAddItem(v);
1.204 nqueue.push_back(v);
1.205 }
1.206 @@ -758,7 +758,7 @@
1.207 Node u = _graph.source(e);
1.208 if (!reached[u] &&
1.209 _tolerance.positive((*_capacity)[e] - (*_flow)[e])) {
1.210 - reached.set(u, true);
1.211 + reached[u] = true;
1.212 _level->initAddItem(u);
1.213 nqueue.push_back(u);
1.214 }
1.215 @@ -792,12 +792,12 @@
1.216 }
1.217 if (!_tolerance.less(rem, excess)) {
1.218 _flow->set(e, (*_flow)[e] + excess);
1.219 - _excess->set(v, (*_excess)[v] + excess);
1.220 + (*_excess)[v] += excess;
1.221 excess = 0;
1.222 goto no_more_push;
1.223 } else {
1.224 excess -= rem;
1.225 - _excess->set(v, (*_excess)[v] + rem);
1.226 + (*_excess)[v] += rem;
1.227 _flow->set(e, (*_capacity)[e]);
1.228 }
1.229 } else if (new_level > (*_level)[v]) {
1.230 @@ -815,12 +815,12 @@
1.231 }
1.232 if (!_tolerance.less(rem, excess)) {
1.233 _flow->set(e, (*_flow)[e] - excess);
1.234 - _excess->set(v, (*_excess)[v] + excess);
1.235 + (*_excess)[v] += excess;
1.236 excess = 0;
1.237 goto no_more_push;
1.238 } else {
1.239 excess -= rem;
1.240 - _excess->set(v, (*_excess)[v] + rem);
1.241 + (*_excess)[v] += rem;
1.242 _flow->set(e, 0);
1.243 }
1.244 } else if (new_level > (*_level)[v]) {
1.245 @@ -830,7 +830,7 @@
1.246
1.247 no_more_push:
1.248
1.249 - _excess->set(n, excess);
1.250 + (*_excess)[n] = excess;
1.251
1.252 if (excess != 0) {
1.253 if (new_level + 1 < _level->maxLevel()) {