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
115 MaxFlow(const Graph& _G, Node _s, Node _t, const CapMap& _capacity,
117 g(&_G), s(_s), t(_t), capacity(&_capacity),
118 flow(&_flow), n(_G.nodeNum()), level(_G), excess(_G,0) {}
120 /// A max flow algorithm is run.
121 ///\pre the flow have to be 0 at the beginning.
126 /// A preflow algorithm is run.
127 ///\pre The initial edge-map have to be a
128 /// zero flow if \c fe is \c ZERO_FLOW,
129 /// a flow if \c fe is \c GEN_FLOW,
130 /// and a pre-flow it is \c PREFLOW.
131 void preflow(flowEnum fe) {
136 /// Run the first phase of preflow, starting from a 0 flow, from a flow,
137 /// or from a preflow, according to \c fe.
138 void preflowPhase0( flowEnum fe );
140 /// Second phase of preflow.
141 void preflowPhase1();
143 /// Starting from a flow, this method searches for an augmenting path
144 /// according to the Edmonds-Karp algorithm
145 /// and augments the flow on if any.
146 /// The return value shows if the augmentation was succesful.
147 bool augmentOnShortestPath();
149 /// Starting from a flow, this method searches for an augmenting blockin
150 /// flow according to Dinits' algorithm and augments the flow on if any.
151 /// The blocking flow is computed in a physically constructed
152 /// residual graph of type \c Mutablegraph.
153 /// The return value show sif the augmentation was succesful.
154 template<typename MutableGraph> bool augmentOnBlockingFlow();
156 /// The same as \c augmentOnBlockingFlow<MutableGraph> but the
157 /// residual graph is not constructed physically.
158 /// The return value shows if the augmentation was succesful.
159 bool augmentOnBlockingFlow2();
161 /// Returns the actual flow value.
162 /// More precisely, it returns the negative excess of s, thus
163 /// this works also for preflows.
166 FOR_EACH_INC_LOC(OutEdgeIt, e, *g, s) a+=(*flow)[e];
167 FOR_EACH_INC_LOC(InEdgeIt, e, *g, s) a-=(*flow)[e];
171 /// Should be used between preflowPhase0 and preflowPhase1.
172 ///\todo We have to make some status variable which shows the actual state
173 /// of the class. This enables us to determine which methods are valid
174 /// for MinCut computation
175 template<typename _CutMap>
176 void actMinCut(_CutMap& M) {
178 for(g->first(v); g->valid(v); g->next(v)) {
179 if ( level[v] < n ) {
187 /// The unique inclusionwise minimum cut is computed by
188 /// processing a bfs from s in the residual graph.
189 ///\pre flow have to be a max flow otherwise it will the whole node-set.
190 template<typename _CutMap>
191 void minMinCut(_CutMap& M) {
193 std::queue<Node> queue;
198 while (!queue.empty()) {
199 Node w=queue.front();
203 for(g->first(e,w) ; g->valid(e); g->next(e)) {
205 if (!M[v] && (*flow)[e] < (*capacity)[e] ) {
212 for(g->first(f,w) ; g->valid(f); g->next(f)) {
214 if (!M[v] && (*flow)[f] > 0 ) {
223 /// The unique inclusionwise maximum cut is computed by
224 /// processing a reverse bfs from t in the residual graph.
225 ///\pre flow have to be a max flow otherwise it will be empty.
226 template<typename _CutMap>
227 void maxMinCut(_CutMap& M) {
230 for(g->first(v) ; g->valid(v); g->next(v)) {
234 std::queue<Node> queue;
239 while (!queue.empty()) {
240 Node w=queue.front();
245 for(g->first(e,w) ; g->valid(e); g->next(e)) {
247 if (M[v] && (*flow)[e] < (*capacity)[e] ) {
254 for(g->first(f,w) ; g->valid(f); g->next(f)) {
256 if (M[v] && (*flow)[f] > 0 ) {
265 /// A minimum cut is computed.
266 template<typename CutMap>
267 void minCut(CutMap& M) { minMinCut(M); }
270 void resetSource(Node _s) { s=_s; }
272 void resetTarget(Node _t) { t=_t; }
274 /// capacity-map is changed.
275 void resetCap(const CapMap& _cap) { capacity=&_cap; }
277 /// flow-map is changed.
278 void resetFlow(FlowMap& _flow) { flow=&_flow; }
283 int push(Node w, VecStack& active) {
287 int newlevel=n; //bound on the next level of w
290 for(g->first(e,w); g->valid(e); g->next(e)) {
292 if ( (*flow)[e] >= (*capacity)[e] ) continue;
295 if( lev > level[v] ) { //Push is allowed now
297 if ( excess[v]<=0 && v!=t && v!=s ) {
299 active[lev_v].push(v);
302 Num cap=(*capacity)[e];
306 if ( remcap >= exc ) { //A nonsaturating push.
308 flow->set(e, flo+exc);
309 excess.set(v, excess[v]+exc);
313 } else { //A saturating push.
315 excess.set(v, excess[v]+remcap);
318 } else if ( newlevel > level[v] ) newlevel = level[v];
323 for(g->first(e,w); g->valid(e); g->next(e)) {
325 if( (*flow)[e] <= 0 ) continue;
328 if( lev > level[v] ) { //Push is allowed now
330 if ( excess[v]<=0 && v!=t && v!=s ) {
332 active[lev_v].push(v);
337 if ( flo >= exc ) { //A nonsaturating push.
339 flow->set(e, flo-exc);
340 excess.set(v, excess[v]+exc);
343 } else { //A saturating push.
345 excess.set(v, excess[v]+flo);
349 } else if ( newlevel > level[v] ) newlevel = level[v];
352 } // if w still has excess after the out edge for cycle
360 void preflowPreproc ( flowEnum fe, VecStack& active,
361 VecNode& level_list, NNMap& left, NNMap& right ) {
363 std::queue<Node> bfs_queue;
368 //Reverse_bfs from t, to find the starting level.
372 while (!bfs_queue.empty()) {
374 Node v=bfs_queue.front();
379 for(g->first(e,v); g->valid(e); g->next(e)) {
381 if ( level[w] == n && w != s ) {
383 Node first=level_list[l];
384 if ( g->valid(first) ) left.set(first,w);
394 for(g->first(e,s); g->valid(e); g->next(e))
396 Num c=(*capacity)[e];
397 if ( c <= 0 ) continue;
399 if ( level[w] < n ) {
400 if ( excess[w] <= 0 && w!=t ) active[level[w]].push(w);
402 excess.set(w, excess[w]+c);
411 //Reverse_bfs from t in the residual graph,
412 //to find the starting level.
416 while (!bfs_queue.empty()) {
418 Node v=bfs_queue.front();
423 for(g->first(e,v); g->valid(e); g->next(e)) {
424 if ( (*capacity)[e] <= (*flow)[e] ) continue;
426 if ( level[w] == n && w != s ) {
428 Node first=level_list[l];
429 if ( g->valid(first) ) left.set(first,w);
437 for(g->first(f,v); g->valid(f); g->next(f)) {
438 if ( 0 >= (*flow)[f] ) continue;
440 if ( level[w] == n && w != s ) {
442 Node first=level_list[l];
443 if ( g->valid(first) ) left.set(first,w);
454 for(g->first(e,s); g->valid(e); g->next(e))
456 Num rem=(*capacity)[e]-(*flow)[e];
457 if ( rem <= 0 ) continue;
459 if ( level[w] < n ) {
460 if ( excess[w] <= 0 && w!=t ) active[level[w]].push(w);
461 flow->set(e, (*capacity)[e]);
462 excess.set(w, excess[w]+rem);
467 for(g->first(f,s); g->valid(f); g->next(f))
469 if ( (*flow)[f] <= 0 ) continue;
471 if ( level[w] < n ) {
472 if ( excess[w] <= 0 && w!=t ) active[level[w]].push(w);
473 excess.set(w, excess[w]+(*flow)[f]);
484 void relabel(Node w, int newlevel, VecStack& active,
485 VecNode& level_list, NNMap& left,
486 NNMap& right, int& b, int& k, bool what_heur )
491 Node right_n=right[w];
495 if ( g->valid(right_n) ) {
496 if ( g->valid(left_n) ) {
497 right.set(left_n, right_n);
498 left.set(right_n, left_n);
500 level_list[lev]=right_n;
501 left.set(right_n, INVALID);
504 if ( g->valid(left_n) ) {
505 right.set(left_n, INVALID);
507 level_list[lev]=INVALID;
512 if ( !g->valid(level_list[lev]) ) {
515 for (int i=lev; i!=k ; ) {
516 Node v=level_list[++i];
517 while ( g->valid(v) ) {
521 level_list[i]=INVALID;
523 while ( !active[i].empty() ) {
524 active[i].pop(); //FIXME: ezt szebben kene
536 if ( newlevel == n ) level.set(w,n);
538 level.set(w,++newlevel);
539 active[newlevel].push(w);
540 if ( what_heur ) b=newlevel;
541 if ( k < newlevel ) ++k; //now k=newlevel
542 Node first=level_list[newlevel];
543 if ( g->valid(first) ) left.set(first,w);
546 level_list[newlevel]=w;
553 template<typename MapGraphWrapper>
556 const MapGraphWrapper* g;
557 typename MapGraphWrapper::template NodeMap<int> dist;
559 DistanceMap(MapGraphWrapper& _g) : g(&_g), dist(*g, g->nodeNum()) { }
560 void set(const typename MapGraphWrapper::Node& n, int a) {
563 int operator[](const typename MapGraphWrapper::Node& n)
565 // int get(const typename MapGraphWrapper::Node& n) const {
567 // bool get(const typename MapGraphWrapper::Edge& e) const {
568 // return (dist.get(g->tail(e))<dist.get(g->head(e))); }
569 bool operator[](const typename MapGraphWrapper::Edge& e) const {
570 return (dist[g->tail(e)]<dist[g->head(e)]);
577 template <typename Graph, typename Num, typename CapMap, typename FlowMap>
578 void MaxFlow<Graph, Num, CapMap, FlowMap>::preflowPhase0( flowEnum fe )
581 int heur0=(int)(H0*n); //time while running 'bound decrease'
582 int heur1=(int)(H1*n); //time while running 'highest label'
583 int heur=heur1; //starting time interval (#of relabels)
587 //It is 0 in case 'bound decrease' and 1 in case 'highest label'
590 //Needed for 'bound decrease', true means no active nodes are above bound b.
592 int k=n-2; //bound on the highest level under n containing a node
593 int b=k; //bound on the highest level under n of an active node
597 NNMap left(*g, INVALID);
598 NNMap right(*g, INVALID);
599 VecNode level_list(n,INVALID);
600 //List of the nodes in level i<n, set to n.
603 for(g->first(v); g->valid(v); g->next(v)) level.set(v,n);
604 //setting each node to level n
609 //counting the excess
611 for(g->first(v); g->valid(v); g->next(v)) {
615 for(g->first(e,v); g->valid(e); g->next(e)) exc+=(*flow)[e];
617 for(g->first(f,v); g->valid(f); g->next(f)) exc-=(*flow)[f];
621 //putting the active nodes into the stack
623 if ( exc > 0 && lev < n && v != t ) active[lev].push(v);
629 //Counting the excess of t
633 for(g->first(e,t); g->valid(e); g->next(e)) exc+=(*flow)[e];
635 for(g->first(f,t); g->valid(f); g->next(f)) exc-=(*flow)[f];
645 preflowPreproc( fe, active, level_list, left, right );
646 //End of preprocessing
649 //Push/relabel on the highest level active nodes.
652 if ( !what_heur && !end && k > 0 ) {
658 if ( active[b].empty() ) --b;
661 Node w=active[b].top();
663 int newlevel=push(w,active);
664 if ( excess[w] > 0 ) relabel(w, newlevel, active, level_list,
665 left, right, b, k, what_heur);
668 if ( numrelabel >= heur ) {
686 template <typename Graph, typename Num, typename CapMap, typename FlowMap>
687 void MaxFlow<Graph, Num, CapMap, FlowMap>::preflowPhase1()
690 int k=n-2; //bound on the highest level under n containing a node
691 int b=k; //bound on the highest level under n of an active node
695 std::queue<Node> bfs_queue;
698 while (!bfs_queue.empty()) {
700 Node v=bfs_queue.front();
705 for(g->first(e,v); g->valid(e); g->next(e)) {
706 if ( (*capacity)[e] <= (*flow)[e] ) continue;
708 if ( level[u] >= n ) {
711 if ( excess[u] > 0 ) active[l].push(u);
716 for(g->first(f,v); g->valid(f); g->next(f)) {
717 if ( 0 >= (*flow)[f] ) continue;
719 if ( level[u] >= n ) {
722 if ( excess[u] > 0 ) active[l].push(u);
732 if ( active[b].empty() ) --b;
734 Node w=active[b].top();
736 int newlevel=push(w,active);
739 if ( excess[w] > 0 ) {
740 level.set(w,++newlevel);
741 active[newlevel].push(w);
744 } // if stack[b] is nonempty
750 template <typename Graph, typename Num, typename CapMap, typename FlowMap>
751 bool MaxFlow<Graph, Num, CapMap, FlowMap>::augmentOnShortestPath()
753 ResGW res_graph(*g, *capacity, *flow);
756 //ReachedMap level(res_graph);
757 FOR_EACH_LOC(typename Graph::NodeIt, e, *g) level.set(e, 0);
758 BfsIterator<ResGW, ReachedMap> bfs(res_graph, level);
759 bfs.pushAndSetReached(s);
761 typename ResGW::template NodeMap<ResGWEdge> pred(res_graph);
762 pred.set(s, INVALID);
764 typename ResGW::template NodeMap<Num> free(res_graph);
766 //searching for augmenting path
767 while ( !bfs.finished() ) {
768 ResGWOutEdgeIt e=bfs;
769 if (res_graph.valid(e) && bfs.isBNodeNewlyReached()) {
770 Node v=res_graph.tail(e);
771 Node w=res_graph.head(e);
773 if (res_graph.valid(pred[v])) {
774 free.set(w, std::min(free[v], res_graph.resCap(e)));
776 free.set(w, res_graph.resCap(e));
778 if (res_graph.head(e)==t) { _augment=true; break; }
782 } //end of searching augmenting path
786 Num augment_value=free[t];
787 while (res_graph.valid(pred[n])) {
789 res_graph.augment(e, augment_value);
805 template <typename Graph, typename Num, typename CapMap, typename FlowMap>
806 template<typename MutableGraph>
807 bool MaxFlow<Graph, Num, CapMap, FlowMap>::augmentOnBlockingFlow()
809 typedef MutableGraph MG;
812 ResGW res_graph(*g, *capacity, *flow);
814 //bfs for distances on the residual graph
815 //ReachedMap level(res_graph);
816 FOR_EACH_LOC(typename Graph::NodeIt, e, *g) level.set(e, 0);
817 BfsIterator<ResGW, ReachedMap> bfs(res_graph, level);
818 bfs.pushAndSetReached(s);
819 typename ResGW::template NodeMap<int>
820 dist(res_graph); //filled up with 0's
822 //F will contain the physical copy of the residual graph
823 //with the set of edges which are on shortest paths
825 typename ResGW::template NodeMap<typename MG::Node>
826 res_graph_to_F(res_graph);
828 typename ResGW::NodeIt n;
829 for(res_graph.first(n); res_graph.valid(n); res_graph.next(n)) {
830 res_graph_to_F.set(n, F.addNode());
834 typename MG::Node sF=res_graph_to_F[s];
835 typename MG::Node tF=res_graph_to_F[t];
836 typename MG::template EdgeMap<ResGWEdge> original_edge(F);
837 typename MG::template EdgeMap<Num> residual_capacity(F);
839 while ( !bfs.finished() ) {
840 ResGWOutEdgeIt e=bfs;
841 if (res_graph.valid(e)) {
842 if (bfs.isBNodeNewlyReached()) {
843 dist.set(res_graph.head(e), dist[res_graph.tail(e)]+1);
844 typename MG::Edge f=F.addEdge(res_graph_to_F[res_graph.tail(e)], res_graph_to_F[res_graph.head(e)]);
845 original_edge.update();
846 original_edge.set(f, e);
847 residual_capacity.update();
848 residual_capacity.set(f, res_graph.resCap(e));
850 if (dist[res_graph.head(e)]==(dist[res_graph.tail(e)]+1)) {
851 typename MG::Edge f=F.addEdge(res_graph_to_F[res_graph.tail(e)], res_graph_to_F[res_graph.head(e)]);
852 original_edge.update();
853 original_edge.set(f, e);
854 residual_capacity.update();
855 residual_capacity.set(f, res_graph.resCap(e));
860 } //computing distances from s in the residual graph
866 //computing blocking flow with dfs
867 DfsIterator< MG, typename MG::template NodeMap<bool> > dfs(F);
868 typename MG::template NodeMap<typename MG::Edge> pred(F);
869 pred.set(sF, INVALID);
870 //invalid iterators for sources
872 typename MG::template NodeMap<Num> free(F);
874 dfs.pushAndSetReached(sF);
875 while (!dfs.finished()) {
877 if (F.valid(/*typename MG::OutEdgeIt*/(dfs))) {
878 if (dfs.isBNodeNewlyReached()) {
879 typename MG::Node v=F.aNode(dfs);
880 typename MG::Node w=F.bNode(dfs);
882 if (F.valid(pred[v])) {
883 free.set(w, std::min(free[v], residual_capacity[dfs]));
885 free.set(w, residual_capacity[dfs]);
894 F.erase(/*typename MG::OutEdgeIt*/(dfs));
900 typename MG::Node n=tF;
901 Num augment_value=free[tF];
902 while (F.valid(pred[n])) {
903 typename MG::Edge e=pred[n];
904 res_graph.augment(original_edge[e], augment_value);
906 if (residual_capacity[e]==augment_value)
909 residual_capacity.set(e, residual_capacity[e]-augment_value);
923 template <typename Graph, typename Num, typename CapMap, typename FlowMap>
924 bool MaxFlow<Graph, Num, CapMap, FlowMap>::augmentOnBlockingFlow2()
928 ResGW res_graph(*g, *capacity, *flow);
930 //ReachedMap level(res_graph);
931 FOR_EACH_LOC(typename Graph::NodeIt, e, *g) level.set(e, 0);
932 BfsIterator<ResGW, ReachedMap> bfs(res_graph, level);
934 bfs.pushAndSetReached(s);
935 DistanceMap<ResGW> dist(res_graph);
936 while ( !bfs.finished() ) {
937 ResGWOutEdgeIt e=bfs;
938 if (res_graph.valid(e) && bfs.isBNodeNewlyReached()) {
939 dist.set(res_graph.head(e), dist[res_graph.tail(e)]+1);
942 } //computing distances from s in the residual graph
944 //Subgraph containing the edges on some shortest paths
945 ConstMap<typename ResGW::Node, bool> true_map(true);
946 typedef SubGraphWrapper<ResGW, ConstMap<typename ResGW::Node, bool>,
947 DistanceMap<ResGW> > FilterResGW;
948 FilterResGW filter_res_graph(res_graph, true_map, dist);
950 //Subgraph, which is able to delete edges which are already
952 typename FilterResGW::template NodeMap<typename FilterResGW::OutEdgeIt>
953 first_out_edges(filter_res_graph);
954 typename FilterResGW::NodeIt v;
955 for(filter_res_graph.first(v); filter_res_graph.valid(v);
956 filter_res_graph.next(v))
958 typename FilterResGW::OutEdgeIt e;
959 filter_res_graph.first(e, v);
960 first_out_edges.set(v, e);
962 typedef ErasingFirstGraphWrapper<FilterResGW, typename FilterResGW::
963 template NodeMap<typename FilterResGW::OutEdgeIt> > ErasingResGW;
964 ErasingResGW erasing_res_graph(filter_res_graph, first_out_edges);
971 //computing blocking flow with dfs
972 DfsIterator< ErasingResGW,
973 typename ErasingResGW::template NodeMap<bool> >
974 dfs(erasing_res_graph);
975 typename ErasingResGW::
976 template NodeMap<typename ErasingResGW::OutEdgeIt>
977 pred(erasing_res_graph);
978 pred.set(s, INVALID);
979 //invalid iterators for sources
981 typename ErasingResGW::template NodeMap<Num>
982 free1(erasing_res_graph);
984 dfs.pushAndSetReached(
985 typename ErasingResGW::Node(
986 typename FilterResGW::Node(
987 typename ResGW::Node(s)
991 while (!dfs.finished()) {
993 if (erasing_res_graph.valid(
994 typename ErasingResGW::OutEdgeIt(dfs)))
996 if (dfs.isBNodeNewlyReached()) {
998 typename ErasingResGW::Node v=erasing_res_graph.aNode(dfs);
999 typename ErasingResGW::Node w=erasing_res_graph.bNode(dfs);
1001 pred.set(w, /*typename ErasingResGW::OutEdgeIt*/(dfs));
1002 if (erasing_res_graph.valid(pred[v])) {
1003 free1.set(w, std::min(free1[v], res_graph.resCap(
1004 typename ErasingResGW::OutEdgeIt(dfs))));
1006 free1.set(w, res_graph.resCap(
1007 typename ErasingResGW::OutEdgeIt(dfs)));
1016 erasing_res_graph.erase(dfs);
1022 typename ErasingResGW::Node n=typename FilterResGW::Node(typename ResGW::Node(t));
1023 // typename ResGW::NodeMap<Num> a(res_graph);
1024 // typename ResGW::Node b;
1026 // typename FilterResGW::NodeMap<Num> a1(filter_res_graph);
1027 // typename FilterResGW::Node b1;
1029 // typename ErasingResGW::NodeMap<Num> a2(erasing_res_graph);
1030 // typename ErasingResGW::Node b2;
1032 Num augment_value=free1[n];
1033 while (erasing_res_graph.valid(pred[n])) {
1034 typename ErasingResGW::OutEdgeIt e=pred[n];
1035 res_graph.augment(e, augment_value);
1036 n=erasing_res_graph.tail(e);
1037 if (res_graph.resCap(e)==0)
1038 erasing_res_graph.erase(e);
1042 } //while (__augment)
1052 #endif //HUGO_MAX_FLOW_H