Network Flow and Connectivity in Wireless Sensor Networks Youn-Hee Han yhhan@kut.ac.kr Korea University of Technology and Education Laboratory of Intelligent Networks (LINK) http://link.kut.ac.kr Edited and Copied From Slides by Kevin Wayne
Max Flow [Definition] Flow network: Features: an edge-capacitated directed graph, with two distinguished vertices called the source and the sink. Features: Abstraction for material flowing through the edges. G = (V, E) = directed graph Two distinguished nodes: s = source, t = sink. c(e) = capacity of edge e. s 2 3 4 5 6 7 t 15 30 10 8 9 capacity source sink
Max Flow [Definition] flow: A flow in a network X is a function f that assigns to each edge e of the network a real number f(e), in such a way that: 4 capacity flow s 2 3 5 6 7 t 15 30 10 8 9
Max Flow [Definition] flow (or s-t flow): A flow in a network X is a function f that assigns to each edge e of the network a real number f(e), in such a way that: 4 capacity flow s 2 3 5 6 7 t 15 30 10 8 9
Max Flow [Definition] Value Q : The value Q of a flow in a network X is: 4 capacity flow s 2 3 5 6 7 t 15 30 10 8 9 Value Q = 4
Max Flow [Definition] Value Q : The value Q of a flow in a network X is: 10 6 11 1 3 8 capacity flow s 2 4 5 7 t 15 30 9 Value Q = 24
Max Flow [Definition] Max Flow Problem: find the maximum possible value Q of a flow in X and find a flow route of that value. 10 9 14 4 8 1 capacity flow s 2 3 5 6 7 t 15 30 Value Q = 28 (Max)
Min Cut [Definition] cut (A,B) (or s-t cut) : By a cut (A,B), we mean a partition (A, B) of V with s A and t B. [Definition] capacity of a cut The capacity of a cut (A, B) is: s 2 3 4 5 6 7 t 15 30 10 8 9 A cap(A,B) = 9 + 15 + 8 + 30 = 62
Min Cut [Definition] Min Cut Problem: find a cut of the minimum capacity in X s 2 3 4 5 6 7 t 15 30 10 8 9 A cap(A,B) = 10 + 8 + 10 = 28
Min Cut [Definition] Min Cut Problem: find a cut of the minimum capacity in X cut(U,V) is a minimum cut : its capacity is the sum of the capacities crossing the cut = 1+2=3=cap(U,V). : the edge (i,j) is not included in cap(U,V) because it is going in the wrong direction.
Flows and Cuts [Lemma 1] Let f be “any” flow, and let cut(A, B) be “any” cut. Then, the net flow sent across the cut is equal to the value Q. 6 2 9 5 10 6 10 15 15 4 4 10 3 8 8 s 5 3 8 6 10 t A 1 10 4 6 15 10 15 11 11 Net flow across the cut = 10+3+11 = 24 (= Value Q) 4 30 7
Flows and Cuts [Lemma 1] Let f be “any” flow, and let cut(A, B) be “any” cut. Then, the net flow sent across the cut is equal to the value Q. 6 2 9 5 10 6 10 15 15 4 4 10 3 8 8 s 5 3 8 6 10 t A 1 10 4 6 15 10 15 11 11 Net flow across the cut = 6 + 0 + 8 - 1 + 11 = 24 (= Value Q) 4 30 7
Flows and Cuts [Lemma 1] Let f be “any” flow, and let cut(A, B) be “any” cut. Then, the net flow sent across the cut is equal to the value Q. 2 9 5 10 6 10 15 15 4 4 10 3 8 8 s 5 3 8 6 10 t A 1 10 4 6 15 10 15 11 11 Net flow across the cut = 10 - 4 + 8 - 0 + 10 = 24 (= Value Q) 4 30 7
Flows and Cuts [Lemma 1] Let f be “any” flow, and let cut(A, B) be “any” cut. Then, the net flow sent across the cut is equal to the value Q. Proof] The net flow out of s is Q. The net flow out of any other vertex v in A is 0. So, we obtain:
Flows and Cuts [Lemma 2] Let f be “any” flow, and let cut(A, B) be “any” cut. Then the value Q of the flow is at most the capacity cap(A,B) of the cut. 6 2 9 5 10 6 10 15 15 4 4 10 3 8 8 s 5 3 8 6 10 t A 1 10 4 6 15 10 15 11 11 4 30 7 Value Q = 24 cap(A,B) = 30
Flows and Cuts [Lemma 2] Let f be “any” flow, and let cut(A, B) be “any” cut. Then the value Q of the flow is at most the capacity cap(A,B) of the cut. 6 2 9 5 10 6 10 15 15 4 4 10 3 8 8 s 5 3 8 6 10 t A 1 10 4 6 15 10 15 11 11 4 30 7 Value Q = 24 cap(A,B) = 64(=9+15+8+30)
Flows and Cuts [Lemma 2] Let f be “any” flow, and let cut(A, B) be “any” cut. Then the value Q of the flow is at most the capacity cap(A,B) of the cut. 2 9 5 10 6 10 15 15 4 4 10 3 8 8 s 5 3 8 6 10 t A 1 10 4 6 15 10 15 11 11 4 30 7 Value Q = 24 cap(A,B) = 28(=10+8+10)
Flows and Cuts [Lemma 2] Let f be “any” flow, and let cut(A, B) be “any” cut. Then the value Q of the flow is at most the capacity cap(A,B) of the cut. Proof]
Max Flow = Min Cut [Theorem] The maximum flow value Q in a network X is equal to the minimum capacity of any cut in X. In other words, Let f be “any” flow, and let (A, B) be “any” cut. If Q= cap(A, B), then the flow f is a max flow and cut(A, B) is a min cut. Value Q = 28 Cut capacity = 28 9 2 9 5 10 1 9 10 15 15 4 10 4 8 9 s 5 3 8 6 10 t 4 10 A 4 6 15 10 15 14 14 4 30 7
Max Flow = Min Cut [Theorem] The maximum flow value Q in a network X is equal to the minimum capacity of any cut in X. In other words, Let f be “any” flow, and let (A, B) be “any” cut. If Q= cap(A, B), then the flow f is a max flow and cut(A, B) is a min cut. Value Q = 3 Cut capacity = 3 1 1 1 1 1 2 2 2 2 2
Max Flow Algorithm: Greedy Greedy algorithm. Start with f(e) = 0 for all edge e E. Find an s-t path P where each edge has f(e) < c(e). Augment flow along path P. Repeat until you get stuck. 1 20 10 s 30 t 10 20 Flow value = 0 2
Max Flow Algorithm: Greedy Greedy algorithm. Start with f(e) = 0 for all edge e E. Find an s-t path P where each edge has f(e) < c(e). Augment flow along path P. Repeat until you get stuck. 1 20 X 20 10 s 30 X 20 t 10 20 Flow value = 20 X 20 2
Max Flow Algorithm: Greedy Greedy algorithm. Start with f(e) = 0 for all edge e E. Find an s-t path P where each edge has f(e) < c(e). Augment flow along path P. Repeat until you get stuck. locally optimality ≠ global optimality 1 1 20 20 10 20 10 20 10 s 30 20 t s 30 10 t 10 20 10 20 20 10 20 greedy = 20 2 opt = 30 2
Max Flow Algorithm: Ford-Fulkerson Original edge: e = (u, v) E. Flow f(e), capacity c(e). Residual edge. "Undo" flow sent. e = (u, v) and eR = (v, u). Residual capacity: Residual graph: Gf = (V, Ef ). Residual edges with positive residual capacity. Ef = {e} {eR : c(e) > 0}. capacity u 17 v 6 flow residual capacity u 11 v 6 residual capacity
Max Flow Algorithm: Ford-Fulkerson Original edge: e = (u, v) E. Flow f(e), capacity c(e). Residual edge. "Undo" flow sent. e = (u, v) and eR = (v, u) Residual capacity: Residual graph: Gf = (V, Ef ). Residual edges with positive residual capacity. Ef = {e} {eR : c(e) > 0}. 1 2 5 1 1 1 1 1 1 s 4 t 1 1 1 3
Max Flow Algorithm: Ford-Fulkerson Original edge: e = (u, v) E. Flow f(e), capacity c(e). Residual edge. "Undo" flow sent. e = (u, v) and eR = (v, u) Residual capacity: Residual graph: Gf = (V, Ef ). Residual edges with positive residual capacity. Ef = {e} {eR : c(e) > 0}. 1 2 5 1 1 1 1 1 1 s 4 t 1 1 1 3 Find any augmenting path in G(x) A augmenting path is a path from s to t along with we can push some additional flow
Max Flow Algorithm: Ford-Fulkerson Original edge: e = (u, v) E. Flow f(e), capacity c(e). Residual edge. "Undo" flow sent. e = (u, v) and eR = (v, u) Residual capacity: Residual graph: Gf = (V, Ef ). Residual edges with positive residual capacity. Ef = {e} {eR : c(e) > 0}. 1 2 5 1 1 1 1 1 1 s 4 t 1 1 1 1 1 1 3 Determine the bottleneck of the path. : the bottleneck is the flow of the path Update residual capacities.
Max Flow Algorithm: Ford-Fulkerson Original edge: e = (u, v) E. Flow f(e), capacity c(e). Residual edge. "Undo" flow sent. e = (u, v) and eR = (v, u) Residual capacity: Residual graph: Gf = (V, Ef ). Residual edges with positive residual capacity. Ef = {e} {eR : c(e) > 0}. 1 2 5 1 1 1 1 1 s 4 t 1 1 1 1 3 Find any s-t path in G(x)
Max Flow Algorithm: Ford-Fulkerson Original edge: e = (u, v) E. Flow f(e), capacity c(e). Residual edge. "Undo" flow sent. e = (u, v) and eR = (v, u) Residual capacity: Residual graph: Gf = (V, Ef ). Residual edges with positive residual capacity. Ef = {e} {eR : c(e) > 0}. 1 2 5 1 1 1 1 1 s 4 t 1 1 2 1 1 1 1 1 3 Determine the bottleneck of the path. : the bottleneck is the flow of the path Update residual capacities.
Max Flow Algorithm: Ford-Fulkerson Original edge: e = (u, v) E. Flow f(e), capacity c(e). Residual edge. "Undo" flow sent. e = (u, v) and eR = (v, u) Residual capacity: Residual graph: Gf = (V, Ef ). Residual edges with positive residual capacity. Ef = {e} {eR : c(e) > 0}. 1 2 5 1 1 1 1 2 1 1 1 s 4 t 1 1 1 1 1 1 1 1 1 1 3 Find any s-t path in G(x)
Max Flow Algorithm: Ford-Fulkerson Original edge: e = (u, v) E. Flow f(e), capacity c(e). Residual edge. "Undo" flow sent. e = (u, v) and eR = (v, u) Residual capacity: Residual graph: Gf = (V, Ef ). Residual edges with positive residual capacity. Ef = {e} {eR : c(e) > 0}. 1 2 5 1 1 1 1 1 1 1 s 4 t 1 1 1 1 1 1 1 1 1 1 3 Determine the bottleneck of the path. : the bottleneck is the flow of the path Update residual capacities.
Max Flow Algorithm: Ford-Fulkerson Original edge: e = (u, v) E. Flow f(e), capacity c(e). Residual edge. "Undo" flow sent. e = (u, v) and eR = (v, u) Residual capacity: Residual graph: Gf = (V, Ef ). Residual edges with positive residual capacity. Ef = {e} {eR : c(e) > 0}. 2 5 1 1 1 1 1 s 4 t 1 1 1 1 1 1 1 1 1 1 3 There is no s-t path in the residual network. This flow is optimal
Max Flow Algorithm: Ford-Fulkerson 1 s 2 4 5 3 t Here is the optimal flow
Ford-Fulkerson Algorithm flow 2 4 4 capacity G: 10 8 6 2 10 s 10 3 9 5 10 t value Q = 0 34
Ford-Fulkerson Algorithm flow 2 4 4 capacity G: 8 X 10 8 6 2 10 s 10 3 9 5 10 t value Q = 0 2 4 4 residual capacity Gf: 10 8 6 2 10 s 10 3 9 5 10 t 35
Ford-Fulkerson Algorithm 2 4 4 G: 10 2 X 8 8 10 8 6 2 10 8 s 10 3 9 5 10 t value Q = 8 2 4 4 Gf: 8 2 8 6 2 10 s 10 3 9 5 2 t 8 36
Ford-Fulkerson Algorithm 2 4 4 G: X 6 8 10 8 10 8 6 2 10 2 2 10 s 10 3 9 5 10 t value Q = 10 2 4 4 Gf: 10 8 6 2 10 s 10 3 7 5 10 t 2 37
Ford-Fulkerson Algorithm X 8 2 2 4 4 G: 10 8 6 10 8 6 6 2 10 2 6 8 10 s 10 3 9 5 10 t value Q = 16 2 4 4 Gf: 6 10 8 6 2 4 s 4 3 1 5 10 t 6 8 38
Ford-Fulkerson Algorithm X 9 7 3 2 2 4 4 G: 10 8 8 10 8 6 6 2 10 8 8 10 s 10 3 9 5 10 t value Q = 18 2 2 2 4 Gf: 8 10 8 6 2 2 s 2 3 1 5 10 t 8 8 39
Ford-Fulkerson Algorithm 3 2 4 4 G: 10 7 9 10 8 6 6 2 10 9 9 10 s 10 3 9 5 10 t value Q = 19 3 2 1 4 Gf: 9 1 10 7 6 2 1 s 1 3 9 5 10 t 9 40
Ford-Fulkerson Algorithm 3 2 4 4 G: 10 7 9 10 8 6 6 2 10 9 9 10 s 10 3 9 5 10 t Cut capacity = 19 value Q = 19 3 2 1 4 Gf: 9 1 10 7 6 2 1 s 1 3 9 5 10 t 9 The partition A becomes the set of vertices reachable from s in residual graph. 41
Max Flow Algorithm: Ford-Fulkerson Ford-Fulkerson(G(V,E), s, t, c) { Gf(V,Ef) G(V,E) while (there exists augmenting path P) { b bottleneck(P) foreach e P { if (e E) c(e) c(e) - b else c(eR) c(eR) + b } update G return the current flow value Q //forward edge update Gf //reverse edge
Max-Flow Min-Cut Theorem Augmenting path theorem. Flow f is a max flow iff there are no augmenting paths. Max-flow min-cut theorem. [Ford-Fulkerson 1956] The value of the max flow is equal to the value of the min cut. Proof strategy. We prove both simultaneously by showing the TFAE: (i) There exists a cut (A, B) such that Q = cap(A, B). (ii) Flow f is a max flow. (iii) There is no augmenting path relative to f. (i) (ii) This was the corollary to weak duality lemma. (ii) (iii) We show contrapositive. Let f be a flow. If there exists an augmenting path, then we can improve f by sending flow along path.
Proof of Max-Flow Min-Cut Theorem (iii) (i) Let f be a flow with no augmenting paths. Let A be set of vertices reachable from s in residual graph. By definition of A, s A. By definition of f, t A.
K-Edge-Connectivity [Definition] k-edge-connectivity The network will remain connected after removing any arbitrary k-1 edges from network. k-edge-connected: any pair of nodes are connected by k disjoint paths disjoint paths: 45
Edge Disjoint Paths Disjoint path problem. Given a digraph G = (V, E) and two nodes s and t, find the max number of edge-disjoint s-t paths. [Def] Two paths are edge-disjoint if they have no edge in common. Ex: communication networks. 2 5 s 3 6 t 4 7
Edge Disjoint Paths Disjoint path problem. Given a digraph G = (V, E) and two nodes s and t, find the max number of edge-disjoint s-t paths. [Def] Two paths are edge-disjoint if they have no edge in common. Ex: communication networks. 2 5 s 3 6 t 4 7
Edge Disjoint Paths Max flow formulation: assign unit capacity to every edge. [Theorem] Max number edge-disjoint s-t paths equals max flow value. Proof Suppose there are k edge-disjoint paths P1, . . . , Pk. Set f(e) = 1 if e participates in some path Pi ; else set f(e) = 0. Since paths are edge-disjoint, f is a flow of value Q=k. ▪ s t 1 1 1 1 1 1 1 1 1 1 1 1 1 1
Edge Disjoint Paths Max flow formulation: assign unit capacity to every edge. [Theorem] Max number edge-disjoint s-t paths equals max flow value. Proof Suppose max flow value Q is k. Then, there exists 0-1 flow f of value k. Consider edge (s, u) with f(s, u) = 1. by conservation, there exists an edge (u, v) with f(u, v) = 1 continue until reach t, always choosing a new edge Produces k (not necessarily simple) edge-disjoint paths. s t 1 1 1 1 1 1 1 1 1 1 1 1 1 1 can eliminate cycles to get simple paths if desired
Network Connectivity [Network connectivity] Given a digraph G = (V, E) and two nodes s and t, find min number of edges whose removal disconnects t from s. Def. A set of edges F E disconnects t from s if all s-t paths uses at least one edge in F. 2 5 2 5 s 3 6 t s 3 6 t 4 7 4 7 F
Edge Disjoint Paths and Network Connectivity Theorem. [Menger 1927] The max number of edge-disjoint s-t paths is equal to the min number of edges whose removal disconnects t from s. [Proof] Suppose the removal of F E disconnects t from s, and |F| = k. All s-t paths use at least one edge of F. Hence, the number of edge-disjoint paths is at most k. ▪ 2 5 2 5 s 3 6 t s 3 6 t 4 7 4 7 F
Edge Disjoint Paths and Network Connectivity Theorem. [Menger 1927] The max number of edge-disjoint s-t paths is equal to the min number of edges whose removal disconnects t from s. [Proof] Suppose max number of edge-disjoint paths is k. Then max flow value is k. Max-flow min-cut cut (A, B) of capacity k. Let F be set of edges going from A to B. |F| = k and disconnects t from s. ▪ A 2 5 2 5 s 3 6 t s 3 6 t 4 7 4 7 F