Download presentation
Presentation is loading. Please wait.
Published byFanny Hartanto Modified over 6 years ago
1
CSE Algorithms Max Flow Problems 11/21/02 CSE Max Flow
2
Max Flow problem Input: a directed graph with a non-negative weight (capacity) on each edge, and a designated source node s and sink node t. A flow assigns to each edge a number (from 0 to its capacity) such that for each node except s and t, the sum of the flow into the node equals sum of the flow out. [The fine print: this is slightly different from the book’s definition.] The value of a flow is the sum of the flow out of the source (which equals total flow into the sink). Maximum-Flow problem: find a flow with the maximum possible value. Note: A max flow can assign 0 to each edge going into the source, and to each edge going out of the sink. CSE Max Flow
3
The text’s formulation doesn’t even let it happen.
Example 12 a c 16 20 4 9 t s 10 7 sink 4 source 13 d b 14 12 a c 10 14 s 2 4 t 2 4 This is wasteful! The text’s formulation doesn’t even let it happen. 8 d b 6 A flow of value 18 CSE Max Flow
4
Leftover capacity Residual network 12-12 a c 20-14 16-10 9-0 t s 10-2
4-4 7-2 sink 4-4 source 13-8 d b 14-6 New backedge showing we can reduce forward flow by 10 a c 6 6 12 10 9 14 2 t s 8 5 2 8 4 6 5 d b 8 Residual network CSE Max Flow
5
Augmenting Path New residual network a c 6 6 12 10 9 14 t s 8 2 5 2 8
We can push 5 more through network on indicated path (New flow has value 23.) a c 6 6 12 10 9 14 t s 8 2 5 2 8 4 6 5 d b 8 a c 6 1 12 10 9 19 t s 8 2 7 13 4 11 d b Now we’re stuck! We can’t get any more across cut. 3 New residual network CSE Max Flow
6
Duality: Max Flow = Min Cut
Original problem had a cut of value 23. We can’t possibly get more from source to sink. Theorem: Max flow = min cut Proof: Obviously, any flow min cut. But if max flow < min cut, there would be an augmenting path from source to sink, leading to a higher-valued flow. This is a contradiction. Thus, max flow = min cut. QED. 12 a c 16 20 s 10 4 9 t 7 4 13 d b 14 CSE Max Flow
7
Ford-Fulkerson Methods
initialize flow to 0; while (there’s an augmenting path){ update flow; compute new residual graph; } If there are several augmenting paths, does it matter which we pick?? a 100 100 1 t s 1 100 100 b CSE Max Flow
8
Edmonds-Karp Algorithm
Always choose an augmenting path with as few edges as possible (say it has L edges). This might create a new backedge, e.g (v,u). This new edge can’t be in a new path of L edges.. (Handle multiple new backedges by induction proof.) Meanwhile, at least one original edge has been eliminated. Thus, there are at most E iterations using L long paths. k long path m long v v t t s s n long u u j long path m j+1 and n k+1 so m+n > j+k+1 = L j+1+k is a minimal length path (L) CSE Max Flow
9
Edmonds-Karp Algorithm
Always choose an augmenting path with as few edges as possible. At most E iterations use L-edge augmenting path Longest augmenting path has V-1 edges. Thus, there are at most O(VE) augmentations. How long does it take to find and process a shortest augmenting path?? CSE Max Flow
10
Max Flow Algorithms Edmonds-Karp is O(VE2)
Some faster algorithms based on “Push-Relabel”. E.g. Goldberg’s algorithm is O(V2E) Start source at height V, all others at 0 Add in flow from higher nodes to lower ones. If a non-sink node can’t push all its incoming flow out, increase it’s height. When done, return excess back to source. Carefully choosing order gives O(V3) algorithm. Fastest known algorithm is O( min(V2/3, E1/2) E lg(1+V2/E) lg(max capacity) ). CSE Max Flow
11
An Application Maximum matching problem:
Given an (undirected) graph (V,E) find a maximum-sized set of disjoint edges. Not the same as a maximal set of disjoint edges. Amazingly, not NP-complete (but it’s not easy) Bipartite graph: Graph such that you can partition the nodes V = V1 U V2, and every edge goes between a node of V1 and one of V2. Maximum matching for a bipartite graph can be reduced to a max flow problem. CSE Max Flow
12
Glossary (in case symbols are weird)
subset element of infinity empty set for all there exists intersection union big theta big omega summation >= <= about equal not equal natural numbers(N) reals(R) rationals(Q) integers(Z) CSE Max Flow
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.