Skip to content

Ford-Fulkerson Method

Summarized notes on Introduction to Algorithms, Chapter 26

  • many implementations with varying running times → "method" not "algorithm"
  • 3 core ideas: residual networks, augmenting paths, cuts
  • iteratively increases the value of the flow
    • initially each edge has flow value 0
    • on each iteration increase flow value by finding augmenting path in residual network Gf
    • overall flow increases on each iteration; flows on specific edges may increase or decrease
    • augment the flow until residual network has no more augmenting paths
    • on termination this process yields a maximum flow
1
2
3
4
5
Ford-Fulkerson-method(G, s, t)
    initialize flow f to 0
    while there exists an augmenting path p in the residual network G_f
        augment flow f along p
    return f

Residual networks

  • Gf consists of edges with capacities that represent how we can change the flow on edges in G
  • Only edges in Gf are those that can admit more flow → edges of G that equal their capacity are not in Gf
  • Gf may contain edges that are not in G:
    • when flow value needs to decrease place edge (v,u) in Gf with capacity cf=f(u,v)
    • residual edges allow sending back flow that has been sent along an edge
  • residual capacity formal definition:
    • cf=c(u,v)f(u,v)     if (u,v)E
    • cf=f(v,u)                       if (v,u)E
    • cf=0                                  otherwise
    • note: only one can be true since no reverse edges!
  • residual network if Gf=(V,Ef) where
    • Ef=(U,v)V×C:cf(u,v)>0
    • only includes residual edges with capacity greater than 0
    • edges in Ef are either edges in E or their reversals → |Ef|2|E|
  • Residual network has same properties as a flow network BUT does not satisfy the definition because it can have reverse edges
  • augmentation of flow flow f by f:
    • (ff)(u,v)=f(u,v)+f(u,v)f(v,u)if(u,v)E
    • 0 otherwise
  • cancellation - pushing flow on the reverse edge in the residual network

img

Augmenting Paths

  • augmenting path is a simple path from s to t in residual network Gf
  • flow on edge (u,v) of augmenting path can be increased by up tp cf(u,v)
  • in image above: grey path is augmenting path
    • smallest residual capacity is 4
    • we can increase flow through each edge by 4
  • residual capacity of augmenting path p:
    cf(p)=min{cf(u,v):(u,v) is on p}
  • fp(u,v)=cf(p)     if (u,v) is on p; 0 otherwise

Cuts of flow networks

  • cut is a partition of flow network V into S and T=VS such that sS and tT
  • net flow across cut:
    f(S,T)=uSvTf(u,v)uSvTf(v,u)

  • capacity of cut:
    c(S,T)=uSvTc(u,v)

  • for capacity only count edges from S to T

  • for flow consider edges from S to T minus reverse edges from T to S
  • minimum cut is a cut whose capacity is minimum over all cuts of the network
  • for a given flow f the net flow across any cut is the same and equals |f| value of flow → let (S,T) be some cut of G, then f(S,T)=|f|

img

Max-flow min-cut theorem

  • flow is maximum iff residual network contains no augmenting paths
  • more formally, following conditions are equivalent:
    1. f is the maximum flow in G
    2. The residual network Gf contains no augmenting paths
    3. |F|=c(S,T) for some cut (S,T) of G

Basic Ford-Fulkerson algorithm

  • in each iteration: find some augmenting path p and use p to modify flow f
  • each edge in p is an edge in either G or Gf
  • cf(p) - temporary variable that stores residual capacity
  • update flow attribute (u,v).f for each edge (u,v)E
  • done when no more augmenting paths exist → result is the maximum flow

Pseudo code implementation

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
Ford-Fulkerson(G, s, t)
    for each edge (u, v) \in G.E
        (u.v).f = 0
    while there exists a path p from s to t in the residual network G_f
        c_f(p) = min{ c_f(u, v) : (u, v) is in p }
        for each edge (u, v) in p
            if (u, v) in E
                (u, v).f = (u, v).f + c_f(p)
            else
                (v, u).f = (v, u).f - c_f(p)

Example

img

img

Edmonds-Karp algorithm

  • use BFS to find augmenting path
    • each edge has unit weight
    • choose shortest path from s to t in residual network
  • total number of flow augmentations is O(VE)
  • critical edge of augmenting path: cf(p)=cf(u,v)
    • after augmenting the path this critical edge is no longer in Gf
    • at least one edge on any augmenting path must be critical
    • edge can become critical at most |V|/2 times

Complexity

Running time algorithm
O(Ef) DFS
O(VE2) Edmonds-Karp algorithm
O(V2E), O(V3) Push-relabel algorithms