More Common Definitions

The Residual Capacity is more commonly defined as:

  • or

Also here we require that the flow network is bidirectional, which is not a common requirement.


Flow Network

  • A network is a directed graph with a non-negative capacity function
  • A flow network is a network with a source vertex and a sink vertex , and it is denoted by .
  • A flow in a flow network is a function that satisfies the following properties:
    • Capacity constraint: .
    • Bidirectional Network: .
      • (If , but , then we add the edge with capacity )
    • Flow conservation: , where:
      • .
    • Opposite Flow Offset: For each edge , At most one of and is positive.
      • (If , then we adjust a new flow as follows: , )
  • The value of a flow is (Usually, )

Residual Network

  • The residual network (of a flow network with a flow ) is defined as , where, is the residual capacity function defined as .

  • An augmenting path is a path in such that . - The bottleneck of an augmenting path is the minimum residual capacity of the edges in the path: .

Cut

  • A cut in a flow network is a set such that and .
    • The set is the set of edges from to .
    • The set is the set of edges from to .
  • A minimum cut is a cut such that is minimized.
  • , for any cut and flow .
  • , for any cut and flow .
  • If , then is a maximum flow and is a minimum cut.
  • (Max-Flow Min-Cut Theorem) For any flow , the following are equivalent:
    • is a maximum flow
    • There is no augmenting path in the residual network of
    • There is a cut such that
  • When the Ford-Fulkerson algorithm terminates, the current flow is the maximum flow.
  • If and are minimum cuts, then both and are minimum cuts.

Maximal Flow Problem

  • Input: A flow network .
  • Output: A flow of maximum value.

Ford-Fulkerson Algorithm

Augmenting Paths

Augment(f,P):
	b = bottleneck(P)
	for all e in P:
	    if e is forward in P:
	      f(e) += b
	    else:
	      f(e) -= b 

Naive Implementation

Ford_Fulkerson(G=(V,E), c, s, t):
	for all e ∈ E # Initialize flow on all edges to 0
	    f(e) ← 0 
	
	while there exists an augmenting path P do
		augment(f, P) # Augment the flow along the path P
 
	return f 
  • (Theorem) At every intermediate stage of the Ford-Fulkerson algorithm, the flow values are integers.
  • (Theorem) The Ford-Fulkerson algorithm terminates in at most iterations, where .

Scaling Ford-Fulkerson Algorithm

Scaling_Max_Flow(G=(V,E), c, s, t):
	C ← max{c(e) : e ∈ E}  # The maximum capacity in the network
	for all e ∈ E # Initialize flow on all edges to 0
		f(e) ← 0 
	# Iterate over powers of 2
	for i=floor(log C) downto i=0, do: # O(log C) iterations 
		# Set the current width threshold  
	    Δ ← 2^i                 
	    while there exists an augmenting path P with width ≥ Δ do # O(E)
		    # Augment the flow along the path P
	        Augment(f, P, Δf(P)) # O(E)
	# Return the computed max flow
	return f 

Edmonds-Karp Algorithm

  • stronger polynomial time complexity
  • Uses BFS to find the shortest augmenting path
Edmonds_Karp(G=(V,E), c, s, t):
	while there exists an augmenting path do
		P ← BFS(G_f, s, t) # Find the shortest augment path
		Augment(f, P) # Augment the flow along the path P
	return f