polynomial time problems
play

Polynomial-Time Problems Lecture 4: The polynomial method Part II: - PowerPoint PPT Presentation

Complexity Theory of Polynomial-Time Problems Lecture 4: The polynomial method Part II: All-pairs shortest paths Sebastian Krinninger Overview on APSP Algorithms Floyd-Warshall algorithm: ( 3 ) Inserts one node at a time


  1. Complexity Theory of Polynomial-Time Problems Lecture 4: The polynomial method Part II: All-pairs shortest paths Sebastian Krinninger

  2. Overview on APSP Algorithms โ€ข Floyd-Warshall algorithm: ๐‘ƒ(๐‘œ 3 ) Inserts one node at a time ๐‘œ iterations, each taking time ๐‘ƒ(๐‘œ 2 ) โ€ข Faster algorithms for sparse graphs โ€ข Directed graphs: โ€ข Single-source shortest paths: ๐‘ƒ(๐‘› + ๐‘œ log ๐‘œ) (Dijkstra with Fibonacci heap/Hollow heap) โ€ข โ‡’ All-pairs shortest paths: ๐‘ƒ(๐‘›๐‘œ + ๐‘œ 2 log ๐‘œ) , improved to ๐‘ƒ(๐‘›๐‘œ + ๐‘œ 2 log log ๐‘œ) [Pettie 02] โ€ข Undirected graphs: โ€ข Single-source shortest paths: ๐‘ƒ(๐‘›) [Thorup 97] โ€ข โ‡’ All-pairs shortest paths: ๐‘ƒ(๐‘›๐‘œ) โ€ข Pseudopolynomial algorithms โ€ข Today: Fastest โ€œgeneral - purposeโ€ algorithm

  3. History of slightly subcubic algorithms Running Time Author(s) Year(s) ๐‘œ 3 Floyd, Warshall 1962 ๐‘œ 3 / log 1/3 ๐‘œ Fredman 1975 ๐‘œ 3 / log 1/2 ๐‘œ Dobosiewicz, Takaoka 1990, 1991 ๐‘œ 3 / log 5/7 ๐‘œ Han 2004 ๐‘œ 3 / log ๐‘œ Takaoka, Zwick, Chan 2004, 2005 ๐‘œ 3 / log 5/4 ๐‘œ Han 2006 ๐‘œ 3 / log 2 ๐‘œ Chan, Han/Takaoka 2007, 2012 ๐‘œ 3 /2 ฮฉ log ๐‘œ 1/2 Williams 2014 Grows faster than any polylogarithmic factor

  4. Problem definition: desired output โ€ข Can create instances such that for every pair of nodes ๐‘ฃ, ๐‘ค shortest path from ๐‘ฃ to ๐‘ค consists of ฮฉ(๐‘œ) nodes โ€ข โ‡’ Cannot output all shortest paths explicitly in time ๐‘(๐‘œ 3 ) โ€ข Distance matrix: output size ๐‘œ 2 โ€ข Shortest path matrix ๐“๐ : output size ๐‘œ 2 For every pair of nodes ๐‘ฃ, ๐‘ค , SP ๐‘ฃ, ๐‘ค = next node on shortest path from ๐‘ฃ to ๐‘ค

  5. Machine model: Real RAM Floyd-Warshall: ๐‘ƒ(๐‘œ 3 ) with only additions and comparisons ฮฉ(๐‘œ 3 ) lower bound if only additions and comparisons allowed [Kerr 70] Real RAM: โ€ข Additions and comparisons of reals: unit cost โ€ข Other operations: logarithmic cost

  6. Tools

  7. Tool 1: Razborov-Smolensky Represent AND of ๐‘’ variables ๐‘ฆ 1 โˆง โ‹ฏ โˆง ๐‘ฆ ๐‘’ by low-degree polynomial โ€ข Parameter ๐‘Ÿ 1 โ€ข For every ๐‘— = 1, โ€ฆ , ๐‘Ÿ , ๐‘˜ = 1, โ€ฆ , ๐‘’ : Set ๐‘  ๐‘—,๐‘˜ = 0 or 1 with probability 2 ๐‘Ÿ ๐‘’ ๐ต ๐‘ฆ 1 , โ€ฆ , ๐‘ฆ ๐‘’ = 1 โŠ• ๐‘  ๐‘—,๐‘˜ โ‹… ๐‘ฆ ๐‘˜ โŠ• 1 ๐‘—=1 ๐‘˜=1 1 Lemma : Pr ๐‘  ๐‘—,๐‘˜ ๐ต ๐‘ฆ 1 , โ€ฆ , ๐‘ฆ ๐‘’ = ๐‘ฆ 1 โˆง โ‹ฏ โˆง ๐‘ฆ ๐‘’ โ‰ฅ 1 โˆ’ 2 ๐‘Ÿ By distributive law , ๐ต can be written as XOR of 1 + ๐‘’ ๐‘Ÿ monomials

  8. ๐‘Ÿ ๐‘’ ๐ต ๐‘ฆ 1 , โ€ฆ , ๐‘ฆ ๐‘’ = 1 โŠ• ๐‘  ๐‘—,๐‘˜ โ‹… ๐‘ฆ ๐‘˜ โŠ• 1 ๐‘—=1 ๐‘˜=1 ๐‘  ๐‘—,๐‘˜ ๐ต ๐‘ฆ 1 , โ€ฆ , ๐‘ฆ ๐‘’ = ๐‘ฆ 1 โˆง โ‹ฏ โˆง ๐‘ฆ ๐‘’ โ‰ฅ 1 โˆ’ 1 Lemma : Pr 2 ๐‘Ÿ Proof: ๐‘ฆ 1 โˆง โ‹ฏ โˆง ๐‘ฆ ๐‘’ = 1 : Each ๐‘ฆ ๐‘˜ must be 1 . Clearly, ๐ต ๐‘ฆ 1 , โ€ฆ , ๐‘ฆ ๐‘’ = 1 Observation : For every set ๐‘‡ , ๐‘ฆ 1 โˆง โ‹ฏ โˆง ๐‘ฆ ๐‘’ = 0 : First, fix some ๐‘— #odd subsets = #even subsets (by binary encoding of the 2 |๐‘‡| ๐‘‡ : subsets of ๐‘ฆ ๐‘˜ โ€™s that are 0 subsets) ๐‘‡โ€ฒ : subsets of ๐‘ฆ ๐‘˜ โ€™s that are 0 and additionally ๐‘  ๐‘—,๐‘˜ = 1 Bad event: ๐‘— -th component of outer AND is 1 โ‡” |๐‘‡ โ€ฒ | is even Each subset of ๐‘‡ has same probability of being picked as ๐‘‡ โ€ฒ Pr |๐‘‡ โ€ฒ | is odd = Pr |๐‘‡ โ€ฒ | is even = 1 2 ๐ต ๐‘ฆ 1 , โ€ฆ , ๐‘ฆ ๐‘’ = 1 only if bad event happens for each component of outer AND โ‡’ Error probability โ‰ค 1 2 ๐‘Ÿ

  9. Tool 2: Fast rectangular matrix multiplication ร— = ๐‘œ ๐‘œ 0.1 Theorem : There is an algorithm for multiplying an ๐‘œ ร— ๐‘œ 0.17 matrix with an ๐‘œ 0.17 ร— ๐‘œ matrix in time ๐‘ƒ(๐‘œ 2 log 2 ๐‘œ) . Also works for finite fields such as ๐บ 2 !

  10. Fast evaluation of polynomial Given: Polynomial ๐‘„(๐‘ฆ[1], โ€ฆ , ๐‘ฆ[๐‘’], ๐‘ง[1], โ€ฆ , ๐‘ง[๐‘’]) over ๐บ 2 โ€ข With ๐‘› โ‰ค ๐‘œ 0.1 monomials โ€ข Two sets of inputs: ๐‘Œ = ๐‘ฆ 1 , โ€ฆ , ๐‘ฆ ๐‘œ โŠ† 0,1 ๐‘’ ๐‘ = ๐‘ง 1 , โ€ฆ , ๐‘ง ๐‘œ โŠ† 0,1 ๐‘’ ( ๐‘ฆ ๐‘— = ๐‘ฆ ๐‘— [1], โ€ฆ , ๐‘ฆ ๐‘— [๐‘’] ) ( ๐‘ง ๐‘˜ = ๐‘ง ๐‘˜ [1], โ€ฆ , ๐‘ง ๐‘˜ [๐‘’] ) Lemma : There is an algorithm for evaluating ๐‘„ on all pairs ๐‘ฆ ๐‘— , ๐‘ง ๐‘˜ โˆˆ ๐‘Œ ร— ๐‘ (simultaneously) in time ๐‘ƒ ๐‘œ 2 poly log ๐‘œ .

  11. Restrictions of monomials Shape of polynomial ๐‘„ : โ€ข ๐‘„ = ๐‘ž 1 + โ‹ฏ + ๐‘ž ๐‘› โ€ข each ๐‘ž ๐‘™ is a monomial Define โ€ข ๐‘ž ๐‘™ |๐‘ฆ : restriction of ๐‘™ -th monomial to variables ๐‘ฆ[1], โ€ฆ , ๐‘ฆ[๐‘’] โ€ข ๐‘ž ๐‘™ |๐‘ง : restriction of ๐‘™ -th monomial to variables ๐‘ง[1], โ€ฆ , ๐‘ง[๐‘’] โ€ข (empty product = 1 ) โ€œInner productโ€ โ€ข ๐‘„ = ๐‘ž 1 ๐‘ฆ โ‹… ๐‘ž 1 ๐‘ง + โ‹ฏ + ๐‘ž ๐‘› ๐‘ฆ โ‹… ๐‘ž ๐‘› ๐‘ง

  12. Reduction to matrix multiplication ๐‘ฆ 1 ๐‘œ 0.1 monomials โ‹ฎ ร— ๐‘ฆ ๐‘œ ๐‘ง 1 โ€ฆ ๐‘ง ๐‘œ Entry ๐‘™, ๐‘˜ : Evaluation of ๐‘ž ๐‘™ |๐‘ง ๐‘˜ ๐‘œ 0.1 monomials Entry ๐‘—, ๐‘™ : Evaluation of ๐‘ž ๐‘™ |๐‘ฆ ๐‘— Result matrix ๐‘†[๐‘—, ๐‘˜] : Evaluation of ๐‘„ under ๐‘ฆ ๐‘— = ๐‘ฆ ๐‘— [1], โ€ฆ , ๐‘ฆ ๐‘— [๐‘’] and ๐‘ง ๐‘˜ = ๐‘ง ๐‘˜ [1], โ€ฆ , ๐‘ง ๐‘˜ [๐‘’]

  13. Tool 3: Union Bound and Chernoff Bound Union Bound: Pr ๐ต โˆช ๐ถ โ‰ค Pr ๐ต + Pr ๐ถ (Variant of) Chernoff Bound: Let ๐‘Œ 1 , โ€ฆ , ๐‘Œ ๐‘™ be independent 0/1-valued random variables such that 0 < ๐น ๐‘Œ ๐‘— < 1 . ๐‘™ Then, the random variable ๐‘Œ = ๐‘—=1 ๐‘Œ ๐‘— satisfies: Pr ๐‘Œ < 1 โˆ’ ๐œ€ ๐น[๐‘Œ] โ‰ค ๐‘“ โˆ’๐œ€ 2 ๐น[๐‘Œ]/2 for every 0 โ‰ค ๐œ€ โ‰ค 1

  14. Solving the Problem

  15. Min-plus matrix product We give an algorithm for the following problem: โ€ข Given: ๐‘œ ร— ๐‘’ integer matrix ๐ต and ๐‘’ ร— ๐‘œ integer matrix ๐ถ โ€ข Output: ๐‘œ ร— ๐‘œ matrix ๐ท such that ๐ท ๐‘—, ๐‘˜ = ๐‘™โˆˆ{1,โ€ฆ,๐‘’} (๐ต ๐‘—, ๐‘™ + ๐ถ ๐‘™, ๐‘˜ ) min Matrix multiplication in min-plus semiring: โ€ข min is addition โ€ข + is multiplication โ€ข 0 is 1 -element โ€ข โˆž is 0 -element ๐‘™ โˆ— such that ๐ต ๐‘—, ๐‘™ โˆ— + ๐ถ ๐‘™ โˆ— , ๐‘˜ = ๐‘™โˆˆ{1,โ€ฆ,๐‘’} (๐ต ๐‘—, ๐‘™ + ๐ถ ๐‘™, ๐‘˜ ) is a witness for ๐‘—, ๐‘˜ min

  16. Tripartite graph for min-plus product ๐ท ๐‘—, ๐‘˜ = min 1โ‰ค๐‘™โ‰ค๐‘’ (๐ต ๐‘—, ๐‘™ + ๐ถ ๐‘™, ๐‘˜ ) ๐‘œ โ‹ฎ ๐‘’ ๐‘œ โ‹ฎ โ‹ฎ ๐‘ฅ ๐‘—, ๐‘™ = ๐ต[๐‘—, ๐‘™] ๐‘ฅ ๐‘™, ๐‘˜ = ๐ถ[๐‘™, ๐‘˜] (no edge if weight is โˆž) 1. Min-plus product = APSP in tripartite graph 2. If ๐ต = ๐ถ = ๐ป : ๐ป ร— ๐ป = matrix of 2 -hop distances

  17. APSP and min- plus product are โ€œequivalentโ€ In general: ๐ป ๐‘— = matrix distances using exactly ๐‘— hops Distance matrix ๐ธ : ๐ธ = ๐ฝ + ๐ป + ๐ป 2 + โ‹ฏ + ๐ป ๐‘œโˆ’1 = ๐ป + ๐ฝ ๐‘œโˆ’1 + is entry-wise minimum Identity matrix ๐ฝ : 0 at diagonal, โˆž otherwise Repeated squaring: Compute ๐ป + ๐ฝ 2 , ๐ป + ๐ฝ 4 , ๐ป + ๐ฝ 8 , โ€ฆ, โ‡’ ๐‘ƒ(log ๐‘œ) min-plus products for distances, shortest paths through witnesses Even stronger relationship known: Theorem : APSP on ๐‘œ nodes can be solved in time ๐‘ƒ(๐‘ˆ ๐‘œ ) if and only min-plus product on ๐‘œ ร— ๐‘œ matrices can be solved in time ๐‘ƒ(๐‘ˆ ๐‘œ ) .

  18. Step 1: : Divide into subproblems

  19. Overall algorithm ๐ต ๐ถ Set ๐‘’ = 2 log ๐‘œ/100 ๐‘’ 1. ๐ต 1 ๐ต ๐‘œ/๐‘’ ๐ถ 1 ๐‘œ 2. Divide problem into ๐‘’ subproblems 3. Solve each subproblem in time ๐‘ƒ ๐‘œ 2 poly log ๐‘œ ๐ถ ๐‘œ/๐‘’ Merge solutions in time ๐‘ƒ ๐‘œ 3 /๐‘’ 4. ๐‘œ For every ๐‘™ = 1, โ€ฆ , ๐‘’ : โ€ข Compute product ๐ท ๐‘™ of ๐ต ๐‘™ and ๐ถ ๐‘™ Total time: ( ๐‘œ ร— ๐‘’ matrix with ๐‘’ ร— ๐‘œ matrix) ๐‘œ 3 = ๐‘œ 3 /2 ฮฉ log ๐‘œ 1/2 ๐‘ƒ ๐‘’ poly log ๐‘œ Return: min ๐ท 1 , โ€ฆ , ๐ท ๐‘œ/๐‘’ (entry-wise minimum)

  20. Subproblem We solve the following subproblem: โ€ข Given: ๐‘œ ร— ๐‘’ matrix ๐ต and ๐‘’ ร— ๐‘œ matrix ๐ถ โ€ข Output: ๐‘œ ร— ๐‘œ matrix ๐‘‹ of witnesses such that ๐‘‹ ๐‘—, ๐‘˜ = arg min (๐ต ๐‘—, ๐‘™ + ๐ถ ๐‘™, ๐‘˜ ) ๐‘™โˆˆ{1,โ€ฆ,๐‘’} From witnesses in ๐‘‹ we can easily reconstruct values of min-plus ๐‘™โˆˆ{1,โ€ฆ,๐‘’} (๐ต ๐‘—, ๐‘™ + ๐ถ ๐‘™, ๐‘˜ ) in time ๐‘ƒ ๐‘œ 2 min product

  21. Step 2: : Preprocess input of subproblem

  22. Enforce unique minimum For every entry ๐‘—, ๐‘™ of ๐ต : Running time: ๐ต โˆ— ๐‘—, ๐‘™ โˆถ= ๐ต ๐‘—, ๐‘™ โ‹… ๐‘œ + 1 + ๐‘™ ๐‘ƒ(log ๐‘œ) additions per entry (add to itself for ๐‘ƒ(log ๐‘œ) times) For every entry ๐‘™, ๐‘˜ of ๐ถ ๐ถ โˆ— ๐‘™, ๐‘˜ โˆถ= ๐ถ ๐‘™, ๐‘˜ โ‹… ๐‘œ + 1 โ‡’ ๐‘ƒ ๐‘œ๐‘’ log ๐‘œ Fix some pair ๐‘—, ๐‘˜ and define ๐‘™ โˆ— as smallest ๐‘™ โ€ฒ โˆˆ {1, โ€ฆ , ๐‘’} such that ๐ต ๐‘—, ๐‘™ โ€ฒ + ๐ถ ๐‘™ โ€ฒ , ๐‘˜ = ๐‘™โˆˆ{1,โ€ฆ,๐‘’} ๐ต ๐‘—, ๐‘™ + ๐ถ ๐‘™, ๐‘˜ min Claim: ๐‘™ โˆ— is unique minimum of ๐ต โˆ— ๐‘—, ๐‘™ + ๐ถ โˆ— ๐‘™, ๐‘˜ over ๐‘™ โˆ— โˆˆ {1, โ€ฆ , ๐‘’} โ‡’ Work with ๐ต โˆ— and ๐ถ โˆ— instead of ๐ต and ๐ถ to ensure unique minima

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend