7 IUION MXIMUM FLOW Raymond han raychan.github.io/cs7/fa7.html U erkeley Fall 7
MXIMUM FLOW Given a directed graph G = (V, E), send as many units of flow from source node s to sink node t. Edges have capacity constraints. When sending flow through some path, flow must be at most the capacity constraint of every edge. Number of units sent from s = number of units received by t. pplications: supply chain shipping, network flows, supply and demand shipping (need modification). Raymond han, U erkeley Fall 7
MXIMUM FLOW Max Flow Linear Program Raymond han, U erkeley Fall 7
REIUL GRPH When sending f uv through edge (u, v), we create a residual back edge (v, u). apacity of (u, v) = c uv - f uv apacity of (v, u) = f uv Keep sending flows from s to t. Once we have no path from s to t, we have the maximum flow. Edges can be removed if capacity reaches. his will ensure we won t have a path eventually. an use residual edges later to go back on previous flow decisions. Raymond han, U erkeley Fall 7
MX FLOW LGORIHM Ford-Fulkerson algorithm. In each iteration, send as many units of flow as possible and build residual graph. top condition: no s-t path in residual graph. Edmond-Karp algorithm. Find shortest s-t path via F in terms of edge hops. end as many units of flow as possible and build residual graph until no s-t path. If capacities are integral, solution flows are integral, runtime is O( V E ). Raymond han, U erkeley Fall 7
Raymond han, U erkeley Fall 7 MX FLOW REIUL GRPH EXMPLE
MX FLOW REIUL GRPH EXMPLE Raymond han, U erkeley Fall 7
MX FLOW REIUL GRPH EXMPLE Raymond han, U erkeley Fall 7
MX FLOW REIUL GRPH EXMPLE uppose we send units through first. Raymond han, U erkeley Fall 7
MX FLOW REIUL GRPH EXMPLE end units via. Raymond han, U erkeley Fall 7
Raymond han, U erkeley Fall 7 MX FLOW REIUL GRPH EXMPLE end units via.
Raymond han, U erkeley Fall 7 MX FLOW REIUL GRPH EXMPLE end units via. end units via.
Raymond han, U erkeley Fall 7 MX FLOW REIUL GRPH EXMPLE end units via. end units via.
Raymond han, U erkeley Fall 7 MX FLOW REIUL GRPH EXMPLE end units via. end units via.
Raymond han, U erkeley Fall 7 MX FLOW REIUL GRPH EXMPLE end units via. end units via. end unit via.
Raymond han, U erkeley Fall 7 end units via. end units via. end unit via. MX FLOW REIUL GRPH EXMPLE
Raymond han, U erkeley Fall 7 MX FLOW REIUL GRPH EXMPLE end units via. end units via. end unit via.
Raymond han, U erkeley Fall 7 MX FLOW REIUL GRPH EXMPLE end units via. end units via. end unit via. end unit via.
Raymond han, U erkeley Fall 7 MX FLOW REIUL GRPH EXMPLE end units via. end units via. end unit via. end unit via.
MX FLOW REIUL GRPH EXMPLE end units via. end units via. end unit via. end unit via. Raymond han, U erkeley Fall 7
MX FLOW REIUL GRPH EXMPLE end units via. end units via. end unit via. end unit via. No more s-t path. Maximum flow is 6. fter computing max flow, output edges with their respective flows (see flow graph). Raymond han, U erkeley Fall 7
MINIMUM U cut partitions the vertices into two disjoint sets L and R. he capacity of a cut is the sum of edges that crosses the cut (go from L to R). (s, t)-cut partitions graph such that L contains s and all vertices s can reach and R contain t and all vertices that can reach t. For any flow f and any (s, t)-cut (L, R), size(f) capacity(l, R). he capacity of the cuts provide an upper bound of the maximum flow. ize of maximum flow equals to capacity of smallest s-t cut. Raymond han, U erkeley Fall 7
MINIMUM U {} and {,,,, } forms a min cut. {,,,, } and {} forms another min cut. Minimum cut will contain only edges in the residual graph that goes from R to L. In the original graph, only edges from L to R in the minimum cut. hese edges are fully saturated (at full capacity). Raymond han, U erkeley Fall 7
REUION When using Max Flow to solve problems, make use of reduction. Reduction: solve problem by solving problem. uppose we have a problem, Preprocess input to fit inputs for problem (suppose max flow). olve problem. Postprocess output of problem to fit output of problem. Example. Use Max flow to solve network flows with supply and demand nodes. Raymond han, U erkeley Fall 7