1.1 --- a/src/work/jacint/preflowproba.h Thu Apr 22 14:50:24 2004 +0000
1.2 +++ b/src/work/jacint/preflowproba.h Thu Apr 22 15:56:05 2004 +0000
1.3 @@ -70,6 +70,7 @@
1.4 FlowMap& flow;
1.5 T value;
1.6 bool constzero;
1.7 + bool res;
1.8
1.9 typedef ResGraphWrapper<const Graph, T, CapMap, FlowMap> ResGW;
1.10 typedef typename ResGW::OutEdgeIt ResOutEdgeIt;
1.11 @@ -78,8 +79,8 @@
1.12
1.13 public:
1.14 Preflow(Graph& _G, Node _s, Node _t, CapMap& _capacity,
1.15 - FlowMap& _flow, bool _constzero ) :
1.16 - G(_G), s(_s), t(_t), capacity(_capacity), flow(_flow), constzero(_constzero) {}
1.17 + FlowMap& _flow, bool _constzero, bool _res ) :
1.18 + G(_G), s(_s), t(_t), capacity(_capacity), flow(_flow), constzero(_constzero), res(_res) {}
1.19
1.20
1.21 void run() {
1.22 @@ -302,46 +303,49 @@
1.23 bfs_queue.pop();
1.24 int l=level[v]+1;
1.25
1.26 - /* ResInEdgeIt e;
1.27 - for(res_graph.first(e,s); res_graph.valid(e);
1.28 - res_graph.next(e)) {
1.29 - Node u=res_graph.tail(e);
1.30 - if ( level[u] >= n ) {
1.31 - bfs_queue.push(u);
1.32 - level.set(u, l);
1.33 - if ( excess[u] > 0 ) {
1.34 - next.set(u,active[l]);
1.35 - active[l]=u;
1.36 + if (res){
1.37 + ResInEdgeIt e;
1.38 + for(res_graph.first(e,v); res_graph.valid(e);
1.39 + res_graph.next(e)) {
1.40 + Node u=res_graph.tail(e);
1.41 + if ( level[u] >= n ) {
1.42 + bfs_queue.push(u);
1.43 + level.set(u, l);
1.44 + if ( excess[u] > 0 ) {
1.45 + next.set(u,active[l]);
1.46 + active[l]=u;
1.47 + }
1.48 }
1.49 }
1.50 - }*/
1.51 - InEdgeIt e;
1.52 - for(G.first(e,v); G.valid(e); G.next(e)) {
1.53 - if ( capacity[e] == flow[e] ) continue;
1.54 - Node u=G.tail(e);
1.55 - if ( level[u] >= n ) {
1.56 - bfs_queue.push(u);
1.57 - level.set(u, l);
1.58 - if ( excess[u] > 0 ) {
1.59 - next.set(u,active[l]);
1.60 - active[l]=u;
1.61 + } else {
1.62 + InEdgeIt e;
1.63 + for(G.first(e,v); G.valid(e); G.next(e)) {
1.64 + if ( capacity[e] == flow[e] ) continue;
1.65 + Node u=G.tail(e);
1.66 + if ( level[u] >= n ) {
1.67 + bfs_queue.push(u);
1.68 + level.set(u, l);
1.69 + if ( excess[u] > 0 ) {
1.70 + next.set(u,active[l]);
1.71 + active[l]=u;
1.72 + }
1.73 + }
1.74 + }
1.75 +
1.76 + OutEdgeIt f;
1.77 + for(G.first(f,v); G.valid(f); G.next(f)) {
1.78 + if ( 0 == flow[f] ) continue;
1.79 + Node u=G.head(f);
1.80 + if ( level[u] >= n ) {
1.81 + bfs_queue.push(u);
1.82 + level.set(u, l);
1.83 + if ( excess[u] > 0 ) {
1.84 + next.set(u,active[l]);
1.85 + active[l]=u;
1.86 + }
1.87 }
1.88 }
1.89 }
1.90 -
1.91 - OutEdgeIt f;
1.92 - for(G.first(f,v); G.valid(f); G.next(f)) {
1.93 - if ( 0 == flow[f] ) continue;
1.94 - Node u=G.head(f);
1.95 - if ( level[u] >= n ) {
1.96 - bfs_queue.push(u);
1.97 - level.set(u, l);
1.98 - if ( excess[u] > 0 ) {
1.99 - next.set(u,active[l]);
1.100 - active[l]=u;
1.101 - }
1.102 - }
1.103 - }
1.104 }
1.105 b=n-2;
1.106 }