NETWORK FLOW

Ford-Fulkerson Method

      Basic of Ford-Fulkerson

As we proved previously, when there's some augmenting path in Gf, we can improve the current flow.

So the basic idea of Ford-Fulkerson method is: when there's an augmenting path, improve it, repeat until no augmenting path.

FORD-FULKERSON (G, s, t)

for each edge (u,v) ∈ G.E

    (u,v).f = 0

while there exists a path p from s to t in the residual network Gf

    cf(p) = min{ cf(u,v) : (u,v) is in p }

    for each edge (u,v) in p

        if (u,v) ∈ E

            (u,v).f = (u,v).f + cf(p)

        else (u,v).f = (u,v).f - cf(p)

      Demo of Ford-Fulkerson

Try the Algorithm here

Graph G with flow

flow_initial

Residual Network

res_initial

      Runtime of Ford-Fulkerson

As seen above, the runtime depends on how to find an augmenting path in Gf

And we saw in the demo, at some steps in the middle maybe we need to redo some steps and cancell some flow

Suppose f* denotes a maximum flow in the transformed network, this loop of find and augment execute at most |f*| times

Since the flow value increase by at lease 1 each iteration

In each iternation, assume we put all possible edges, both (u,v) and (v,u), into a data structure and do a BFS or DFS to find a path

The time to find a path is O(V + E'), where E' ≤ 2E for edges in both directions in residual network.

O(V + E') = O(2E) = O(E)

Since the initialize part also takes O(E), total runtime will be O(E) + O(|f*|) * O(E) = O(E|f*|).

Yuye.Jiang@tufts.edu       Comp150-ALG-Summer2020