Some modifications and another testfile.
7 list 'level_list' on the nodes on level i implemented by hand
8 stack 'active' on the active nodes on level i
9 runs heuristic 'highest label' for H1*n relabels
10 runs heuristic 'bound decrease' for H0*n relabels, starts with 'highest label'
12 Parameters H0 and H1 are initialized to 20 and 1.
16 Preflow(Graph, Node, Node, CapMap, FlowMap, bool) : bool must be false if
17 FlowMap is not constant zero, and should be true if it is
23 Num flowValue() : returns the value of a maximum flow
25 void minMinCut(CutMap& M) : sets M to the characteristic vector of the
26 minimum min cut. M should be a map of bools initialized to false. ??Is it OK?
28 void maxMinCut(CutMap& M) : sets M to the characteristic vector of the
29 maximum min cut. M should be a map of bools initialized to false.
31 void minCut(CutMap& M) : sets M to the characteristic vector of
32 a min cut. M should be a map of bools initialized to false.
36 #ifndef HUGO_MAX_FLOW_H
37 #define HUGO_MAX_FLOW_H
46 #include <hugo/graph_wrapper.h>
48 #include <hugo/invalid.h>
49 #include <hugo/maps.h>
50 #include <for_each_macros.h>
53 /// \brief Dimacs file format reader.
58 // ///\author Marton Makai, Jacint Szabo
59 /// A class for computing max flows and related quantities.
60 template <typename Graph, typename Num,
61 typename CapMap=typename Graph::template EdgeMap<Num>,
62 typename FlowMap=typename Graph::template EdgeMap<Num> >
65 typedef typename Graph::Node Node;
66 typedef typename Graph::NodeIt NodeIt;
67 typedef typename Graph::OutEdgeIt OutEdgeIt;
68 typedef typename Graph::InEdgeIt InEdgeIt;
70 typedef typename std::vector<std::stack<Node> > VecStack;
71 typedef typename Graph::template NodeMap<Node> NNMap;
72 typedef typename std::vector<Node> VecNode;
77 const CapMap* capacity;
79 int n; //the number of nodes of G
80 typedef ResGraphWrapper<const Graph, Num, CapMap, FlowMap> ResGW;
81 typedef typename ResGW::OutEdgeIt ResGWOutEdgeIt;
82 typedef typename ResGW::Edge ResGWEdge;
83 //typedef typename ResGW::template NodeMap<bool> ReachedMap;
84 typedef typename Graph::template NodeMap<int> ReachedMap;
86 //level works as a bool map in augmenting path algorithms
87 //and is used by bfs for storing reached information.
88 //In preflow, it shows levels of nodes.
89 //typename Graph::template NodeMap<int> level;
90 typename Graph::template NodeMap<Num> excess;
93 // void set(const Graph& _G, Node _s, Node _t, const CapMap& _capacity,
99 // capacity=&_capacity;
102 // level.set (_G); //kellene vmi ilyesmi fv
103 // excess(_G,0); //itt is
108 ///\todo Document this.
109 ///\todo Maybe, it should be PRE_FLOW instead.
110 ///- \c ZERO_FLOW means something,
111 ///- \c GEN_FLOW means something else,
112 ///- \c PREFLOW is something different.
119 MaxFlow(const Graph& _G, Node _s, Node _t, const CapMap& _capacity,
121 g(&_G), s(_s), t(_t), capacity(&_capacity),
122 flow(&_flow), n(_G.nodeNum()), level(_G), excess(_G,0) {}
124 /// A max flow algorithm is run.
125 ///\pre the flow have to be 0 at the beginning.
130 /// A preflow algorithm is run.
131 ///\pre The initial edge-map have to be a
132 /// zero flow if \c fe is \c ZERO_FLOW,
133 /// a flow if \c fe is \c GEN_FLOW,
134 /// and a pre-flow it is \c PREFLOW.
135 void preflow(flowEnum fe) {
140 /// Run the first phase of preflow, starting from a 0 flow, from a flow,
141 /// or from a preflow, according to \c fe.
142 void preflowPhase0( flowEnum fe );
144 /// Second phase of preflow.
145 void preflowPhase1();
147 /// Starting from a flow, this method searches for an augmenting path
148 /// according to the Edmonds-Karp algorithm
149 /// and augments the flow on if any.
150 /// The return value shows if the augmentation was succesful.
151 bool augmentOnShortestPath();
153 /// Starting from a flow, this method searches for an augmenting blockin
154 /// flow according to Dinits' algorithm and augments the flow on if any.
155 /// The blocking flow is computed in a physically constructed
156 /// residual graph of type \c Mutablegraph.
157 /// The return value show sif the augmentation was succesful.
158 template<typename MutableGraph> bool augmentOnBlockingFlow();
160 /// The same as \c augmentOnBlockingFlow<MutableGraph> but the
161 /// residual graph is not constructed physically.
162 /// The return value shows if the augmentation was succesful.
163 bool augmentOnBlockingFlow2();
165 /// Returns the actual flow value.
166 /// More precisely, it returns the negative excess of s, thus
167 /// this works also for preflows.
170 FOR_EACH_INC_LOC(OutEdgeIt, e, *g, s) a+=(*flow)[e];
171 FOR_EACH_INC_LOC(InEdgeIt, e, *g, s) a-=(*flow)[e];
175 /// Should be used between preflowPhase0 and preflowPhase1.
176 ///\todo We have to make some status variable which shows the actual state
177 /// of the class. This enables us to determine which methods are valid
178 /// for MinCut computation
179 template<typename _CutMap>
180 void actMinCut(_CutMap& M) {
182 for(g->first(v); g->valid(v); g->next(v)) {
183 if ( level[v] < n ) {
191 /// The unique inclusionwise minimum cut is computed by
192 /// processing a bfs from s in the residual graph.
193 ///\pre flow have to be a max flow otherwise it will the whole node-set.
194 template<typename _CutMap>
195 void minMinCut(_CutMap& M) {
197 std::queue<Node> queue;
202 while (!queue.empty()) {
203 Node w=queue.front();
207 for(g->first(e,w) ; g->valid(e); g->next(e)) {
209 if (!M[v] && (*flow)[e] < (*capacity)[e] ) {
216 for(g->first(f,w) ; g->valid(f); g->next(f)) {
218 if (!M[v] && (*flow)[f] > 0 ) {
227 /// The unique inclusionwise maximum cut is computed by
228 /// processing a reverse bfs from t in the residual graph.
229 ///\pre flow have to be a max flow otherwise it will be empty.
230 template<typename _CutMap>
231 void maxMinCut(_CutMap& M) {
234 for(g->first(v) ; g->valid(v); g->next(v)) {
238 std::queue<Node> queue;
243 while (!queue.empty()) {
244 Node w=queue.front();
249 for(g->first(e,w) ; g->valid(e); g->next(e)) {
251 if (M[v] && (*flow)[e] < (*capacity)[e] ) {
258 for(g->first(f,w) ; g->valid(f); g->next(f)) {
260 if (M[v] && (*flow)[f] > 0 ) {
269 /// A minimum cut is computed.
270 template<typename CutMap>
271 void minCut(CutMap& M) { minMinCut(M); }
274 void resetSource(Node _s) { s=_s; }
276 void resetTarget(Node _t) { t=_t; }
278 /// capacity-map is changed.
279 void resetCap(const CapMap& _cap) { capacity=&_cap; }
281 /// flow-map is changed.
282 void resetFlow(FlowMap& _flow) { flow=&_flow; }
287 int push(Node w, VecStack& active) {
291 int newlevel=n; //bound on the next level of w
294 for(g->first(e,w); g->valid(e); g->next(e)) {
296 if ( (*flow)[e] >= (*capacity)[e] ) continue;
299 if( lev > level[v] ) { //Push is allowed now
301 if ( excess[v]<=0 && v!=t && v!=s ) {
303 active[lev_v].push(v);
306 Num cap=(*capacity)[e];
310 if ( remcap >= exc ) { //A nonsaturating push.
312 flow->set(e, flo+exc);
313 excess.set(v, excess[v]+exc);
317 } else { //A saturating push.
319 excess.set(v, excess[v]+remcap);
322 } else if ( newlevel > level[v] ) newlevel = level[v];
327 for(g->first(e,w); g->valid(e); g->next(e)) {
329 if( (*flow)[e] <= 0 ) continue;
332 if( lev > level[v] ) { //Push is allowed now
334 if ( excess[v]<=0 && v!=t && v!=s ) {
336 active[lev_v].push(v);
341 if ( flo >= exc ) { //A nonsaturating push.
343 flow->set(e, flo-exc);
344 excess.set(v, excess[v]+exc);
347 } else { //A saturating push.
349 excess.set(v, excess[v]+flo);
353 } else if ( newlevel > level[v] ) newlevel = level[v];
356 } // if w still has excess after the out edge for cycle
364 void preflowPreproc ( flowEnum fe, VecStack& active,
365 VecNode& level_list, NNMap& left, NNMap& right )
368 std::queue<Node> bfs_queue;
373 //Reverse_bfs from t, to find the starting level.
377 while (!bfs_queue.empty()) {
379 Node v=bfs_queue.front();
384 for(g->first(e,v); g->valid(e); g->next(e)) {
386 if ( level[w] == n && w != s ) {
388 Node first=level_list[l];
389 if ( g->valid(first) ) left.set(first,w);
399 for(g->first(e,s); g->valid(e); g->next(e))
401 Num c=(*capacity)[e];
402 if ( c <= 0 ) continue;
404 if ( level[w] < n ) {
405 if ( excess[w] <= 0 && w!=t ) active[level[w]].push(w);
407 excess.set(w, excess[w]+c);
416 //Reverse_bfs from t in the residual graph,
417 //to find the starting level.
421 while (!bfs_queue.empty()) {
423 Node v=bfs_queue.front();
428 for(g->first(e,v); g->valid(e); g->next(e)) {
429 if ( (*capacity)[e] <= (*flow)[e] ) continue;
431 if ( level[w] == n && w != s ) {
433 Node first=level_list[l];
434 if ( g->valid(first) ) left.set(first,w);
442 for(g->first(f,v); g->valid(f); g->next(f)) {
443 if ( 0 >= (*flow)[f] ) continue;
445 if ( level[w] == n && w != s ) {
447 Node first=level_list[l];
448 if ( g->valid(first) ) left.set(first,w);
459 for(g->first(e,s); g->valid(e); g->next(e))
461 Num rem=(*capacity)[e]-(*flow)[e];
462 if ( rem <= 0 ) continue;
464 if ( level[w] < n ) {
465 if ( excess[w] <= 0 && w!=t ) active[level[w]].push(w);
466 flow->set(e, (*capacity)[e]);
467 excess.set(w, excess[w]+rem);
472 for(g->first(f,s); g->valid(f); g->next(f))
474 if ( (*flow)[f] <= 0 ) continue;
476 if ( level[w] < n ) {
477 if ( excess[w] <= 0 && w!=t ) active[level[w]].push(w);
478 excess.set(w, excess[w]+(*flow)[f]);
489 void relabel(Node w, int newlevel, VecStack& active,
490 VecNode& level_list, NNMap& left,
491 NNMap& right, int& b, int& k, bool what_heur )
496 Node right_n=right[w];
500 if ( g->valid(right_n) ) {
501 if ( g->valid(left_n) ) {
502 right.set(left_n, right_n);
503 left.set(right_n, left_n);
505 level_list[lev]=right_n;
506 left.set(right_n, INVALID);
509 if ( g->valid(left_n) ) {
510 right.set(left_n, INVALID);
512 level_list[lev]=INVALID;
517 if ( !g->valid(level_list[lev]) ) {
520 for (int i=lev; i!=k ; ) {
521 Node v=level_list[++i];
522 while ( g->valid(v) ) {
526 level_list[i]=INVALID;
528 while ( !active[i].empty() ) {
529 active[i].pop(); //FIXME: ezt szebben kene
541 if ( newlevel == n ) level.set(w,n);
543 level.set(w,++newlevel);
544 active[newlevel].push(w);
545 if ( what_heur ) b=newlevel;
546 if ( k < newlevel ) ++k; //now k=newlevel
547 Node first=level_list[newlevel];
548 if ( g->valid(first) ) left.set(first,w);
551 level_list[newlevel]=w;
558 template<typename MapGraphWrapper>
561 const MapGraphWrapper* g;
562 typename MapGraphWrapper::template NodeMap<int> dist;
564 DistanceMap(MapGraphWrapper& _g) : g(&_g), dist(*g, g->nodeNum()) { }
565 void set(const typename MapGraphWrapper::Node& n, int a) {
568 int operator[](const typename MapGraphWrapper::Node& n)
570 // int get(const typename MapGraphWrapper::Node& n) const {
572 // bool get(const typename MapGraphWrapper::Edge& e) const {
573 // return (dist.get(g->tail(e))<dist.get(g->head(e))); }
574 bool operator[](const typename MapGraphWrapper::Edge& e) const {
575 return (dist[g->tail(e)]<dist[g->head(e)]);
582 template <typename Graph, typename Num, typename CapMap, typename FlowMap>
583 void MaxFlow<Graph, Num, CapMap, FlowMap>::preflowPhase0( flowEnum fe )
586 int heur0=(int)(H0*n); //time while running 'bound decrease'
587 int heur1=(int)(H1*n); //time while running 'highest label'
588 int heur=heur1; //starting time interval (#of relabels)
592 //It is 0 in case 'bound decrease' and 1 in case 'highest label'
595 //Needed for 'bound decrease', true means no active nodes are above bound b.
597 int k=n-2; //bound on the highest level under n containing a node
598 int b=k; //bound on the highest level under n of an active node
602 NNMap left(*g, INVALID);
603 NNMap right(*g, INVALID);
604 VecNode level_list(n,INVALID);
605 //List of the nodes in level i<n, set to n.
608 for(g->first(v); g->valid(v); g->next(v)) level.set(v,n);
609 //setting each node to level n
614 //counting the excess
616 for(g->first(v); g->valid(v); g->next(v)) {
620 for(g->first(e,v); g->valid(e); g->next(e)) exc+=(*flow)[e];
622 for(g->first(f,v); g->valid(f); g->next(f)) exc-=(*flow)[f];
626 //putting the active nodes into the stack
628 if ( exc > 0 && lev < n && v != t ) active[lev].push(v);
634 //Counting the excess of t
638 for(g->first(e,t); g->valid(e); g->next(e)) exc+=(*flow)[e];
640 for(g->first(f,t); g->valid(f); g->next(f)) exc-=(*flow)[f];
650 preflowPreproc( fe, active, level_list, left, right );
651 //End of preprocessing
654 //Push/relabel on the highest level active nodes.
657 if ( !what_heur && !end && k > 0 ) {
663 if ( active[b].empty() ) --b;
666 Node w=active[b].top();
668 int newlevel=push(w,active);
669 if ( excess[w] > 0 ) relabel(w, newlevel, active, level_list,
670 left, right, b, k, what_heur);
673 if ( numrelabel >= heur ) {
691 template <typename Graph, typename Num, typename CapMap, typename FlowMap>
692 void MaxFlow<Graph, Num, CapMap, FlowMap>::preflowPhase1()
695 int k=n-2; //bound on the highest level under n containing a node
696 int b=k; //bound on the highest level under n of an active node
700 std::queue<Node> bfs_queue;
703 while (!bfs_queue.empty()) {
705 Node v=bfs_queue.front();
710 for(g->first(e,v); g->valid(e); g->next(e)) {
711 if ( (*capacity)[e] <= (*flow)[e] ) continue;
713 if ( level[u] >= n ) {
716 if ( excess[u] > 0 ) active[l].push(u);
721 for(g->first(f,v); g->valid(f); g->next(f)) {
722 if ( 0 >= (*flow)[f] ) continue;
724 if ( level[u] >= n ) {
727 if ( excess[u] > 0 ) active[l].push(u);
737 if ( active[b].empty() ) --b;
739 Node w=active[b].top();
741 int newlevel=push(w,active);
744 if ( excess[w] > 0 ) {
745 level.set(w,++newlevel);
746 active[newlevel].push(w);
749 } // if stack[b] is nonempty
755 template <typename Graph, typename Num, typename CapMap, typename FlowMap>
756 bool MaxFlow<Graph, Num, CapMap, FlowMap>::augmentOnShortestPath()
758 ResGW res_graph(*g, *capacity, *flow);
761 //ReachedMap level(res_graph);
762 FOR_EACH_LOC(typename Graph::NodeIt, e, *g) level.set(e, 0);
763 BfsIterator<ResGW, ReachedMap> bfs(res_graph, level);
764 bfs.pushAndSetReached(s);
766 typename ResGW::template NodeMap<ResGWEdge> pred(res_graph);
767 pred.set(s, INVALID);
769 typename ResGW::template NodeMap<Num> free(res_graph);
771 //searching for augmenting path
772 while ( !bfs.finished() ) {
773 ResGWOutEdgeIt e=bfs;
774 if (res_graph.valid(e) && bfs.isBNodeNewlyReached()) {
775 Node v=res_graph.tail(e);
776 Node w=res_graph.head(e);
778 if (res_graph.valid(pred[v])) {
779 free.set(w, std::min(free[v], res_graph.resCap(e)));
781 free.set(w, res_graph.resCap(e));
783 if (res_graph.head(e)==t) { _augment=true; break; }
787 } //end of searching augmenting path
791 Num augment_value=free[t];
792 while (res_graph.valid(pred[n])) {
794 res_graph.augment(e, augment_value);
810 template <typename Graph, typename Num, typename CapMap, typename FlowMap>
811 template<typename MutableGraph>
812 bool MaxFlow<Graph, Num, CapMap, FlowMap>::augmentOnBlockingFlow()
814 typedef MutableGraph MG;
817 ResGW res_graph(*g, *capacity, *flow);
819 //bfs for distances on the residual graph
820 //ReachedMap level(res_graph);
821 FOR_EACH_LOC(typename Graph::NodeIt, e, *g) level.set(e, 0);
822 BfsIterator<ResGW, ReachedMap> bfs(res_graph, level);
823 bfs.pushAndSetReached(s);
824 typename ResGW::template NodeMap<int>
825 dist(res_graph); //filled up with 0's
827 //F will contain the physical copy of the residual graph
828 //with the set of edges which are on shortest paths
830 typename ResGW::template NodeMap<typename MG::Node>
831 res_graph_to_F(res_graph);
833 typename ResGW::NodeIt n;
834 for(res_graph.first(n); res_graph.valid(n); res_graph.next(n)) {
835 res_graph_to_F.set(n, F.addNode());
839 typename MG::Node sF=res_graph_to_F[s];
840 typename MG::Node tF=res_graph_to_F[t];
841 typename MG::template EdgeMap<ResGWEdge> original_edge(F);
842 typename MG::template EdgeMap<Num> residual_capacity(F);
844 while ( !bfs.finished() ) {
845 ResGWOutEdgeIt e=bfs;
846 if (res_graph.valid(e)) {
847 if (bfs.isBNodeNewlyReached()) {
848 dist.set(res_graph.head(e), dist[res_graph.tail(e)]+1);
849 typename MG::Edge f=F.addEdge(res_graph_to_F[res_graph.tail(e)], res_graph_to_F[res_graph.head(e)]);
850 original_edge.update();
851 original_edge.set(f, e);
852 residual_capacity.update();
853 residual_capacity.set(f, res_graph.resCap(e));
855 if (dist[res_graph.head(e)]==(dist[res_graph.tail(e)]+1)) {
856 typename MG::Edge f=F.addEdge(res_graph_to_F[res_graph.tail(e)], res_graph_to_F[res_graph.head(e)]);
857 original_edge.update();
858 original_edge.set(f, e);
859 residual_capacity.update();
860 residual_capacity.set(f, res_graph.resCap(e));
865 } //computing distances from s in the residual graph
871 //computing blocking flow with dfs
872 DfsIterator< MG, typename MG::template NodeMap<bool> > dfs(F);
873 typename MG::template NodeMap<typename MG::Edge> pred(F);
874 pred.set(sF, INVALID);
875 //invalid iterators for sources
877 typename MG::template NodeMap<Num> free(F);
879 dfs.pushAndSetReached(sF);
880 while (!dfs.finished()) {
882 if (F.valid(/*typename MG::OutEdgeIt*/(dfs))) {
883 if (dfs.isBNodeNewlyReached()) {
884 typename MG::Node v=F.aNode(dfs);
885 typename MG::Node w=F.bNode(dfs);
887 if (F.valid(pred[v])) {
888 free.set(w, std::min(free[v], residual_capacity[dfs]));
890 free.set(w, residual_capacity[dfs]);
899 F.erase(/*typename MG::OutEdgeIt*/(dfs));
905 typename MG::Node n=tF;
906 Num augment_value=free[tF];
907 while (F.valid(pred[n])) {
908 typename MG::Edge e=pred[n];
909 res_graph.augment(original_edge[e], augment_value);
911 if (residual_capacity[e]==augment_value)
914 residual_capacity.set(e, residual_capacity[e]-augment_value);
928 template <typename Graph, typename Num, typename CapMap, typename FlowMap>
929 bool MaxFlow<Graph, Num, CapMap, FlowMap>::augmentOnBlockingFlow2()
933 ResGW res_graph(*g, *capacity, *flow);
935 //ReachedMap level(res_graph);
936 FOR_EACH_LOC(typename Graph::NodeIt, e, *g) level.set(e, 0);
937 BfsIterator<ResGW, ReachedMap> bfs(res_graph, level);
939 bfs.pushAndSetReached(s);
940 DistanceMap<ResGW> dist(res_graph);
941 while ( !bfs.finished() ) {
942 ResGWOutEdgeIt e=bfs;
943 if (res_graph.valid(e) && bfs.isBNodeNewlyReached()) {
944 dist.set(res_graph.head(e), dist[res_graph.tail(e)]+1);
947 } //computing distances from s in the residual graph
949 //Subgraph containing the edges on some shortest paths
950 ConstMap<typename ResGW::Node, bool> true_map(true);
951 typedef SubGraphWrapper<ResGW, ConstMap<typename ResGW::Node, bool>,
952 DistanceMap<ResGW> > FilterResGW;
953 FilterResGW filter_res_graph(res_graph, true_map, dist);
955 //Subgraph, which is able to delete edges which are already
957 typename FilterResGW::template NodeMap<typename FilterResGW::OutEdgeIt>
958 first_out_edges(filter_res_graph);
959 typename FilterResGW::NodeIt v;
960 for(filter_res_graph.first(v); filter_res_graph.valid(v);
961 filter_res_graph.next(v))
963 typename FilterResGW::OutEdgeIt e;
964 filter_res_graph.first(e, v);
965 first_out_edges.set(v, e);
967 typedef ErasingFirstGraphWrapper<FilterResGW, typename FilterResGW::
968 template NodeMap<typename FilterResGW::OutEdgeIt> > ErasingResGW;
969 ErasingResGW erasing_res_graph(filter_res_graph, first_out_edges);
976 //computing blocking flow with dfs
977 DfsIterator< ErasingResGW,
978 typename ErasingResGW::template NodeMap<bool> >
979 dfs(erasing_res_graph);
980 typename ErasingResGW::
981 template NodeMap<typename ErasingResGW::OutEdgeIt>
982 pred(erasing_res_graph);
983 pred.set(s, INVALID);
984 //invalid iterators for sources
986 typename ErasingResGW::template NodeMap<Num>
987 free1(erasing_res_graph);
989 dfs.pushAndSetReached(
990 typename ErasingResGW::Node(
991 typename FilterResGW::Node(
992 typename ResGW::Node(s)
996 while (!dfs.finished()) {
998 if (erasing_res_graph.valid(
999 typename ErasingResGW::OutEdgeIt(dfs)))
1001 if (dfs.isBNodeNewlyReached()) {
1003 typename ErasingResGW::Node v=erasing_res_graph.aNode(dfs);
1004 typename ErasingResGW::Node w=erasing_res_graph.bNode(dfs);
1006 pred.set(w, /*typename ErasingResGW::OutEdgeIt*/(dfs));
1007 if (erasing_res_graph.valid(pred[v])) {
1008 free1.set(w, std::min(free1[v], res_graph.resCap(
1009 typename ErasingResGW::OutEdgeIt(dfs))));
1011 free1.set(w, res_graph.resCap(
1012 typename ErasingResGW::OutEdgeIt(dfs)));
1021 erasing_res_graph.erase(dfs);
1027 typename ErasingResGW::Node n=typename FilterResGW::Node(typename ResGW::Node(t));
1028 // typename ResGW::NodeMap<Num> a(res_graph);
1029 // typename ResGW::Node b;
1031 // typename FilterResGW::NodeMap<Num> a1(filter_res_graph);
1032 // typename FilterResGW::Node b1;
1034 // typename ErasingResGW::NodeMap<Num> a2(erasing_res_graph);
1035 // typename ErasingResGW::Node b2;
1037 Num augment_value=free1[n];
1038 while (erasing_res_graph.valid(pred[n])) {
1039 typename ErasingResGW::OutEdgeIt e=pred[n];
1040 res_graph.augment(e, augment_value);
1041 n=erasing_res_graph.tail(e);
1042 if (res_graph.resCap(e)==0)
1043 erasing_res_graph.erase(e);
1047 } //while (__augment)
1057 #endif //HUGO_MAX_FLOW_H