Changeset 775:e46a1f0623a0 in lemon0.x for src/work/marci/augmenting_flow.h
 Timestamp:
 08/31/04 13:26:59 (20 years ago)
 Branch:
 default
 Phase:
 public
 Convert:
 svn:c9d7d8f590d60310b91f818b3a526b0e/lemon/trunk@1068
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

src/work/marci/augmenting_flow.h
r762 r775 1021 1021 case AFTER_AUGMENTING: 1022 1022 // std::cout << "AFTER_AUGMENTING" << std::endl; 1023 for(g>first(v); g>valid(v); g>next(v)) {1023 for(g>first(v); v!=INVALID; ++v) { 1024 1024 if (level[v]) { 1025 1025 M.set(v, true); … … 1031 1031 case AFTER_FAST_AUGMENTING: 1032 1032 // std::cout << "AFTER_FAST_AUGMENTING" << std::endl; 1033 for(g>first(v); g>valid(v); g>next(v)) {1033 for(g>first(v); v!=INVALID; ++v) { 1034 1034 if (level[v]==number_of_augmentations) { 1035 1035 M.set(v, true); … … 1054 1054 1055 1055 OutEdgeIt e; 1056 for(g>first(e,w) ; g>valid(e); g>next(e)) {1056 for(g>first(e,w) ; e!=INVALID; ++e) { 1057 1057 Node v=g>head(e); 1058 1058 if (!M[v] && (*flow)[e] < (*capacity)[e] ) { … … 1063 1063 1064 1064 InEdgeIt f; 1065 for(g>first(f,w) ; g>valid(f); g>next(f)) {1065 for(g>first(f,w) ; f!=INVALID; ++f) { 1066 1066 Node v=g>tail(f); 1067 1067 if (!M[v] && (*flow)[f] > 0 ) { … … 1134 1134 while ( !bfs.finished() ) { 1135 1135 ResGWOutEdgeIt e=bfs; 1136 if ( res_graph.valid(e)&& bfs.isBNodeNewlyReached()) {1136 if (e!=INVALID && bfs.isBNodeNewlyReached()) { 1137 1137 Node v=res_graph.tail(e); 1138 1138 Node w=res_graph.head(e); 1139 1139 pred.set(w, e); 1140 if ( res_graph.valid(pred[v])) {1140 if (pred[v]!=INVALID) { 1141 1141 free.set(w, std::min(free[v], res_graph.resCap(e))); 1142 1142 } else { … … 1152 1152 Node n=t; 1153 1153 Num augment_value=free[t]; 1154 while ( res_graph.valid(pred[n])) {1154 while (pred[n]!=INVALID) { 1155 1155 ResGWEdge e=pred[n]; 1156 1156 res_graph.augment(e, augment_value); … … 1191 1191 while ( !bfs.finished() ) { 1192 1192 ResGWOutEdgeIt e=bfs; 1193 if ( res_graph.valid(e)&& bfs.isBNodeNewlyReached()) {1193 if (e!=INVALID && bfs.isBNodeNewlyReached()) { 1194 1194 Node v=res_graph.tail(e); 1195 1195 Node w=res_graph.head(e); 1196 1196 pred.set(w, e); 1197 if ( res_graph.valid(pred[v])) {1197 if (pred[v]!=INVALID) { 1198 1198 free.set(w, std::min(free[v], res_graph.resCap(e))); 1199 1199 } else { … … 1209 1209 Node n=t; 1210 1210 Num augment_value=free[t]; 1211 while ( res_graph.valid(pred[n])) {1211 while (pred[n]!=INVALID) { 1212 1212 ResGWEdge e=pred[n]; 1213 1213 res_graph.augment(e, augment_value); … … 1245 1245 { 1246 1246 typename ResGW::NodeIt n; 1247 for(res_graph.first(n); res_graph.valid(n); res_graph.next(n)) {1247 for(res_graph.first(n); n!=INVALID; ++n) { 1248 1248 res_graph_to_F.set(n, F.addNode()); 1249 1249 } … … 1257 1257 while ( !bfs.finished() ) { 1258 1258 ResGWOutEdgeIt e=bfs; 1259 if ( res_graph.valid(e)) {1259 if (e!=INVALID) { 1260 1260 if (bfs.isBNodeNewlyReached()) { 1261 1261 dist.set(res_graph.head(e), dist[res_graph.tail(e)]+1); … … 1300 1300 typename MG::Node w=F.bNode(dfs); 1301 1301 pred.set(w, dfs); 1302 if ( F.valid(pred[v])) {1302 if (pred[v]!=INVALID) { 1303 1303 free.set(w, std::min(free[v], residual_capacity[dfs])); 1304 1304 } else { … … 1320 1320 typename MG::Node n=tF; 1321 1321 Num augment_value=free[tF]; 1322 while ( F.valid(pred[n])) {1322 while (pred[n]!=INVALID) { 1323 1323 typename MG::Edge e=pred[n]; 1324 1324 res_graph.augment(original_edge[e], augment_value); … … 1338 1338 1339 1339 1340 1341 1342 1340 template <typename Graph, typename Num, typename CapMap, typename FlowMap> 1343 1341 bool AugmentingFlow<Graph, Num, CapMap, FlowMap>::augmentOnBlockingFlow2() … … 1355 1353 while ( !bfs.finished() ) { 1356 1354 ResGWOutEdgeIt e=bfs; 1357 if ( res_graph.valid(e)&& bfs.isBNodeNewlyReached()) {1355 if (e!=INVALID && bfs.isBNodeNewlyReached()) { 1358 1356 dist.set(res_graph.head(e), dist[res_graph.tail(e)]+1); 1359 1357 } … … 1372 1370 first_out_edges(filter_res_graph); 1373 1371 typename FilterResGW::NodeIt v; 1374 for(filter_res_graph.first(v); filter_res_graph.valid(v); 1375 filter_res_graph.next(v)) 1372 for(filter_res_graph.first(v); v!=INVALID; ++v) 1376 1373 { 1377 1374 typename FilterResGW::OutEdgeIt e; … … 1419 1416 1420 1417 pred.set(w, /*typename ErasingResGW::OutEdgeIt*/(dfs)); 1421 if ( erasing_res_graph.valid(pred[v])) {1418 if (pred[v]!=INVALID) { 1422 1419 free1.set 1423 1420 (w, std::min(free1[v], res_graph.resCap
Note: See TracChangeset
for help on using the changeset viewer.