Algorithms, Reductions and Equivalences for Small Weight Variants of All-Pairs Shortest Paths

All-Pairs Shortest Paths (APSP) is one of the most well studied problems in graph algorithms. This paper studies several variants of APSP in unweighted graphs or graphs with small integer weights. APSP with small integer weights in undirected graphs [Seidel’95, Galil and Margalit’97] has an Õ(n) time algorithm, where ω < 2.373 is the matrix multiplication exponent. APSP in directed graphs with small weights however, has a much slower running time that would be Ω(n) even if ω = 2 [Zwick’02]. To understand this n bottleneck, we build a web of reductions around directed unweighted APSP. We show that it is fine-grained equivalent to computing a rectangular Min-Plus product for matrices with integer entries; the dimensions and entry size of the matrices depend on the value of ω. As a consequence, we establish an equivalence between APSP in directed unweighted graphs, APSP in directed graphs with small (Õ(1)) integer weights, All-Pairs Longest Paths in DAGs with small weights, cRed-APSP in undirected graphs with small weights, for any c ≥ 2 (computing all-pairs shortest path distances among paths that use at most c red edges), #≤cAPSP in directed graphs with small weights (counting the number of shortest paths for each vertex pair, up to c), and approximate APSP with additive error c in directed graphs with small weights, for c ≤ Õ(1). We also provide fine-grained reductions from directed unweighted APSP to All-Pairs Shortest Lightest Paths (APSLP) in undirected graphs with {0, 1} weights and #mod cAPSP in directed unweighted graphs (computing counts mod c), thus showing that unless the current algorithms for APSP in directed unweighted graphs can be improved substantially, these problems need at least Ω(n) time. We complement our hardness results with new algorithms. We improve the known algorithms for APSLP in directed graphs with small integer weights (previously studied by Zwick [STOC’99]) and for approximate APSP with sublinear additive error in directed unweighted graphs (previously studied by Roditty and Shapira [ICALP’08]). Our algorithm for approximate APSP with sublinear additive error is optimal, when viewed as a reduction to Min-Plus product. We also give new algorithms for variants of #APSP (such as #≤UAPSP and #mod UAPSP for U ≤ nÕ) in unweighted graphs, as well as a near-optimal Õ(n)-time algorithm for the original #APSP problem in unweighted graphs (when counts may be exponentially large). This also implies an Õ(n)-time algorithm for Betweenness Centrality, improving on the previous Õ(n) running time for the problem. Our techniques also lead to a simpler alternative to Shoshan and Zwick’s algorithm [FOCS’99] for the original APSP problem in undirected graphs with small integer weights.

[1]  Piotr Indyk,et al.  Fast estimation of diameter and shortest paths (without matrix multiplication) , 1996, SODA '96.

[2]  Josh Alman,et al.  A Refined Laser Method and Faster Matrix Multiplication , 2020, SODA.

[3]  Marvin Künnemann,et al.  Approximating APSP without scaling: equivalence of approximate min-plus and exact min-max , 2019, STOC.

[4]  Virginia Vassilevska Williams,et al.  Multiplying matrices faster than coppersmith-winograd , 2012, STOC '12.

[5]  V. V. Williams ON SOME FINE-GRAINED QUESTIONS IN ALGORITHMS AND COMPLEXITY , 2019, Proceedings of the International Congress of Mathematicians (ICM 2018).

[6]  Virginia Vassilevska Williams,et al.  Monochromatic Triangles, Intermediate Matrix Products, and Convolutions , 2020, ITCS.

[7]  Jirí Matousek,et al.  Computing Dominances in E^n , 1991, Inf. Process. Lett..

[8]  François Le Gall,et al.  Improved Rectangular Matrix Multiplication using Powers of the Coppersmith-Winograd Tensor , 2017, SODA.

[9]  Przemyslaw Uznanski,et al.  Hamming Distance Completeness , 2019, CPM.

[10]  Richard Peng,et al.  Bipartite Matching in Nearly-linear Time on Moderately Dense Graphs , 2020, 2020 IEEE 61st Annual Symposium on Foundations of Computer Science (FOCS).

[11]  Uri Zwick,et al.  All pairs lightest shortest paths , 1999, STOC '99.

[12]  Fabrizio Grandoni,et al.  All-Pairs LCA in DAGs: Breaking through the O(n2.5) barrier , 2020, ArXiv.

[13]  Michael J. Fischer,et al.  Boolean Matrix Multiplication and Transitive Closure , 1971, SWAT.

[14]  Raphael Yuster,et al.  Efficient algorithms on sets of permutations, dominance, and real-weighted APSP , 2009, SODA.

[15]  Asaf Shapira,et al.  All-pairs shortest paths with a sublinear additive error , 2008, TALG.

[16]  Uri Zwick,et al.  All pairs shortest paths in undirected graphs with integer weights , 1999, 40th Annual Symposium on Foundations of Computer Science (Cat. No.99CB37039).

[17]  Ely Porat,et al.  New Parameterized Algorithms for APSP in Directed Graphs , 2016, ESA.

[18]  Andrzej Lingas,et al.  Faster algorithms for finding lowest common ancestors in directed acyclic graphs , 2007, Theor. Comput. Sci..

[19]  Ulrik Brandes,et al.  On variants of shortest-path betweenness centrality and their generic computation , 2008, Soc. Networks.

[20]  U. Brandes A faster algorithm for betweenness centrality , 2001 .

[21]  Raimund Seidel,et al.  On the All-Pairs-Shortest-Path Problem in Unweighted Undirected Graphs , 1995, J. Comput. Syst. Sci..

[22]  Raphael Yuster,et al.  Finding heaviest H-subgraphs in real weighted graphs, with applications , 2006, TALG.

[23]  Zvi Galil,et al.  All Pairs Shortest Paths for Graphs with Small Integer Length Edges , 1997, J. Comput. Syst. Sci..

[24]  Ryan Williams,et al.  Faster all-pairs shortest paths via circuit complexity , 2013, STOC.

[25]  Timothy M. Chan All-pairs shortest paths for unweighted undirected graphs in o(mn) time , 2012, TALG.

[26]  Uri Zwick,et al.  All pairs shortest paths using bridging sets and rectangular matrix multiplication , 2000, JACM.

[27]  Ran Duan,et al.  Fast algorithms for (max, min)-matrix multiplication and bottleneck shortest paths , 2009, SODA.

[28]  Timothy M. Chan More algorithms for all-pairs shortest paths in weighted graphs , 2007, STOC '07.

[29]  Yinzhan Xu,et al.  Truly Subcubic Min-Plus Product for Less Structured Matrices, with Applications , 2019, SODA.

[30]  François Le Gall,et al.  Powers of tensors and fast matrix multiplication , 2014, ISSAC.

[31]  Zvi Galil,et al.  All Pairs Shortest Distances for Graphs with Small Integer Length Edges , 1997, Inf. Comput..

[32]  Zvi Galil,et al.  Witnesses for Boolean Matrix Multiplication and for Transitive Closure , 1993, J. Complex..

[33]  Raphael Yuster,et al.  Finding the Smallest H-Subgraph in Real Weighted Graphs and Related Problems , 2006, ICALP.

[34]  Raphael Yuster,et al.  All-pairs bottleneck paths for general graphs in truly sub-cubic time , 2007, STOC '07.

[35]  Noga Alon,et al.  On the Exponent of the All Pairs Shortest Path Problem , 1991, J. Comput. Syst. Sci..