Changes in the Maps' copy constructors.
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>
47 #include <bfs_iterator.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 ) {
367 std::queue<Node> bfs_queue;
372 //Reverse_bfs from t, to find the starting level.
376 while (!bfs_queue.empty()) {
378 Node v=bfs_queue.front();
383 for(g->first(e,v); g->valid(e); g->next(e)) {
385 if ( level[w] == n && w != s ) {
387 Node first=level_list[l];
388 if ( g->valid(first) ) left.set(first,w);
398 for(g->first(e,s); g->valid(e); g->next(e))
400 Num c=(*capacity)[e];
401 if ( c <= 0 ) continue;
403 if ( level[w] < n ) {
404 if ( excess[w] <= 0 && w!=t ) active[level[w]].push(w);
406 excess.set(w, excess[w]+c);
415 //Reverse_bfs from t in the residual graph,
416 //to find the starting level.
420 while (!bfs_queue.empty()) {
422 Node v=bfs_queue.front();
427 for(g->first(e,v); g->valid(e); g->next(e)) {
428 if ( (*capacity)[e] <= (*flow)[e] ) continue;
430 if ( level[w] == n && w != s ) {
432 Node first=level_list[l];
433 if ( g->valid(first) ) left.set(first,w);
441 for(g->first(f,v); g->valid(f); g->next(f)) {
442 if ( 0 >= (*flow)[f] ) continue;
444 if ( level[w] == n && w != s ) {
446 Node first=level_list[l];
447 if ( g->valid(first) ) left.set(first,w);
458 for(g->first(e,s); g->valid(e); g->next(e))
460 Num rem=(*capacity)[e]-(*flow)[e];
461 if ( rem <= 0 ) continue;
463 if ( level[w] < n ) {
464 if ( excess[w] <= 0 && w!=t ) active[level[w]].push(w);
465 flow->set(e, (*capacity)[e]);
466 excess.set(w, excess[w]+rem);
471 for(g->first(f,s); g->valid(f); g->next(f))
473 if ( (*flow)[f] <= 0 ) continue;
475 if ( level[w] < n ) {
476 if ( excess[w] <= 0 && w!=t ) active[level[w]].push(w);
477 excess.set(w, excess[w]+(*flow)[f]);
488 void relabel(Node w, int newlevel, VecStack& active,
489 VecNode& level_list, NNMap& left,
490 NNMap& right, int& b, int& k, bool what_heur )
495 Node right_n=right[w];
499 if ( g->valid(right_n) ) {
500 if ( g->valid(left_n) ) {
501 right.set(left_n, right_n);
502 left.set(right_n, left_n);
504 level_list[lev]=right_n;
505 left.set(right_n, INVALID);
508 if ( g->valid(left_n) ) {
509 right.set(left_n, INVALID);
511 level_list[lev]=INVALID;
516 if ( !g->valid(level_list[lev]) ) {
519 for (int i=lev; i!=k ; ) {
520 Node v=level_list[++i];
521 while ( g->valid(v) ) {
525 level_list[i]=INVALID;
527 while ( !active[i].empty() ) {
528 active[i].pop(); //FIXME: ezt szebben kene
540 if ( newlevel == n ) level.set(w,n);
542 level.set(w,++newlevel);
543 active[newlevel].push(w);
544 if ( what_heur ) b=newlevel;
545 if ( k < newlevel ) ++k; //now k=newlevel
546 Node first=level_list[newlevel];
547 if ( g->valid(first) ) left.set(first,w);
550 level_list[newlevel]=w;
557 template<typename MapGraphWrapper>
560 const MapGraphWrapper* g;
561 typename MapGraphWrapper::template NodeMap<int> dist;
563 DistanceMap(MapGraphWrapper& _g) : g(&_g), dist(*g, g->nodeNum()) { }
564 void set(const typename MapGraphWrapper::Node& n, int a) {
567 int operator[](const typename MapGraphWrapper::Node& n)
569 // int get(const typename MapGraphWrapper::Node& n) const {
571 // bool get(const typename MapGraphWrapper::Edge& e) const {
572 // return (dist.get(g->tail(e))<dist.get(g->head(e))); }
573 bool operator[](const typename MapGraphWrapper::Edge& e) const {
574 return (dist[g->tail(e)]<dist[g->head(e)]);
581 template <typename Graph, typename Num, typename CapMap, typename FlowMap>
582 void MaxFlow<Graph, Num, CapMap, FlowMap>::preflowPhase0( flowEnum fe )
585 int heur0=(int)(H0*n); //time while running 'bound decrease'
586 int heur1=(int)(H1*n); //time while running 'highest label'
587 int heur=heur1; //starting time interval (#of relabels)
591 //It is 0 in case 'bound decrease' and 1 in case 'highest label'
594 //Needed for 'bound decrease', true means no active nodes are above bound b.
596 int k=n-2; //bound on the highest level under n containing a node
597 int b=k; //bound on the highest level under n of an active node
601 NNMap left(*g, INVALID);
602 NNMap right(*g, INVALID);
603 VecNode level_list(n,INVALID);
604 //List of the nodes in level i<n, set to n.
607 for(g->first(v); g->valid(v); g->next(v)) level.set(v,n);
608 //setting each node to level n
613 //counting the excess
615 for(g->first(v); g->valid(v); g->next(v)) {
619 for(g->first(e,v); g->valid(e); g->next(e)) exc+=(*flow)[e];
621 for(g->first(f,v); g->valid(f); g->next(f)) exc-=(*flow)[f];
625 //putting the active nodes into the stack
627 if ( exc > 0 && lev < n && v != t ) active[lev].push(v);
633 //Counting the excess of t
637 for(g->first(e,t); g->valid(e); g->next(e)) exc+=(*flow)[e];
639 for(g->first(f,t); g->valid(f); g->next(f)) exc-=(*flow)[f];
649 preflowPreproc( fe, active, level_list, left, right );
650 //End of preprocessing
653 //Push/relabel on the highest level active nodes.
656 if ( !what_heur && !end && k > 0 ) {
662 if ( active[b].empty() ) --b;
665 Node w=active[b].top();
667 int newlevel=push(w,active);
668 if ( excess[w] > 0 ) relabel(w, newlevel, active, level_list,
669 left, right, b, k, what_heur);
672 if ( numrelabel >= heur ) {
690 template <typename Graph, typename Num, typename CapMap, typename FlowMap>
691 void MaxFlow<Graph, Num, CapMap, FlowMap>::preflowPhase1()
694 int k=n-2; //bound on the highest level under n containing a node
695 int b=k; //bound on the highest level under n of an active node
699 std::queue<Node> bfs_queue;
702 while (!bfs_queue.empty()) {
704 Node v=bfs_queue.front();
709 for(g->first(e,v); g->valid(e); g->next(e)) {
710 if ( (*capacity)[e] <= (*flow)[e] ) continue;
712 if ( level[u] >= n ) {
715 if ( excess[u] > 0 ) active[l].push(u);
720 for(g->first(f,v); g->valid(f); g->next(f)) {
721 if ( 0 >= (*flow)[f] ) continue;
723 if ( level[u] >= n ) {
726 if ( excess[u] > 0 ) active[l].push(u);
736 if ( active[b].empty() ) --b;
738 Node w=active[b].top();
740 int newlevel=push(w,active);
743 if ( excess[w] > 0 ) {
744 level.set(w,++newlevel);
745 active[newlevel].push(w);
748 } // if stack[b] is nonempty
754 template <typename Graph, typename Num, typename CapMap, typename FlowMap>
755 bool MaxFlow<Graph, Num, CapMap, FlowMap>::augmentOnShortestPath()
757 ResGW res_graph(*g, *capacity, *flow);
760 //ReachedMap level(res_graph);
761 FOR_EACH_LOC(typename Graph::NodeIt, e, *g) level.set(e, 0);
762 BfsIterator<ResGW, ReachedMap> bfs(res_graph, level);
763 bfs.pushAndSetReached(s);
765 typename ResGW::template NodeMap<ResGWEdge> pred(res_graph);
766 pred.set(s, INVALID);
768 typename ResGW::template NodeMap<Num> free(res_graph);
770 //searching for augmenting path
771 while ( !bfs.finished() ) {
772 ResGWOutEdgeIt e=bfs;
773 if (res_graph.valid(e) && bfs.isBNodeNewlyReached()) {
774 Node v=res_graph.tail(e);
775 Node w=res_graph.head(e);
777 if (res_graph.valid(pred[v])) {
778 free.set(w, std::min(free[v], res_graph.resCap(e)));
780 free.set(w, res_graph.resCap(e));
782 if (res_graph.head(e)==t) { _augment=true; break; }
786 } //end of searching augmenting path
790 Num augment_value=free[t];
791 while (res_graph.valid(pred[n])) {
793 res_graph.augment(e, augment_value);
809 template <typename Graph, typename Num, typename CapMap, typename FlowMap>
810 template<typename MutableGraph>
811 bool MaxFlow<Graph, Num, CapMap, FlowMap>::augmentOnBlockingFlow()
813 typedef MutableGraph MG;
816 ResGW res_graph(*g, *capacity, *flow);
818 //bfs for distances on the residual graph
819 //ReachedMap level(res_graph);
820 FOR_EACH_LOC(typename Graph::NodeIt, e, *g) level.set(e, 0);
821 BfsIterator<ResGW, ReachedMap> bfs(res_graph, level);
822 bfs.pushAndSetReached(s);
823 typename ResGW::template NodeMap<int>
824 dist(res_graph); //filled up with 0's
826 //F will contain the physical copy of the residual graph
827 //with the set of edges which are on shortest paths
829 typename ResGW::template NodeMap<typename MG::Node>
830 res_graph_to_F(res_graph);
832 typename ResGW::NodeIt n;
833 for(res_graph.first(n); res_graph.valid(n); res_graph.next(n)) {
834 res_graph_to_F.set(n, F.addNode());
838 typename MG::Node sF=res_graph_to_F[s];
839 typename MG::Node tF=res_graph_to_F[t];
840 typename MG::template EdgeMap<ResGWEdge> original_edge(F);
841 typename MG::template EdgeMap<Num> residual_capacity(F);
843 while ( !bfs.finished() ) {
844 ResGWOutEdgeIt e=bfs;
845 if (res_graph.valid(e)) {
846 if (bfs.isBNodeNewlyReached()) {
847 dist.set(res_graph.head(e), dist[res_graph.tail(e)]+1);
848 typename MG::Edge f=F.addEdge(res_graph_to_F[res_graph.tail(e)], res_graph_to_F[res_graph.head(e)]);
849 original_edge.update();
850 original_edge.set(f, e);
851 residual_capacity.update();
852 residual_capacity.set(f, res_graph.resCap(e));
854 if (dist[res_graph.head(e)]==(dist[res_graph.tail(e)]+1)) {
855 typename MG::Edge f=F.addEdge(res_graph_to_F[res_graph.tail(e)], res_graph_to_F[res_graph.head(e)]);
856 original_edge.update();
857 original_edge.set(f, e);
858 residual_capacity.update();
859 residual_capacity.set(f, res_graph.resCap(e));
864 } //computing distances from s in the residual graph
870 //computing blocking flow with dfs
871 DfsIterator< MG, typename MG::template NodeMap<bool> > dfs(F);
872 typename MG::template NodeMap<typename MG::Edge> pred(F);
873 pred.set(sF, INVALID);
874 //invalid iterators for sources
876 typename MG::template NodeMap<Num> free(F);
878 dfs.pushAndSetReached(sF);
879 while (!dfs.finished()) {
881 if (F.valid(/*typename MG::OutEdgeIt*/(dfs))) {
882 if (dfs.isBNodeNewlyReached()) {
883 typename MG::Node v=F.aNode(dfs);
884 typename MG::Node w=F.bNode(dfs);
886 if (F.valid(pred[v])) {
887 free.set(w, std::min(free[v], residual_capacity[dfs]));
889 free.set(w, residual_capacity[dfs]);
898 F.erase(/*typename MG::OutEdgeIt*/(dfs));
904 typename MG::Node n=tF;
905 Num augment_value=free[tF];
906 while (F.valid(pred[n])) {
907 typename MG::Edge e=pred[n];
908 res_graph.augment(original_edge[e], augment_value);
910 if (residual_capacity[e]==augment_value)
913 residual_capacity.set(e, residual_capacity[e]-augment_value);
927 template <typename Graph, typename Num, typename CapMap, typename FlowMap>
928 bool MaxFlow<Graph, Num, CapMap, FlowMap>::augmentOnBlockingFlow2()
932 ResGW res_graph(*g, *capacity, *flow);
934 //ReachedMap level(res_graph);
935 FOR_EACH_LOC(typename Graph::NodeIt, e, *g) level.set(e, 0);
936 BfsIterator<ResGW, ReachedMap> bfs(res_graph, level);
938 bfs.pushAndSetReached(s);
939 DistanceMap<ResGW> dist(res_graph);
940 while ( !bfs.finished() ) {
941 ResGWOutEdgeIt e=bfs;
942 if (res_graph.valid(e) && bfs.isBNodeNewlyReached()) {
943 dist.set(res_graph.head(e), dist[res_graph.tail(e)]+1);
946 } //computing distances from s in the residual graph
948 //Subgraph containing the edges on some shortest paths
949 ConstMap<typename ResGW::Node, bool> true_map(true);
950 typedef SubGraphWrapper<ResGW, ConstMap<typename ResGW::Node, bool>,
951 DistanceMap<ResGW> > FilterResGW;
952 FilterResGW filter_res_graph(res_graph, true_map, dist);
954 //Subgraph, which is able to delete edges which are already
956 typename FilterResGW::template NodeMap<typename FilterResGW::OutEdgeIt>
957 first_out_edges(filter_res_graph);
958 typename FilterResGW::NodeIt v;
959 for(filter_res_graph.first(v); filter_res_graph.valid(v);
960 filter_res_graph.next(v))
962 typename FilterResGW::OutEdgeIt e;
963 filter_res_graph.first(e, v);
964 first_out_edges.set(v, e);
966 typedef ErasingFirstGraphWrapper<FilterResGW, typename FilterResGW::
967 template NodeMap<typename FilterResGW::OutEdgeIt> > ErasingResGW;
968 ErasingResGW erasing_res_graph(filter_res_graph, first_out_edges);
975 //computing blocking flow with dfs
976 DfsIterator< ErasingResGW,
977 typename ErasingResGW::template NodeMap<bool> >
978 dfs(erasing_res_graph);
979 typename ErasingResGW::
980 template NodeMap<typename ErasingResGW::OutEdgeIt>
981 pred(erasing_res_graph);
982 pred.set(s, INVALID);
983 //invalid iterators for sources
985 typename ErasingResGW::template NodeMap<Num>
986 free1(erasing_res_graph);
988 dfs.pushAndSetReached(
989 typename ErasingResGW::Node(
990 typename FilterResGW::Node(
991 typename ResGW::Node(s)
995 while (!dfs.finished()) {
997 if (erasing_res_graph.valid(
998 typename ErasingResGW::OutEdgeIt(dfs)))
1000 if (dfs.isBNodeNewlyReached()) {
1002 typename ErasingResGW::Node v=erasing_res_graph.aNode(dfs);
1003 typename ErasingResGW::Node w=erasing_res_graph.bNode(dfs);
1005 pred.set(w, /*typename ErasingResGW::OutEdgeIt*/(dfs));
1006 if (erasing_res_graph.valid(pred[v])) {
1007 free1.set(w, std::min(free1[v], res_graph.resCap(
1008 typename ErasingResGW::OutEdgeIt(dfs))));
1010 free1.set(w, res_graph.resCap(
1011 typename ErasingResGW::OutEdgeIt(dfs)));
1020 erasing_res_graph.erase(dfs);
1026 typename ErasingResGW::Node n=typename FilterResGW::Node(typename ResGW::Node(t));
1027 // typename ResGW::NodeMap<Num> a(res_graph);
1028 // typename ResGW::Node b;
1030 // typename FilterResGW::NodeMap<Num> a1(filter_res_graph);
1031 // typename FilterResGW::Node b1;
1033 // typename ErasingResGW::NodeMap<Num> a2(erasing_res_graph);
1034 // typename ErasingResGW::Node b2;
1036 Num augment_value=free1[n];
1037 while (erasing_res_graph.valid(pred[n])) {
1038 typename ErasingResGW::OutEdgeIt e=pred[n];
1039 res_graph.augment(e, augment_value);
1040 n=erasing_res_graph.tail(e);
1041 if (res_graph.resCap(e)==0)
1042 erasing_res_graph.erase(e);
1046 } //while (__augment)
1056 #endif //HUGO_MAX_FLOW_H