src/work/edmonds_karp.hh
changeset 142 01d47457aff3
parent 137 6364b07f8cd4
child 148 004fdf703abb
equal deleted inserted replaced
11:1a9a18a884ef 12:72cee5ee3acb
   526       
   526       
   527       typename AugGraph::NodeMap<Number> free(res_graph);
   527       typename AugGraph::NodeMap<Number> free(res_graph);
   528 	
   528 	
   529       //searching for augmenting path
   529       //searching for augmenting path
   530       while ( !res_bfs.finished() ) { 
   530       while ( !res_bfs.finished() ) { 
   531 	AugOutEdgeIt e=AugOutEdgeIt(res_bfs);
   531 	AugOutEdgeIt e=/*AugOutEdgeIt*/(res_bfs);
   532 	if (e.valid() && res_bfs.isBNodeNewlyReached()) {
   532 	if (e.valid() && res_bfs.isBNodeNewlyReached()) {
   533 	  NodeIt v=res_graph.tail(e);
   533 	  NodeIt v=res_graph.tail(e);
   534 	  NodeIt w=res_graph.head(e);
   534 	  NodeIt w=res_graph.head(e);
   535 	  pred.set(w, e);
   535 	  pred.set(w, e);
   536 	  if (pred.get(v).valid()) {
   536 	  if (pred.get(v).valid()) {
   554 	}
   554 	}
   555       }
   555       }
   556 
   556 
   557       return _augment;
   557       return _augment;
   558     }
   558     }
       
   559 
   559     template<typename MutableGraph> bool augmentOnBlockingFlow() {
   560     template<typename MutableGraph> bool augmentOnBlockingFlow() {
   560       bool _augment=false;
   561       bool _augment=false;
   561 
   562 
   562       AugGraph res_graph(G, flow, capacity);
   563       AugGraph res_graph(G, flow, capacity);
   563 
   564 
   565       BfsIterator4< AugGraph, AugOutEdgeIt, ReachedMap > bfs(res_graph);
   566       BfsIterator4< AugGraph, AugOutEdgeIt, ReachedMap > bfs(res_graph);
   566 
   567 
   567       bfs.pushAndSetReached(s);
   568       bfs.pushAndSetReached(s);
   568       typename AugGraph::NodeMap<int> dist(res_graph); //filled up with 0's
   569       typename AugGraph::NodeMap<int> dist(res_graph); //filled up with 0's
   569       while ( !bfs.finished() ) { 
   570       while ( !bfs.finished() ) { 
   570 	AugOutEdgeIt e=AugOutEdgeIt(bfs);
   571 	AugOutEdgeIt e=/*AugOutEdgeIt*/(bfs);
   571 	if (e.valid() && bfs.isBNodeNewlyReached()) {
   572 	if (e.valid() && bfs.isBNodeNewlyReached()) {
   572 	  dist.set(res_graph.head(e), dist.get(res_graph.tail(e))+1);
   573 	  dist.set(res_graph.head(e), dist.get(res_graph.tail(e))+1);
   573 	}
   574 	}
   574 	
   575 	
   575 	++bfs;
   576 	++bfs;
   791       
   792       
   792       typename AugGraph::NodeMap<Number> free(res_graph);
   793       typename AugGraph::NodeMap<Number> free(res_graph);
   793 	
   794 	
   794       //searching for augmenting path
   795       //searching for augmenting path
   795       while ( !res_bfs.finished() ) { 
   796       while ( !res_bfs.finished() ) { 
   796 	AugOutEdgeIt e=AugOutEdgeIt(res_bfs);
   797 	AugOutEdgeIt e=/*AugOutEdgeIt*/(res_bfs);
   797 	if (e.valid() && res_bfs.isBNodeNewlyReached()) {
   798 	if (e.valid() && res_bfs.isBNodeNewlyReached()) {
   798 	  NodeIt v=res_graph.tail(e);
   799 	  NodeIt v=res_graph.tail(e);
   799 	  NodeIt w=res_graph.head(e);
   800 	  NodeIt w=res_graph.head(e);
   800 	  pred.set(w, e);
   801 	  pred.set(w, e);
   801 	  if (pred.get(v).valid()) {
   802 	  if (pred.get(v).valid()) {