Presentation is loading. Please wait.

Presentation is loading. Please wait.

CSCE 3110 Data Structures & Algorithm Analysis Graphs (I) Reading: Chap.9, Weiss.

Similar presentations


Presentation on theme: "CSCE 3110 Data Structures & Algorithm Analysis Graphs (I) Reading: Chap.9, Weiss."— Presentation transcript:

1 CSCE 3110 Data Structures & Algorithm Analysis Graphs (I) Reading: Chap.9, Weiss

2 Network reliability. Distributed computing. Many many more... Maximum Flow and Minimum Cut Max flow and min cut. Two algorithmic problems. See Cormen et.al for more details Nontrivial applications / reductions. Network connectivity. Traffic control Data mining. Airline scheduling. Project selection. General scheduling

3 Max flow network: G = (V, E, s, t, u). (V, E) = directed graph, no parallel arcs. Two distinguished nodes: s = source, t = sink. u(e) = capacity of arc e. Max Flow Network Capacity s 2 3 4 5 6 7 t 15 5 30 15 10 8 15 9 6 10 15 4 4

4 An s-t flow is a function f: E   that satisfies: For each e  E: 0  f(e)  u(e) (capacity) For each v  V – {s, t}: (conservation) Flows s 2 3 4 5 6 7 t 15 5 30 15 10 8 15 9 6 10 15 4 4 4 0 0 0 0 0 0 0 4 4 0 4 0 0 0 Capacity Flow

5 An s-t flow is a function f: E   that satisfies: For each e  E: 0  f(e)  u(e) (capacity) For each v  V – {s, t}: (conservation) Flows s 2 3 4 5 6 7 t 15 5 30 15 10 8 15 9 6 10 15 4 4 4 0 0 0 0 0 0 0 4 4 0 4 0 0 0 Capacity Flow Value = 4 MAX FLOW: find s-t flow that maximizes net flow out of the source.

6 An s-t flow is a function f: E   that satisfies: For each e  E: 0  f(e)  u(e) (capacity) For each v  V – {s, t}: (conservation) Flows MAX FLOW: find s-t flow that maximizes net flow out of the source. s 2 3 4 5 6 7 t 15 5 30 15 10 8 15 9 6 10 15 4 4 10 6 6 11 1 10 3 8 8 0 4 0 Value = 24 0 0 Capacity Flow

7 An s-t flow is a function f: E   that satisfies: For each e  E: 0  f(e)  u(e) (capacity) For each v  V – {s, t}: (conservation) Flows MAX FLOW: find s-t flow that maximizes net flow out of the source. s 2 3 4 5 6 7 t 15 5 30 15 10 8 15 9 6 10 15 4 4 10 9 9 14 4 10 4 8 9 1 0 0 Value = 28 0 0 Capacity Flow

8 Networks Flow Examples communication Network telephone exchanges, computers, satellites NodesArcs cables, fiber optics, microwave relays Flow voice, video, packets circuits gates, registers, processors wirescurrent mechanicaljointsrods, beams, springsheat, energy hydraulic reservoirs, pumping stations, lakes pipelinesfluid, oil financialstocks, currencytransactionsmoney transportation airports, rail yards, street intersections highways, railbeds, airway routes freight, vehicles, passengers chemicalsitesbondsenergy

9 An s-t cut is a node partition (S, T) such that s  S, t  T. The capacity of an s-t cut (S, T) is: Min s-t cut: find an s-t cut of minimum capacity. Cuts s 2 3 4 5 6 7 t 15 5 30 15 10 8 15 9 6 10 15 4 4 Capacity = 30

10 Cuts s 2 3 4 5 6 7 t 15 5 30 15 10 8 15 9 6 10 15 4 4 Capacity = 62 An s-t cut is a node partition (S, T) such that s  S, t  T. The capacity of an s-t cut (S, T) is: Min s-t cut: find an s-t cut of minimum capacity.

11 Cuts s 2 3 4 5 6 7 t 15 5 30 15 10 8 15 9 6 10 15 4 4 Capacity = 28 An s-t cut is a node partition (S, T) such that s  S, t  T. The capacity of an s-t cut (S, T) is: Min s-t cut: find an s-t cut of minimum capacity.

12 L1. Let f be a flow, and let (S, T) be a cut. Then, the net flow sent across the cut is equal to the amount reaching t. Flows and Cuts s 2 3 4 5 6 7 t 15 5 30 15 10 8 15 9 6 10 15 4 4 Value = 24 10 6 6 0 4 8 8 0 4 0 0 0

13 6 6 0 4 8 8 0 4 0 0 0 Flows and Cuts s 2 3 4 5 6 7 t 15 5 30 15 10 8 15 9 6 10 15 4 4 Value = 24 L1. Let f be a flow, and let (S, T) be a cut. Then, the net flow sent across the cut is equal to the amount reaching t.

14 10 6 6 0 4 8 8 0 4 0 0 Flows and Cuts s 2 3 4 5 6 7 t 15 5 30 15 10 8 15 9 6 10 15 4 4 Value = 24 0 L1. Let f be a flow, and let (S, T) be a cut. Then, the net flow sent across the cut is equal to the amount reaching t.

15 Let f be a flow, and let (S, T) be a cut. Then, Proof by induction on |S|. Base case: S = { s }. Inductive hypothesis: assume true for |S’| = k-1. consider cut (S, T) with |S| = k S = S'  { v } for some v  s, t, |S' | = k-1  cap(S', T') = | f |. adding v to S' increase cut capacity by Flows and Cuts s v t After s v t S' Before S

16 L2. Let f be a flow, and let (S, T) be a cut. Then, | f |  cap(S, T). Proof. Corollary. Let f be a flow, and let (S, T) be a cut. If |f| = cap(S, T), then f is a max flow and (S, T) is a min cut. Flows and Cuts s t S T 7 6 8 4

17 Max Flow and Min Cut Corollary. Let f be a flow, and let (S, T) be a cut. If |f| = cap(S, T), then f is a max flow and (S, T) is a min cut. s 2 3 4 5 6 7 t 15 5 30 15 10 8 15 9 6 10 15 4 4 10 9 9 15 4 10 4 8 9 1 0 0 Flow value = 28 0 0 Cut capacity = 28

18 Max-Flow Min-Cut Theorem MAX-FLOW MIN-CUT THEOREM (Ford-Fulkerson, 1956): In any network, the value of the max flow is equal to the value of the min cut. s 2 3 4 5 6 7 t 15 5 30 15 10 8 15 9 6 10 15 4 4 10 9 9 15 4 10 4 8 9 1 0 0 Flow value = 28 0 0 Cut capacity = 28

19 Max-Flow Min-Cut Theorem Intuitive Proof: Lemma 2  | f |  cap(S, T). Max for |f| is a certain cut C where Max|f| = C Min cut for cap(S,T) is a certain flow F where |f| = Min cut |f|  Max |f| = C  Min cut(S,T)  Max |f|  Min cut(S,T) L2  Max |f|  Min cut(S,T)  Max |f| = Min cut(S,T)


Download ppt "CSCE 3110 Data Structures & Algorithm Analysis Graphs (I) Reading: Chap.9, Weiss."

Similar presentations


Ads by Google