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
- 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 |
|
Residual networks
consists of edges with capacities that represent how we can change the flow on edges in- Only edges in
are those that can admit more flow → edges of that equal their capacity are not in may contain edges that are not in :- when flow value needs to decrease place edge
in with capacity - residual edges allow sending back flow that has been sent along an edge
- when flow value needs to decrease place edge
- residual capacity formal definition:
if if otherwise- note: only one can be true since no reverse edges!
- residual network if
where- only includes residual edges with capacity greater than 0
- edges in
are either edges in or their reversals →
- 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
by :- 0 otherwise
- cancellation - pushing flow on the reverse edge in the residual network
Augmenting Paths
- augmenting path is a simple path from
to in residual network - flow on edge
of augmenting path can be increased by up tp - 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
:
is on if is on ; 0 otherwise
Cuts of flow networks
- cut is a partition of flow network
into and such that and -
net flow across cut:
-
capacity of cut:
-
for capacity only count edges from
to - for flow consider edges from
to minus reverse edges from to - minimum cut is a cut whose capacity is minimum over all cuts of the network
- for a given flow
the net flow across any cut is the same and equals value of flow → let be some cut of , then
Max-flow min-cut theorem
- flow is maximum iff residual network contains no augmenting paths
- more formally, following conditions are equivalent:
is the maximum flow in- The residual network
contains no augmenting paths for some cut of
Basic Ford-Fulkerson algorithm
- in each iteration: find some augmenting path
and use to modify flow - each edge in
is an edge in either or - temporary variable that stores residual capacity- update flow attribute
for each edge - 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 |
|
Example
Edmonds-Karp algorithm
- use BFS to find augmenting path
- each edge has unit weight
- choose shortest path from
to in residual network
- total number of flow augmentations is
- critical edge of augmenting path:
- after augmenting the path this critical edge is no longer in
- at least one edge on any augmenting path must be critical
- edge can become critical at most
times
- after augmenting the path this critical edge is no longer in
Complexity
Running time | algorithm |
---|---|
DFS | |
Edmonds-Karp algorithm | |
Push-relabel algorithms |