Approximate Connected Components Key Idea 3: Approximate Cost cost(w) = 1/6 Ignore low cost cost(x) = 1/6 w x components: A If cost(u) < π /2, round up. Total added cost β€ π n /2 . cost(y) = 1/3 B y c cost(z) = 1 z
Approximate Connected Components Key Idea 3: Approximate Cost cost(w) = 1/6 Define: per-node cost cost(x) = 1/6 w x Let n(u) = number of nodes in the A connected component containing node u. Let Γ±(u) = min(n(u), 2/ π ). cost(y) = 1/3 B y Let cost(u) = max(1/n(u), π /2). c = 1/Γ±(u). cost(z) = 1 z
Approximate Connected Components Key Idea 3: Approximate Cost Define: per-node cost Define: Let n(u) = number of nodes in the connected component containing node u. Note: Let Γ±(u) = min(n(u), 2/ π ). Let cost(u) = max(1/n(u), π /2). = 1/Γ±(u).
Approximate Connected Components Key Idea 3: Approximate Cost Define: per-node cost Define: Let n(u) = number of nodes in the connected component containing node u. Note: Let Γ±(u) = min(n(u), 2/ π ). Let cost(u) = max(1/n(u), π /2). = 1/Γ±(u).
Approximate Connected Components Close enough approximation: Intuition: By rounding cost(u) up to π /2, we increase the error at most π n/2.
Approximate Connected Components Close enough approximation: Intuition: By rounding cost(u) up to π /2, we increase the error at most π n/2.
Approximate Connected Components Close enough approximation: Intuition: By rounding cost(u) up to π /2, we increase the error at most π n/2.
Approximate Connected Components Close enough approximation: Intuition: By rounding cost(u) up to π /2, we increase the error at most π n/2.
Approximate Connected Components Close enough approximation: Intuition: By rounding cost(u) up to π /2, we increase the error at most π n/2.
Approximate Connected Components Close enough approximation: Intuition: By rounding cost(u) up to π /2, we increase the error at most π n/2.
Approximate Connected Components Algorithm 3 sum = 0 cost(w) = 1/6 cost(x) = 1/6 w for j = 1 to s: x Choose u uniformly at random. A sum = sum + cost(u) return nβ(sum/s) We have shown: cost(y) = 1/3 B y Sufficient to approximate c cost(u) by rounding up. cost(z) = 1 z
Approximate Connected Components Algorithm 3 Define: per-node cost How to efficiently compute cost(u)? Let n(u) = number of nodes in the connected component containing node u. Let Γ±(u) = min(n(u), 2/ π ). Let cost(u) = max(1/n(u), π /2). = 1/Γ±(u).
Approximate Connected Components Algorithm 3 Define: per-node cost How to efficiently compute cost(u)? Let n(u) = number of nodes in the connected component containing node u. Let Γ±(u) = min(n(u), 2/ π ). Let cost(u) = max(1/n(u), π /2). = 1/Γ±(u).
Approximate Connected Components Algorithm 3 sum = 0 for j = 1 to s: Choose u uniformly at random. Perform a BFS from u; stop after seeing 2/ π nodes. if BFS found > 2/ π nodes: sum = sum + π /2 else if BFS found n(u) nodes: sum = sum + 1/n(u) return nβ(sum/s)
Approximate Connected Components Analysis Goal:
Approximate Connected Components Analysis Goal: Implies:
Approximate Connected Components Algorithm 3 Analysis Define random variables: Y 1 , Y 2 , β¦ , Y s Rounded up cost
Approximate Connected Components Algorithm 3 Analysis Define random variables: Y 1 , Y 2 , β¦ , Y s
Approximate Connected Components Algorithm 3 Analysis Unbiased estimator:
Approximate Connected Components Algorithm 3 Analysis Notice: Expected output of algorithm is:
Approximate Connected Components Algorithm 3 Analysis Goal:
Approximate Connected Components Algorithm 3 Analysis Derivation:
Approximate Connected Components Algorithm 3 Analysis Derivation:
Approximate Connected Components Analysis Goal: Implies:
Approximate Connected Components Algorithm 3 sum = 0 for j = 1 to s: Choose u uniformly at random. Perform a BFS from u; stop after seeing 2/ π nodes. if BFS found > 2/ π nodes: sum = sum + π /2 else if BFS found n(u) nodes: sum = sum + 1/n(u) return nβ(sum/s)
Approximate Connected Components Algorithm 3 We have shown: cost(w) = 1/6 cost(x) = 1/6 w x With probability > 2/3, A output is equal to: CC(G) Β± π n cost(y) = 1/3 B y c cost(z) = 1 z
Approximate Connected Components Algorithm 3 Cost of BFS: O((2 / π )βd) sum = 0 for j = 1 to s: Choose u uniformly at random. Perform a BFS from u; stop after seeing 2/ π nodes. if BFS found > 2/ π nodes: sum = sum + π /2 else if BFS found n(u) nodes: sum = sum + 1/n(u) return nβ(sum/s)
Approximate Connected Components Algorithm 3 Cost of BFS: O((2 / π )βd) sum = 0 for j = 1 to s: Choose u uniformly at random. Perform a BFS from u; stop after seeing 2/ π nodes. if BFS found > 2/ π nodes: sum = sum + π /2 Total cost: else if BFS found n(u) nodes: O(s(2/ π )βd) = sum = sum + 1/n(u) O((1/ π 2 )(2/ π )d) = return nβ(sum/s) O(d/ π 3 )
Approximate Connected Components Algorithm 3 We have shown: cost(w) = 1/6 cost(x) = 1/6 w x With probability > 2/3, A output is equal to: CC(G) Β± π n cost(y) = 1/3 B y Running time: c cost(z) = 1 z
Approximate Connected Components Algorithm 3 We have shown: cost(w) = 1/6 cost(x) = 1/6 w x With probability > 1 - 1/ Ξ΄ , A output is equal to: CC(G) Β± π n cost(y) = 1/3 B y Running time: c cost(z) = 1 z
Summary Today: Last Week: Number of connected components in Toy example 1 : array all 0βs? a graph. β’ Gap-style question: β’ Approximation algorithm. All 0βs or far from all 0βs? Toy example 2: Faction of 1βs? β’ Weight of MST Additive Β± π approximation β’ β’ Approximation algorithm. Hoeffding Bound Is the graph connected? β’ Gap-style question. β’ O(1) time algorithm. 9 dots β’ Correct with probability 2/3. 4 lines
Todayβs Problem: Minimum Spanning Tree Assumptions: 3 3 Graph G = (V,E) 2 β’ Undirected 2 2 1 β’ Weighted, max weight W 2 β’ Connected 1 β’ n nodes 3 β’ m edges 2 β’ maximum degree d 3 Error term: π < 1/2 1 Output: Example: output 16 Weight of MST.
Todayβs Problem: Minimum Spanning Tree Approximation: 3 3 Output M such that: 2 2 2 1 2 1 Alternate form: 3 2 3 1 Correct output: w.p. > 2/3 Example: π = 1/4 Output β [12,20]
Todayβs Problem : Minimum Spanning Tree When is this useful? What are trivial values of π ? What are hard values of π ? What sort of applications is this useful for? Why multiplicative approximation for MST and additive approximation for connected components?
Simple Minimum Spanning Tree Assume all weights 1 or 2 Which edges must be in MST? 2 2 2 2 2 How many weight-2 edges in 1 2 MST? 1 1 2 Best (exact) algorithm? 2 2 1
Simple Minimum Spanning Tree Assume all weights 1 or 2 Let G 1 = graph containing only 2 2 edges of weight 1. 2 2 2 1 2 1 1 2 2 2 1
Simple Minimum Spanning Tree Assume all weights 1 or 2 Let G 1 = graph containing only 2 2 edges of weight 1. 2 2 2 1 2 Let C 1 = number of connected 1 components in G 1 . 1 2 2 2 1 Ex: C 1 = 6
Simple Minimum Spanning Tree Assume all weights 1 or 2 Let G 1 = graph containing only 2 2 edges of weight 1. 2 2 2 1 2 Let C 1 = number of connected 1 components in G 1 . 1 2 2 Claim: MST contains example 2 C 1 -1 edges of weight 2. 1 Ex: C 1 = 6
Simple Minimum Spanning Tree Assume all weights 1 or 2 Claim: MST contains example 2 2 C 1 -1 edges of weight 2. 2 2 2 1 2 Basic MST Property: 1 For any cut, minimum weight 1 2 edge across cut is in MST. 2 2 1 Ex: C 1 = 6
Simple Minimum Spanning Tree Assume all weights 1 or 2 Claim: MST contains example 2 2 C 1 -1 edges of weight 2. 2 2 2 1 2 Algorithm: 1 For any connected component, 1 2 add minimum weight outgoing edge. 2 2 Here all the edges have weight 2, 1 so add C 1 -1 edges of weight 2. Ex: C 1 = 6
Simple Minimum Spanning Tree Assume all weights 1 or 2 Claim: MST contains example 2 2 C 1 -1 edges of weight 2. 2 2 2 1 2 Weight of MST? 1 1 2 2 2 1 Ex: C 1 = 6
Simple Minimum Spanning Tree Assume all weights 1 or 2 Claim: MST contains example 2 2 C 1 -1 edges of weight 2. 2 2 2 1 2 Weight of MST? 1 1 2 2 2 1 Ex: 10 + 6 β 2 = 14 Ex: C 1 = 6
Simple Minimum Spanning Tree Assume all weights 1 or 2 Weight of MST: n + C 1 - 2 2 2 2 Algorithm idea? 2 2 1 2 1 1 2 2 2 1 Ex: C 1 = 6
Simple Minimum Spanning Tree Assume all weights 1 or 2 Weight of MST: n + C 1 - 2 2 2 2 Algorithm idea: 2 2 1 2 Approximate connected components of G 1 . 1 1 2 2 2 1 Ex: C 1 = 6
Approximate Minimum Spanning Tree Weights {1, 2, β¦ , W} 3 Let G 1 = graph containing only 3 edges of weight 1. 2 2 2 1 2 Let G 2 = graph containing only 1 edges of weight {1, 2}. 3 β¦ 2 3 Let G j = graph containing only 1 edges of weights {1, 2, β¦ , j}. Ex: G 2
Approximate Minimum Spanning Tree Weights {1, 2, β¦ , W} 3 Let C 1 = number CC in G 1 . 3 2 2 2 Let C 2 = number CC in G 2 . 1 2 β¦ 1 3 Let C j = number CC in G j . 2 3 1 Ex: G 2
Approximate Minimum Spanning Tree Weights {1, 2, β¦ , W} 3 Claim: 3 MST(G) contains C j β 1 edges 2 2 2 of weight > j. 1 2 1 3 2 3 1 Ex: G 2
Approximate Minimum Spanning Tree Weights {1, 2, β¦ , W} 3 Claim: 3 MST(G) contains C j β 1 edges 2 2 2 of weight > j. 1 2 1 Why? 3 There are C j connected 2 components in G j . There 3 much be C j β 1 edges 1 connecting them, and each must have weight > j. Ex: G 2
Approximate Minimum Spanning Tree Weights {1, 2, β¦ , W} 3 Lemma: 3 2 2 2 1 2 1 3 2 3 1 Ex: G 2
Approximate Minimum Spanning Tree Weights {1, 2, β¦ , W} 3 Edges of weight 1: 3 2 2 2 n β 1 edges total in MST 1 2 C 1 β 1 edges of weight > 1 1 ο¨ 3 (n β 1) β (C 1 β 1) edges of 2 weight 1. 3 ο¨ 1 (n β C 1 ) edges of weight 1. Ex: G 2
Approximate Minimum Spanning Tree Weights {1, 2, β¦ , W} 3 Edges of weight j+1: 3 2 2 2 C j β 1 edges of weight > j 1 2 C j+1 β 1 edges of weight > j+1 1 ο¨ 3 (C j β 1) β (C j+1 β 1) edges of 2 weight j+1. 3 ο¨ 1 (C j β C j+1 ) edges of weight j+1. Ex: G 2 Note: C j β₯ C j+1
Recommend
More recommend