Changeset 986:e997802b855c in lemon-0.x for src/work/jacint/max_save.h
- Timestamp:
- 11/13/04 13:53:28 (20 years ago)
- Branch:
- default
- Phase:
- public
- Convert:
- svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@1376
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/work/jacint/max_save.h
r921 r986 259 259 OutEdgeIt e; 260 260 for(g->first(e,w) ; g->valid(e); g->next(e)) { 261 Node v=g-> head(e);261 Node v=g->target(e); 262 262 if (!M[v] && (*flow)[e] < (*capacity)[e] ) { 263 263 queue.push(v); … … 268 268 InEdgeIt f; 269 269 for(g->first(f,w) ; g->valid(f); g->next(f)) { 270 Node v=g-> tail(f);270 Node v=g->source(f); 271 271 if (!M[v] && (*flow)[f] > 0 ) { 272 272 queue.push(v); … … 305 305 InEdgeIt e; 306 306 for(g->first(e,w) ; g->valid(e); g->next(e)) { 307 Node v=g-> tail(e);307 Node v=g->source(e); 308 308 if (M[v] && (*flow)[e] < (*capacity)[e] ) { 309 309 queue.push(v); … … 314 314 OutEdgeIt f; 315 315 for(g->first(f,w) ; g->valid(f); g->next(f)) { 316 Node v=g-> head(f);316 Node v=g->target(f); 317 317 if (M[v] && (*flow)[f] > 0 ) { 318 318 queue.push(v); … … 370 370 371 371 if ( (*flow)[e] >= (*capacity)[e] ) continue; 372 Node v=g-> head(e);372 Node v=g->target(e); 373 373 374 374 if( lev > level[v] ) { //Push is allowed now … … 403 403 404 404 if( (*flow)[e] <= 0 ) continue; 405 Node v=g-> tail(e);405 Node v=g->source(e); 406 406 407 407 if( lev > level[v] ) { //Push is allowed now … … 457 457 InEdgeIt e; 458 458 for(g->first(e,v); g->valid(e); g->next(e)) { 459 Node w=g-> tail(e);459 Node w=g->source(e); 460 460 if ( level[w] == n && w != s ) { 461 461 bfs_queue.push(w); … … 475 475 Num c=(*capacity)[e]; 476 476 if ( c <= 0 ) continue; 477 Node w=g-> head(e);477 Node w=g->target(e); 478 478 if ( level[w] < n ) { 479 479 if ( excess[w] <= 0 && w!=t ) active[level[w]].push(w); … … 502 502 for(g->first(e,v); g->valid(e); g->next(e)) { 503 503 if ( (*capacity)[e] <= (*flow)[e] ) continue; 504 Node w=g-> tail(e);504 Node w=g->source(e); 505 505 if ( level[w] == n && w != s ) { 506 506 bfs_queue.push(w); … … 516 516 for(g->first(f,v); g->valid(f); g->next(f)) { 517 517 if ( 0 >= (*flow)[f] ) continue; 518 Node w=g-> head(f);518 Node w=g->target(f); 519 519 if ( level[w] == n && w != s ) { 520 520 bfs_queue.push(w); … … 535 535 Num rem=(*capacity)[e]-(*flow)[e]; 536 536 if ( rem <= 0 ) continue; 537 Node w=g-> head(e);537 Node w=g->target(e); 538 538 if ( level[w] < n ) { 539 539 if ( excess[w] <= 0 && w!=t ) active[level[w]].push(w); … … 547 547 { 548 548 if ( (*flow)[f] <= 0 ) continue; 549 Node w=g-> tail(f);549 Node w=g->source(f); 550 550 if ( level[w] < n ) { 551 551 if ( excess[w] <= 0 && w!=t ) active[level[w]].push(w); … … 645 645 // return dist[n]; } 646 646 // bool get(const typename MapGraphWrapper::Edge& e) const { 647 // return (dist.get(g-> tail(e))<dist.get(g->head(e))); }647 // return (dist.get(g->source(e))<dist.get(g->target(e))); } 648 648 bool operator[](const typename MapGraphWrapper::Edge& e) const { 649 return (dist[g-> tail(e)]<dist[g->head(e)]);649 return (dist[g->source(e)]<dist[g->target(e)]); 650 650 } 651 651 }; … … 784 784 for(g->first(e,v); g->valid(e); g->next(e)) { 785 785 if ( (*capacity)[e] <= (*flow)[e] ) continue; 786 Node u=g-> tail(e);786 Node u=g->source(e); 787 787 if ( level[u] >= n ) { 788 788 bfs_queue.push(u); … … 795 795 for(g->first(f,v); g->valid(f); g->next(f)) { 796 796 if ( 0 >= (*flow)[f] ) continue; 797 Node u=g-> head(f);797 Node u=g->target(f); 798 798 if ( level[u] >= n ) { 799 799 bfs_queue.push(u); … … 847 847 ResGWOutEdgeIt e=bfs; 848 848 if (res_graph.valid(e) && bfs.isBNodeNewlyReached()) { 849 Node v=res_graph. tail(e);850 Node w=res_graph. head(e);849 Node v=res_graph.source(e); 850 Node w=res_graph.target(e); 851 851 pred.set(w, e); 852 852 if (res_graph.valid(pred[v])) { … … 855 855 free.set(w, res_graph.resCap(e)); 856 856 } 857 if (res_graph. head(e)==t) { _augment=true; break; }857 if (res_graph.target(e)==t) { _augment=true; break; } 858 858 } 859 859 … … 867 867 ResGWEdge e=pred[n]; 868 868 res_graph.augment(e, augment_value); 869 n=res_graph. tail(e);869 n=res_graph.source(e); 870 870 } 871 871 } … … 920 920 if (res_graph.valid(e)) { 921 921 if (bfs.isBNodeNewlyReached()) { 922 dist.set(res_graph. head(e), dist[res_graph.tail(e)]+1);923 typename MG::Edge f=F.addEdge(res_graph_to_F[res_graph. tail(e)], res_graph_to_F[res_graph.head(e)]);922 dist.set(res_graph.target(e), dist[res_graph.source(e)]+1); 923 typename MG::Edge f=F.addEdge(res_graph_to_F[res_graph.source(e)], res_graph_to_F[res_graph.target(e)]); 924 924 original_edge.update(); 925 925 original_edge.set(f, e); … … 927 927 residual_capacity.set(f, res_graph.resCap(e)); 928 928 } else { 929 if (dist[res_graph. head(e)]==(dist[res_graph.tail(e)]+1)) {930 typename MG::Edge f=F.addEdge(res_graph_to_F[res_graph. tail(e)], res_graph_to_F[res_graph.head(e)]);929 if (dist[res_graph.target(e)]==(dist[res_graph.source(e)]+1)) { 930 typename MG::Edge f=F.addEdge(res_graph_to_F[res_graph.source(e)], res_graph_to_F[res_graph.target(e)]); 931 931 original_edge.update(); 932 932 original_edge.set(f, e); … … 982 982 typename MG::Edge e=pred[n]; 983 983 res_graph.augment(original_edge[e], augment_value); 984 n=F. tail(e);984 n=F.source(e); 985 985 if (residual_capacity[e]==augment_value) 986 986 F.erase(e); … … 1016 1016 ResGWOutEdgeIt e=bfs; 1017 1017 if (res_graph.valid(e) && bfs.isBNodeNewlyReached()) { 1018 dist.set(res_graph. head(e), dist[res_graph.tail(e)]+1);1018 dist.set(res_graph.target(e), dist[res_graph.source(e)]+1); 1019 1019 } 1020 1020 ++bfs; … … 1113 1113 typename ErasingResGW::OutEdgeIt e=pred[n]; 1114 1114 res_graph.augment(e, augment_value); 1115 n=erasing_res_graph. tail(e);1115 n=erasing_res_graph.source(e); 1116 1116 if (res_graph.resCap(e)==0) 1117 1117 erasing_res_graph.erase(e);
Note: See TracChangeset
for help on using the changeset viewer.