diff -r 259ea2d741a2 -r 0fc9cd9b854a src/work/jacint/preflowproba.h --- a/src/work/jacint/preflowproba.h Thu Apr 22 14:50:24 2004 +0000 +++ b/src/work/jacint/preflowproba.h Thu Apr 22 15:56:05 2004 +0000 @@ -70,6 +70,7 @@ FlowMap& flow; T value; bool constzero; + bool res; typedef ResGraphWrapper ResGW; typedef typename ResGW::OutEdgeIt ResOutEdgeIt; @@ -78,8 +79,8 @@ public: Preflow(Graph& _G, Node _s, Node _t, CapMap& _capacity, - FlowMap& _flow, bool _constzero ) : - G(_G), s(_s), t(_t), capacity(_capacity), flow(_flow), constzero(_constzero) {} + FlowMap& _flow, bool _constzero, bool _res ) : + G(_G), s(_s), t(_t), capacity(_capacity), flow(_flow), constzero(_constzero), res(_res) {} void run() { @@ -302,46 +303,49 @@ bfs_queue.pop(); int l=level[v]+1; - /* ResInEdgeIt e; - for(res_graph.first(e,s); res_graph.valid(e); - res_graph.next(e)) { - Node u=res_graph.tail(e); - if ( level[u] >= n ) { - bfs_queue.push(u); - level.set(u, l); - if ( excess[u] > 0 ) { - next.set(u,active[l]); - active[l]=u; + if (res){ + ResInEdgeIt e; + for(res_graph.first(e,v); res_graph.valid(e); + res_graph.next(e)) { + Node u=res_graph.tail(e); + if ( level[u] >= n ) { + bfs_queue.push(u); + level.set(u, l); + if ( excess[u] > 0 ) { + next.set(u,active[l]); + active[l]=u; + } } } - }*/ - InEdgeIt e; - for(G.first(e,v); G.valid(e); G.next(e)) { - if ( capacity[e] == flow[e] ) continue; - Node u=G.tail(e); - if ( level[u] >= n ) { - bfs_queue.push(u); - level.set(u, l); - if ( excess[u] > 0 ) { - next.set(u,active[l]); - active[l]=u; + } else { + InEdgeIt e; + for(G.first(e,v); G.valid(e); G.next(e)) { + if ( capacity[e] == flow[e] ) continue; + Node u=G.tail(e); + if ( level[u] >= n ) { + bfs_queue.push(u); + level.set(u, l); + if ( excess[u] > 0 ) { + next.set(u,active[l]); + active[l]=u; + } + } + } + + OutEdgeIt f; + for(G.first(f,v); G.valid(f); G.next(f)) { + if ( 0 == flow[f] ) continue; + Node u=G.head(f); + if ( level[u] >= n ) { + bfs_queue.push(u); + level.set(u, l); + if ( excess[u] > 0 ) { + next.set(u,active[l]); + active[l]=u; + } } } } - - OutEdgeIt f; - for(G.first(f,v); G.valid(f); G.next(f)) { - if ( 0 == flow[f] ) continue; - Node u=G.head(f); - if ( level[u] >= n ) { - bfs_queue.push(u); - level.set(u, l); - if ( excess[u] > 0 ) { - next.set(u,active[l]); - active[l]=u; - } - } - } } b=n-2; }