Changeset 986:e997802b855c in lemon-0.x for src/work/athos/preflow_push_wogw.h
- Timestamp:
- 11/13/04 13:53:28 (19 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/athos/preflow_push_wogw.h
r921 r986 140 140 //This private procedure is supposed to modify the preflow on edge j 141 141 //by value v (which can be positive or negative as well) 142 //and maintain the excess on the head and tail142 //and maintain the excess on the target and source 143 143 //Here we do not check whether this is possible or not 144 144 void modify_preflow(Edge j, const T& v){ … … 148 148 149 149 150 //Modifiyng the head151 modify_excess(G. head(j),v);152 153 //Modifiyng the tail154 modify_excess(G. tail(j),-v);150 //Modifiyng the target 151 modify_excess(G.target(j),v); 152 153 //Modifiyng the source 154 modify_excess(G.source(j),-v); 155 155 156 156 } … … 273 273 InEdgeIt e; 274 274 for(G.first(e,v); G.valid(e); G.next(e)) { 275 Node w=G. tail(e);275 Node w=G.source(e); 276 276 if ( level[w] == number_of_nodes && w != s ) { 277 277 bfs_queue.push(w); … … 311 311 for(OutEdgeIt j=G.template first<OutEdgeIt>(s); G.valid(j); G.next(j)){ 312 312 modify_preflow(j,capacity[j] ); 313 make_active(G. head(j));314 int lev=level[G. head(j)];313 make_active(G.target(j)); 314 int lev=level[G.target(j)]; 315 315 if(highest_active<lev){ 316 316 highest_active=lev; … … 326 326 327 327 if (capacity[j]>preflow[j]){ 328 if(level[G. tail(j)]==level[G.head(j)]+1){328 if(level[G.source(j)]==level[G.target(j)]+1){ 329 329 return true; 330 330 } 331 331 else{ 332 if (level[G. head(j)] < new_level)333 new_level=level[G. head(j)];332 if (level[G.target(j)] < new_level) 333 new_level=level[G.target(j)]; 334 334 } 335 335 } … … 342 342 343 343 if (0<preflow[j]){ 344 if(level[G. tail(j)]==level[G.head(j)]-1){344 if(level[G.source(j)]==level[G.target(j)]-1){ 345 345 346 346 return true; 347 347 } 348 348 else{ 349 if (level[G. tail(j)] < new_level)350 new_level=level[G. tail(j)];349 if (level[G.source(j)] < new_level) 350 new_level=level[G.source(j)]; 351 351 } 352 352 … … 389 389 e -= v; 390 390 //New node might become active 391 if (excess[G. head(j)]==0){392 make_active(G. head(j));391 if (excess[G.target(j)]==0){ 392 make_active(G.target(j)); 393 393 } 394 394 modify_preflow(j,v); … … 405 405 e -= v; 406 406 //New node might become active 407 if (excess[G. tail(j)]==0){408 make_active(G. tail(j));407 if (excess[G.source(j)]==0){ 408 make_active(G.source(j)); 409 409 } 410 410 modify_preflow(j,-v);
Note: See TracChangeset
for help on using the changeset viewer.