advanced algorithms i

Advanced Algorithms (I) Shanghai Jiao Tong University Chihao Zhang - PowerPoint PPT Presentation

Advanced Algorithms (I) Shanghai Jiao Tong University Chihao Zhang March 2nd, 2020 Information Instructor: (chihao@sjtu.edu.cn) TA: (yangfl@sjtu.edu.cn) Every Monday, 10:00 am - 11:40 am Zoom @ 123363659 Office Hour: via


  1. Advanced Algorithms (I) Shanghai Jiao Tong University Chihao Zhang March 2nd, 2020

  2. Information Instructor: 张驰豪 (chihao@sjtu.edu.cn) TA: 杨凤麟 (yangfl@sjtu.edu.cn) Every Monday, 10:00 am - 11:40 am Zoom @ 123363659 Office Hour: via Canvas or WeChat Group

  3. References Probability and Computing Randomized Algorithms The Probabilistic Method M. Mitzenmacher & E. Upfal R. Motwani & P . Raghavan N. Alon & J. Spencer

  4. Polynomial Identity Testing

  5. Polynomial Identity Testing Given two polynomials d d ∏ ∑ and b i x i F ( x ) = ( x − a i ) G ( x ) = i =1 i =0

  6. Polynomial Identity Testing Given two polynomials d d ∏ ∑ and b i x i F ( x ) = ( x − a i ) G ( x ) = i =1 i =0 Is F ( x ) ≡ G ( x )?

  7. Polynomial Identity Testing Given two polynomials d d ∏ ∑ and b i x i F ( x ) = ( x − a i ) G ( x ) = i =1 i =0 Is F ( x ) ≡ G ( x )? Example. F ( x ) = ( x − 1)( x − 2)( x + 3); G ( x ) = x 3 − 7 x + 6

  8. One can expand and compare the coefficients… F ( x )

  9. One can expand and compare the coefficients… F ( x ) It takes O ( d 2 ) arithmetic operations.

  10. One can expand and compare the coefficients… F ( x ) It takes O ( d 2 ) arithmetic operations. Can be improved to using FFT. O ( d log d )

  11. One can expand and compare the coefficients… F ( x ) It takes O ( d 2 ) arithmetic operations. Can be improved to using FFT. O ( d log d ) If random coins are allowed…

  12. One can expand and compare the coefficients… F ( x ) It takes O ( d 2 ) arithmetic operations. Can be improved to using FFT. O ( d log d ) If random coins are allowed… • The problem can be solved much faster

  13. One can expand and compare the coefficients… F ( x ) It takes O ( d 2 ) arithmetic operations. Can be improved to using FFT. O ( d log d ) If random coins are allowed… • The problem can be solved much faster • at the cost of making error.

  14. Choosing a uniform number s ∈ {1,2,…,100 d }

  15. Choosing a uniform number s ∈ {1,2,…,100 d } Test whether F ( s ) = G ( s )

  16. Choosing a uniform number s ∈ {1,2,…,100 d } Test whether F ( s ) = G ( s ) • If , then it always holds that F ( x ) ≡ G ( x ) F ( s ) = G ( s )

  17. Choosing a uniform number s ∈ {1,2,…,100 d } Test whether F ( s ) = G ( s ) • If , then it always holds that F ( x ) ≡ G ( x ) F ( s ) = G ( s ) • If , how likely is that ? F ( x ) ≢ G ( x ) F ( s ) ≠ G ( s )

  18. Choosing a uniform number s ∈ {1,2,…,100 d } Test whether F ( s ) = G ( s ) • If , then it always holds that F ( x ) ≡ G ( x ) F ( s ) = G ( s ) • If , how likely is that ? F ( x ) ≢ G ( x ) F ( s ) ≠ G ( s ) Theorem . (Fundamental Theorem of Algebra) A polynomial of degree has at most roots in d d ℂ

  19. Our algorithm outputs wrong answer only when

  20. Our algorithm outputs wrong answer only when • ; and F ( x ) ≢ G ( x )

  21. Our algorithm outputs wrong answer only when • ; and F ( x ) ≢ G ( x ) • is a root of F ( x ) − G ( x ) s

  22. Our algorithm outputs wrong answer only when • ; and F ( x ) ≢ G ( x ) • is a root of F ( x ) − G ( x ) s 1 This happens with probability at most . 100

  23. Our algorithm outputs wrong answer only when • ; and F ( x ) ≢ G ( x ) • is a root of F ( x ) − G ( x ) s 1 This happens with probability at most . 100 It only costs operations to compute and . O ( d ) F ( s ) G ( s )

  24. Our algorithm outputs wrong answer only when • ; and F ( x ) ≢ G ( x ) • is a root of F ( x ) − G ( x ) s 1 This happens with probability at most . 100 It only costs operations to compute and . O ( d ) F ( s ) G ( s ) One can repeat the algorithm times: t • error reduces to ; 100 − t • cost increases to . O ( td )

  25. Multi-variable Polynomials

  26. Multi-variable Polynomials The idea applies to a more general setting.

  27. Multi-variable Polynomials The idea applies to a more general setting. Let for some field , F , G ∈ 𝔾 ( x 1 , …, x n ) 𝔾

  28. Multi-variable Polynomials The idea applies to a more general setting. Let for some field , F , G ∈ 𝔾 ( x 1 , …, x n ) 𝔾 Is F ( x 1 , …, x n ) ≡ G ( x 1 , …, x n )?

  29. Theorem . (Schwartz-Zippel Theorem) Let be a non-zero multivariate Q ∈ 𝔾 [ x 1 , …, x n ] polynomial of degree at most . For any set , it d U ⊆ 𝔾 holds that d r 1 ,…, r n ∈ R U [ Q ( r 1 , …, r n ) = 0] ≤ Pr | U |

  30. Proof of Schwartz-Zippel

  31. Proof of Schwartz-Zippel Induction on , case is Fundamental Theorem n = 1 n of Algebra.

  32. Proof of Schwartz-Zippel Induction on , case is Fundamental Theorem n = 1 n of Algebra. Assuming it holds for smaller … n

  33. Proof of Schwartz-Zippel Induction on , case is Fundamental Theorem n = 1 n of Algebra. Assuming it holds for smaller … n k ∑ x i Q ( x 1 , …, x n ) = 1 ⋅ Q i ( x 2 , …, x n ) i =0

  34. Proof of Schwartz-Zippel Induction on , case is Fundamental Theorem n = 1 n of Algebra. Assuming it holds for smaller … n k ∑ x i Q ( x 1 , …, x n ) = 1 ⋅ Q i ( x 2 , …, x n ) i =0 Pr [ Q = 0 ] ≤ Pr [ Q k = 0 ] + Pr [ Q = 0 | Q k ≠ 0 ] ≤ d − k k | U | + | U |

  35. Our randomized algorithm generalizes to the multi- variable setting by Schwartz-Zippel theorem.

  36. Our randomized algorithm generalizes to the multi- variable setting by Schwartz-Zippel theorem. If the polynomials are given in product form, one scan of and is sufficient to evaluate them. F G

  37. Our randomized algorithm generalizes to the multi- variable setting by Schwartz-Zippel theorem. If the polynomials are given in product form, one scan of and is sufficient to evaluate them. F G Linear time algorithm with at most error! 1 %

  38. Our randomized algorithm generalizes to the multi- variable setting by Schwartz-Zippel theorem. If the polynomials are given in product form, one scan of and is sufficient to evaluate them. F G Linear time algorithm with at most error! 1 % It is a wide open problem in the complexity theory that whether this can be done in deterministic polynomial time.

  39. Some Complexity Theory

  40. Some Complexity Theory Problems solvable in deterministic polynomial-time: P

  41. Some Complexity Theory Problems solvable in deterministic polynomial-time: P Problems solvable in randomized polynomial-time: BPP

  42. Some Complexity Theory Problems solvable in deterministic polynomial-time: P Problems solvable in randomized polynomial-time: BPP Is ? BPP = P

  43. Min-Cut in a Graph

  44. Min-Cut in a Graph A cut in a graph is a set of edges G = ( V , E ) C ⊆ E whose removal disconnects . G

  45. Min-Cut in a Graph A cut in a graph is a set of edges G = ( V , E ) C ⊆ E whose removal disconnects . G How to find the minimum cut?

  46. Min-Cut in a Graph A cut in a graph is a set of edges G = ( V , E ) C ⊆ E whose removal disconnects . G How to find the minimum cut? It can be solved using max-flow techniques

  47. Min-Cut in a Graph A cut in a graph is a set of edges G = ( V , E ) C ⊆ E whose removal disconnects . G How to find the minimum cut? It can be solved using max-flow techniques With the fastest max-flow algorithm, it takes O ( n × mn ) time.

  48. Karger’s Min-Cut Algorithm

  49. Karger’s Min-Cut Algorithm David Karger

  50. Karger’s Min-Cut Algorithm Using random bits, Karger found a much simpler algorithm David Karger

  51. Karger’s Min-Cut Algorithm Using random bits, Karger found a much simpler algorithm The only operation required is edge contraction David Karger

  52. Edge Contraction

  53. Edge Contraction 1 3 2

  54. Edge Contraction 1 1 3 3 2 2

  55. Edge Contraction 1 1 3 3 2 2

  56. Edge Contraction 1 1 3 3 3 1/2 2 2

  57. Edge Contraction 1 1 3 3 3 1/2 2 2

  58. Edge Contraction 1 1 3 3 3 1/2 2 2 • no self-loop

  59. Edge Contraction 1 1 3 3 3 1/2 2 2 • no self-loop • parallel edges may exist

  60. The Algorithm

  61. The Algorithm Karger’s Min-cut Algorithm 1. Randomly choose an edge and contract it until only two vertices remains. 2. Output remaining edges.

  62. Analysis

  63. Analysis The algorithm contracts pair of vertices in total. n − 2

  64. Analysis The algorithm contracts pair of vertices in total. n − 2 Fix an minimum cut , we bound the probability that it C survives.

  65. Analysis The algorithm contracts pair of vertices in total. n − 2 Fix an minimum cut , we bound the probability that it C survives. Assume the removal of separates and C S ⊆ V ¯ . S = V ∖ S

  66. Analysis The algorithm contracts pair of vertices in total. n − 2 Fix an minimum cut , we bound the probability that it C survives. Assume the removal of separates and C S ⊆ V ¯ . S = V ∖ S ¯ All contractions happen within or . S S

  67. For , let be the event that “ -th i = 1,…, n − 2 A i i contraction avoids ” C

  68. For , let be the event that “ -th i = 1,…, n − 2 A i i contraction avoids ” C We need to bound

Recommend


More recommend