1 / 27

Answering distance queries in directed graphs using fast matrix multiplication

This paper presents a new algorithm for efficiently answering distance queries in directed graphs, which generalizes both the single-source shortest path and all-pairs shortest path problems. The algorithm utilizes fast matrix multiplication techniques to improve upon existing algorithms. It also considers different cases of edge weights, including real, integer, and positive/negative weights.

hcheng
Download Presentation

Answering distance queries in directed graphs using fast matrix multiplication

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Answering distance queriesin directed graphs using fast matrix multiplication Raphael Yuster Haifa University Uri Zwick Tel Aviv University

  2. Answering distance queries Generalizes both SSSP and APSP Preprocessing: datastructure u,v δ(u,v) Query answering:

  3. New result:Answering distance queries Directed graphs. Edge weights in {−M,…,0,…M} In particular, any Mn1.38distances can be computed in Mn2.38time. For dense enough graphs with small enough edge weights, this improves on Goldberg’s SSSP algorithm.Mn2.38 vs.mn0.5logM

  4. Single-source Shortest Pathsin directed graphs with real edge weights Non-negative edge weights Positive and negative edge weights

  5. Single-source Shortest Pathsin directed graphs with integer edge weights Positive and negativeedge weights greater than –N For dense graphs, the running time is O(n2.5) !!!

  6. All-Pairs Shortest Pathsin directed graphs with real edge weights For dense graphs, the running time is O(n3) !!!

  7. All-Pairs Shortest Pathsin graphs with small integer weights Undirected graphs. Edge weights in {0,1,…M} Improves results of [Alon-Galil-Margalit ’91] [Seidel ’95]

  8. All-Pairs Shortest Pathsin graphs with small integer weights Directed graphs. Edge weights in {−M,…,0,…M} Improves results of [Alon-Galil-Margalit ’91] [Takaoka ’98]

  9. New result:Answering distance queries Directed graphs. Edge weights in {−M,…,0,…M} In particular, any Mn1.38distances can be computed in Mn2.38time. For dense enough graphs with small enough edge weights, this improves on Goldberg’s SSSP algorithm.Mn2.38 vs.mn0.5logM

  10. An interesting special caseof the APSP problem A B 20 17 30 2 23 10 5 20 Min-Plus product

  11. Solving the APSP problem by repeated squaring If W is an n by n matrix containing the edge weightsof a graph. Then Wn is the distance matrix. D W for i 1 to log2n do D  D*D Thus:APSP(n)  MPP(n) log n Actually:APSP(n) = O(MPP(n))

  12. Min-Plus Product Algebraic Product O(n2.38)[Strassen ’69] … [Coppersmith-Winograd ’90] The fast algebraic algorithms cannot be used, as the min operation has no inverse

  13. Using matrix multiplicationto compute min-plus products

  14. Using matrix multiplicationto compute min-plus products Assume: 0 ≤ aij , bij≤ M Moperations per polynomial product Mn2.38operations per max-plus product n2.38polynomial products  =

  15. Trying to implement the repeated squaring algorithm Consider an easy case: all weights are 1.  *

  16. Sampled Repeated Squaring (Z ’98) • D W • for i 1 to log3/2n do • { • s  (3/2)i+1 • B  rand( V , (9nlnn)/s ) • D  min{ D , D[V,B]*D[B,V] } • } Choose a subset of Vof size (9nlnn)/s Select the columns of D whose indices are in B Select the rowsof D whose indices are in B With high probability, all distances are correct! The is also a slightly more complicated deterministic algorithm

  17. n |B| Sampled Distance Products(Z ’98) n In the i-th iteration, the set B is of size n ln n / s, where s = (3/2)i n The matrices get smaller and smallerbut the elements get larger andlarger

  18. at most at most Invariant: After the i-th iteration, distances that are attained using at most (3/2)i edges are correct. Sampled Repeated Squaring - Correctness • D W • for i 1 to log3/2n do • { • s  (3/2)i+1 • B  rand(V,(9 ln n)/s) • D  min{ D , D[V,B]*D[B,V] } • } Consider a shortest path that uses at most (3/2)i+1 edges Failure probability : Let s = (3/2)i+1

  19. p n n n =  n p Rectangular Matrix multiplication Naïve complexity: n2p [Coppersmith ’97]:n1.85p0.54+n2+o(1) For p ≤ n0.29, complexity = n2+o(1) !!!

  20. n ln n / s n n  n ln n / s Complexity of APSP algorithm The i-th iteration: s=(3/2)i+1 The elements are of absolute value at mostMs

  21. The new preprocessing algorithm • D W ; B V • for i 1 to log3/2n do • { • s  (3/2)i+1 • B  rand(B,(9nlnn)/s) • D[V,B]  min{D[V,B] , D[V,B]*D[B,B] } • D[B,V]  min{D[B,V] , D[B,B]*D[B,V] } • }

  22. The old algorithm • D W • for i 1 to log3/2n do • { • s  (3/2)i+1 • B  rand(V,(9nlnn)/s) • } D  min{ D , D[V,B]*D[B,V] }

  23. |B| |B| n n |B| n |B| |B| Twice Sampled Distance Products n n

  24. v u The query answering algorithm • δ(u,v)  D[{u},V]*D[V,{v}] Query time: O(n)

  25. at most at most The preprocessing algorithm: Correctness Let Bi be the i-th sample. B1 B2 B3 … Invariant: After the i-th iteration, if u Bi orvBiand there is a shortest path from u to v that uses at most(3/2)i edges, then D(u,v)=δ(u,v). Consider a shortest path that uses at most (3/2)i+1 edges

  26. at most at most The query answering algorithm: Correctness Suppose that the shortest path from u to vuses between (3/2)i and (3/2)i+1 edges u v

  27. Open problems • An O(n3-ε) algorithm for the APSP problem with edge weights in {1,2,…,n}? • More generally, an O(n3-ε(log M)c) algorithmfor the APSP problem? • An O(n2.5-ε) algorithm for the SSSP problem with edge weights in {0,±1, ±2,…, ±n}? • More generally, an O(n2.5-ε(log M)c) algorithm for the SSSP problem?

More Related