/**
* Performs one iteration of the algorithm. The EdgeIterator it
* returns contains the edges that were part of the associated path
* from the source to the dest.
*
* @return EdgeIterator over the edges considered in the augmenting path */
public final EdgeIterator doOneIteration()
throws jdsl.graph.api.InvalidEdgeException {
EdgeIterator returnVal;
runDijkstraOnResidualNetwork();
updateDistances();
// check to see if an augmenting path exists
if (distance(dest_) < INFINITY) {
EdgeIterator pathIter = dijkstra_.reportPath();
int maxFlow = dijkstra_.reportPathFlow(dest_);
maximumFlow_ += maxFlow;
// push maxFlow along path now
while (pathIter.hasNext()) {
// check if it is a forward edge
Edge e = pathIter.nextEdge();
if (isForwardEdge(e)) {
setFlow(e, flow(e) + maxFlow);
} else {
setFlow(e, flow(e) - maxFlow);
}
}
pathIter.reset();
returnVal = pathIter;
} else {
finished();
returnVal = new EdgeIteratorAdapter(new ArrayObjectIterator(new Object[0]));
}
return returnVal;
}