advanced algorithms
play

Advanced Algorithms Course Info Instructor: - PowerPoint PPT Presentation

Advanced Algorithms Course Info Instructor: {yinyt, chaodong}@nju.edu.cn Office hour: Wednesday, 10am-12pm 804 ( ), 302 ( ) course homepage:


  1. Advanced Algorithms ����� ���

  2. Course Info • Instructor: ����� � • {yinyt, chaodong}@nju.edu.cn • Office hour: Wednesday, 10am-12pm • 804 ( ��� ), 302 ( � � ) • course homepage: • http://tcs.nju.edu.cn/wiki/

  3. Textbooks Rajeev Motwani and Prabhakar Raghavan. Randomized Algorithms. Cambridge University Press, 1995. Vijay Vazirani Approximation Algorithms. Spinger-Verlag, 2001.

  4. References Mitzenmacher and Upfal. Probability and Computing, 2nd Ed. Williamson and Shmoys The Design of Approximation Algorithms Alon and Spencer The Probabilistic Method, 4th Ed. CLRS Introduction to Algorithms

  5. “ Advanced” Algorithms

  6. Min-Cut G ( V, E ) • Partition V into two parts: S and T • Minimize the cut E ( S , T ) S T • deterministic algorithm: • max-flow min-cut • best known upper bound: O( mn + n 2 log n ) E ( S , T ) = { uv ∈ E | u ∈ S , v ∈ T }

  7. Contraction • multigraph G ( V , E ) e • multigraph: allow parallel edges • for an edge e, contract( e ) merges the two endpoints.

  8. Contraction • multigraph G ( V , E ) • multigraph: allow parallel edges • for an edge e, contract( e ) merges the two endpoints.

  9. Karger’s min-cut Algorithm MinCut ( multigraph G ( V , E ) ) while | V |>2 do choose a uniform e ∈ E ; contract( e ); return remaining edges;

  10. Karger’s min-cut Algorithm MinCut ( multigraph G ( V , E ) ) while | V |>2 do choose a uniform e ∈ E ; contract( e ); return remaining edges;

  11. Karger’s min-cut Algorithm MinCut ( multigraph G ( V , E ) ) while | V |>2 do choose a uniform e ∈ E ; contract( e ); return remaining edges;

  12. Karger’s min-cut Algorithm MinCut ( multigraph G ( V , E ) ) while | V |>2 do choose a uniform e ∈ E ; contract( e ); return remaining edges;

  13. Karger’s min-cut Algorithm MinCut ( multigraph G ( V , E ) ) while | V |>2 do choose a uniform e ∈ E ; contract( e ); return remaining edges;

  14. Karger’s min-cut Algorithm MinCut ( multigraph G ( V , E ) ) while | V |>2 do choose a uniform e ∈ E ; contract( e ); return remaining edges;

  15. Karger’s min-cut Algorithm MinCut ( multigraph G ( V , E ) ) while | V |>2 do choose a uniform e ∈ E ; contract( e ); return remaining edges; edges returned

  16. MinCut ( multigraph G ( V , E ) ) Theorem (Karger 1993) : while | V |>2 do 2 Pr[ a min-cut is returned ] ≥ n ( n − 1) choose a uniform e ∈ E ; contract( e ); repeat independently return remaining edges; for n ( n -1)/2 times and return the smallest cut Pr[ fail to finally return a min-cut ] = Pr[ fail to construct a min-cut in one trial ] n ( n − 1)/2 ≤ ( 1 − n ( n − 1)/2 n ( n − 1) ) < 1 2 e

  17. suppose e 1 , e 2 , . . . , e n − 2 MinCut ( multigraph G ( V , E ) ) are contracted edges while | V |>2 do initially: G 1 = G choose a uniform e ∈ E ; contract( e ); i -th round: return remaining edges; G i = contract( G i − 1 , e i − 1 ) C is a min-cut in G i − 1 o C is a min-cut in G i e i − 1 62 C C : a min-cut of G Pr[ e 1 , e 2 , …, e n − 2 ∉ C ] Pr[ C is returned] ≥ n − 2 ∏ chain rule: = Pr[ e i ∉ C ∣ e 1 , e 2 , …, e i − 1 ∉ C ] i =1

  18. suppose e 1 , e 2 , . . . , e n − 2 are contracted edges initially: G 1 = G i -th round: G i = contract( G i − 1 , e i − 1 ) C is a min-cut in G i − 1 o C is a min-cut in G i e i − 1 62 C C : a min-cut of G n − 2 ∏ ≥ Pr[ e i ∉ C ∣ e 1 , e 2 , …, e i − 1 ∉ C ] Pr[ C is returned] i =1 C is a min-cut in G i n − 2 C is a min-cut in G ( V, E ) ✓ ◆ 2 Y 1 − ≥ | E | ≥ 1 2 | C || V | ( n − i + 1) i =1 Proof : n − 2 2 n − i − 1 Y n − i + 1 = = min-degree of G ≥ | C | n ( n − 1) i =1

  19. MinCut ( multigraph G ( V , E ) ) while | V |> do 2 choose a uniform e ∈ E ; contract( e ); return remaining edges; Theorem (Karger 1993) : For any min-cut C , 2 Pr[ C is returned] ≥ n ( n − 1) running time: O( n 2 ) repeat independently for O( n 2 log n ) times returns a min-cut with probability 1-O(1/ n ) total running time: O( n 4 log n )

  20. Number of Min-Cuts Theorem (Karger 1993) : For any min-cut C , 2 Pr[ C is returned] ≥ n ( n − 1) Corollary The number of distinct min-cuts in a graph of n vertices is at most n ( n -1)/2.

  21. An Observation MinCut ( multigraph G ( V , E ) ) while | V |> t do choose a uniform e ∈ E ; contract( e ); return remaining edges; C : a min-cut of G n − t Y Pr[ e 1 , . . . , e n − t 62 C ] = Pr[ e i 62 C | e 1 , . . . , e i − 1 62 C ] i =1 n − t n − i + 1 = t ( t − 1) n − i − 1 Y ≥ n ( n − 1) i =1 only getting bad when t is small

  22. Fast Min-Cut MinCut ( multigraph G ( V , E ) ) while | V |> t do choose a uniform e ∈ E ; contract( e ); return remaining edges; FastCut ( G ) if | V | ≤ 6 then return a min-cut by brute force; ( t to be fixed later) else: G 1 = Contract( G , t ) ; (independently) G 2 = Contract( G , t ) ; return min{FastCut( G 1 ), FastCut( G 2 )};

  23. FastCut ( G ) if | V | ≤ 6 then return a min-cut by brute force; ( t to be fixed later) else: G 1 = Contract( G , t ) ; (independently) G 2 = Contract( G , t ) ; return min{FastCut( G 1 ), FastCut( G 2 )}; C : a min-cut in G A : no edge in C is contracted during Contract( G , t ) n − t Y Pr[ A ] = Pr[ e i 62 C | e 1 , . . . , e i − 1 62 C ] i =1 ✓ t − 1 n − t ◆ 2 ≥ t ( t − 1) n − i − 1 Y ≥ ≥ n ( n − 1) n − i + 1 n − 1 i =1

  24. FastCut ( G ) if | V | ≤ 6 then return a min-cut by brute force; ( t to be fixed later) else: G 1 = Contract( G , t ) ; (independently) G 2 = Contract( G , t ) ; return min{FastCut( G 1 ), FastCut( G 2 )}; C : a min-cut in G l m set t = n 1 + √ 2 A : no edge in C is contracted during Contract( G , t ) ✓ t − 1 ◆ 2 ≥ 1 Pr[ A ] ≥ n − 1 2 p ( n ) = G : | V | = n Pr[ FastCut( G ) returns a mincut in G ] min succeeds ≥ 1 − (1 − Pr[ A ] Pr[FastCut( G 1 ) succeeds | A ]) 2 ◆ 2 ✓ ⌘ 2 m⌘ 2 ⇣ ⇣l m⌘ ⇣l t − 1 − 1 ≥ 1 − 1 − p ( t ) n n 1 + 1 + ≥ p 4 p √ √ n − 1 2 2

  25. FastCut ( G ) if | V | ≤ 6 then return a min-cut by brute force; l m else: set t = n 1 + √ 2 G 1 = Contract( G , t ) ; (independently) G 2 = Contract( G , t ) ; return min{FastCut( G 1 ), FastCut( G 2 )}; p ( n ) = G : | V | = n Pr[ FastCut( G ) returns a mincut in G ] min m⌘ 2 ⇣l m⌘ ⇣l − 1 n n ≥ p 1 + 1 + 4 p √ √ 2 2 ✓ ◆ 1 by induction: p ( n ) = Ω log n ⇣l m⌘ running time: + O ( n 2 ) T ( n ) = 2 T 1 + n √ 2 T ( n ) = O ( n 2 log n ) by induction:

  26. FastCut ( G ) if | V | ≤ 6 then return a min-cut by brute force; l m else: set t = n 1 + √ 2 G 1 = Contract( G , t ) ; (independently) G 2 = Contract( G , t ) ; return min{FastCut( G 1 ), FastCut( G 2 )}; Theorem (Karger-Stein 1996) : FastCut runs in time O( n 2 log n ) and returns a min-cut with probability Ω (1/log n ). repeat independently for O((log n ) 2 ) times total running time: O( n 2 log 3 n ) returns a min-cut with probability 1-O(1/ n )

  27. Max-Cut • Partition V into two parts: G ( V , E ) S and T • Maximize the cut E ( S , T ) S • NP-hard T • one of Karp’s 21 NP- complete problems • Approximation algorithms? E ( S , T ) = { uv ∈ E | u ∈ S , v ∈ T }

  28. Greedy Heuristics initially, S = T = ∅ for i = 1,2, ..., n v i joins one of S , T to maximize current E ( S , T ) T S v i E ( S , T ) = { uv ∈ E | u ∈ S , v ∈ T }

  29. Greedy Heuristics initially, S = T = ∅ for i = 1,2, ..., n v i joins one of S , T to maximize current E ( S , T ) T S v i E ( S , T ) = { uv ∈ E | u ∈ S , v ∈ T }

  30. Approximation Ratio instance G ( V , E ) algorithm A : initially, S = T = ∅ for i = 1,2, ..., n v i joins one of S , T to maximize current E ( S , T ) OPT G : value of maximum cut of G SOL G : value of the cut returned by algorithm A on G algorithm A has approximation ratio α if SOL G ∀ input G , ≥ α OPT G

  31. Approximation Algorithm initially, S = T = ∅ for i = 1,2, ..., n v i joins one of S , T to maximize current E ( S , T ) G ( V , E ) ≥ SOL G SOL G ≥ 1 | E | OPT G 2 ∀ v i , ≥ 1/2 of | E ( S i , v i )| + | E ( T i , v i )| T S contributes to SOL G v i n ∑ | E | = ( | E ( S i , v i ) | + | E ( T i , v i ) | ) i =1 E ( S , T ) = { uv ∈ E | u ∈ S , v ∈ T }

  32. Approximation Algorithm initially, S = T = ∅ for i = 1,2, ..., n v i joins one of S , T to maximize current E ( S , T ) G ( V , E ) ≥ SOL G SOL G ≥ 1 | E | OPT G 2 T S approximation ratio: 1/2 v i running time: O( m ) E ( S , T ) = { uv ∈ E | u ∈ S , v ∈ T }

  33. Max-Cut • Partition V into two parts: G ( V , E ) S and T • Maximize the cut E ( S , T ) S • NP-hard T • one of Karp’s 21 NP- complete problems • greedy algorithm: E ( S , T ) = { uv ∈ E | u ∈ S , v ∈ T } 0.5-approximation

  34. Random Cut G ( V , E ) for each vertex v ∈ V uniform & independent Y v ∈ { 0 , 1 } S Y v = 1 T v ∈ S Y v = 0 v ∈ T for each edge uv ∈ E ( Y u 6 = Y v 1 X | E ( S, T ) | = Y uv Y uv = 0 Y u = Y v uv ∈ E = | E | ≥ OPT X E [ | E ( S, T ) | ] = Pr[ Y u 6 = Y v ] 2 2 uv ∈ E

  35. Random Cut G ( V , E ) for each vertex v ∈ V uniform & 2-wise independent Y v ∈ { 0 , 1 } S Y v = 1 T v ∈ S Y v = 0 v ∈ T for each edge uv ∈ E ( Y u 6 = Y v 1 X | E ( S, T ) | = Y uv Y uv = 0 Y u = Y v uv ∈ E = | E | ≥ OPT X E [ | E ( S, T ) | ] = Pr[ Y u 6 = Y v ] 2 2 uv ∈ E

Recommend


More recommend