Network Flow
Network Flow I
Max-Flow and Min-Cut Problems
Flow Network
A flow network is a tuple
- Digraph with source (assume all nodes are reachable from ) and sink
- Capacity for each . (integer)
Intuition: material flowing through a transportation network; material originates at source and is sent to sink.
Maximum-Flow Problem
A -flow (flow) is a function that satisfies:
- for each , (capacity)
- for each : (flow conservation, meaning for every node not inclouding the source and the sink, the inflow must equal outflow)
Capacity is how much the edge can support and flow is how much is used.
The value of a flow is
- is always zero because there is no flow going into the source.
- this is the number you want to maximize.
Maximum-flow problem is to find a flow of maximum value
Minimum-Cut Problem
An -cut (cut) is a partition of the nodes with and .
Its capacity is the sum of the capacities of the edges from to .
Ford-Fulkerson
Greedy algorithm:
- start with for each edge
- Find an path where each edge has .
- Augment flow along path
- Repeat until you get stuck
However, this algorithm may fail. Why?
- Once greedy algorithm increases flow on an edge, it never decreases it.
- We need some mechanism to "undo" a bad decision.
Residue Netowrk
Defining residue network
When ever you send some flow across a pipe, you create a back pipe that has the same flow in the opposite direction.
The original edge
- flow would be
- capacity .
The reverse edge
- "undos" the flow sent
The residue capacity:
Residual network:
- $E_f = {e:f(e) < c(e)} \cup {e: f(e^{reverse}) > 0}
Defining augmenting path, a simple path in the residual network .
The bottleneck capacity of an augmenting path is the minimum residual capacity of any edge in .
Key property: let be the flow and let be an augmenting path in . Then, after calling the resulting is a flow and .
Augment()
- bottleneck capacity of augmenting path
- For each edge
- If ()
- Else
- Return .
Ford-Fulkerson Algorithm
Ford-fulkerson augmenting path algorithm:
- start with for each edge .
- find an path in the residual network .
- augment flow along path
- repeat until you get stuck
Ford-Fulkerson()
- For each edge :
- residual network of with respect to flow .
- While (there exists an path in )
- Augment().
- Update
- Return .
Max-flow min-cut theorem
Flow value lemma: Let be any flow and let be any cut, then the value of the flow equals the netflow across the cut .
Weak duality says that let be any flow and be any cut. Then, . Proof using the flow value lemma: \begin{align} val(f) &= \sum_{e \text{ out of } A} f(e) - \sum_{e \text{ in to } A} f(e) \\ &\leq \sum_{e \text{ out of } A} f(e) \\ &\leq \sum_{e \text{ out of } A} c(e) \\ &= cap(A,B) \end{align}
In other words, the value of the flow is always less than or equal to the capacity of the cut
Certificate of optimality The collorary: let be a flow and let be a min cut. If then is a max flow and is a min cut.
Proof:
- for any flow : . (this comes from weak duality). Essentially, .
- for any cut : This implies that is the min cut.
The max-flow min-cut theorem says that the value of the max flow = capacity of a min cut (with strong duality).
Augmenting path thoerem: a flow is a max flow iff no augmenting paths. Proof: the following three conditions are equivalent for any flow :
- there exists a cut such taht
- is a max flow
- there is no augmenting path with respect to (if ford-fulkerson terminates, then is max flow)
because this is the weak duality corollary. because we prove the contrapositive
- suppose that there is an augmenting path with repsect to
- can improve flow by sending flow along this path
- thus, is not max flow.
- let be a flow with no augmenting paths
- let set of nodes reachable from in residual network .
- by definition of :
- by definition of flow : .
Baseball Eliminations
Figure out which teams have a chance of finishing the season with the most wins. We can observe that some teams are mathematically eliminated. Their maximum wins is still less than another team's minimum wins.
- the answer depends not only on how many games they already won and left to play, but on whom they're against.
Linked from Algorithms