All-Pairs LCA in DAGs: Breaking through the O(n2.5) barrier

Let $G=(V,E)$ be an $n$-vertex directed acyclic graph (DAG). A lowest common ancestor (LCA) of two vertices $u$ and $v$ is a common ancestor $w$ of $u$ and $v$ such that no descendant of $w$ has the same property. In this paper, we consider the problem of computing an LCA, if any, for all pairs of vertices in a DAG. The fastest known algorithms for this problem exploit fast matrix multiplication subroutines and have running times ranging from $O(n^{2.687})$ [Bender et al.~SODA'01] down to $O(n^{2.615})$ [Kowaluk and Lingas~ICALP'05] and $O(n^{2.569})$ [Czumaj et al.~TCS'07]. Somewhat surprisingly, all those bounds would still be $\Omega(n^{2.5})$ even if matrix multiplication could be solved optimally (i.e., $\omega=2$). This appears to be an inherent barrier for all the currently known approaches, which raises the natural question on whether one could break through the $O(n^{2.5})$ barrier for this problem. In this paper, we answer this question affirmatively: in particular, we present an $\tilde O(n^{2.447})$ ($\tilde O(n^{7/3})$ for $\omega=2$) algorithm for finding an LCA for all pairs of vertices in a DAG, which represents the first improvement on the running times for this problem in the last 13 years. A key tool in our approach is a fast algorithm to partition the vertex set of the transitive closure of $G$ into a collection of $O(\ell)$ chains and $O(n/\ell)$ antichains, for a given parameter $\ell$. As usual, a chain is a path while an antichain is an independent set. We then find, for all pairs of vertices, a \emph{candidate} LCA among the chain and antichain vertices, separately. The first set is obtained via a reduction to min-max matrix multiplication. The computation of the second set can be reduced to Boolean matrix multiplication similarly to previous results on this problem. We finally combine the two solutions together in a careful (non-obvious) manner.

[1]  Noga Alon,et al.  Witnesses for Boolean matrix multiplication and for shortest paths , 1992, Proceedings., 33rd Annual Symposium on Foundations of Computer Science.

[2]  Si-Qing Zheng,et al.  A Comparative Study of Efficient Algorithms for Partitioning a Sequence into Monotone Subsequences , 2007, TAMC.

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

[4]  Virginia Vassilevska Williams,et al.  Nondecreasing paths in a weighted graph or: How to optimally read a train schedule , 2010, TALG.

[5]  Ran Duan,et al.  Faster Algorithms for All Pairs Non-decreasing Paths Problem , 2019, ICALP.

[6]  Klaus W. Wagner,et al.  Monotonic Coverings of Finite Sets , 1984, J. Inf. Process. Cybern..

[7]  Dieter Kratsch,et al.  On Partitions of Permutations into Increasing and Decreasing Subsequences , 1986, J. Inf. Process. Cybern..

[8]  Virginia Vassilevska Williams,et al.  Equivalences between triangle and range query problems , 2020, SODA.

[9]  Robert E. Tarjan,et al.  Fast Algorithms for Finding Nearest Common Ancestors , 1984, SIAM J. Comput..

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

[11]  Michael A. Bender,et al.  The LCA Problem Revisited , 2000, LATIN.

[12]  Moshe Lewenstein,et al.  Closest Pair Problems in Very High Dimensions , 2004, ICALP.

[13]  L. Mirsky A Dual of Dilworth's Decomposition Theorem , 1971 .

[14]  Raphael Yuster,et al.  Fast sparse matrix multiplication , 2004, TALG.

[15]  Fedor V. Fomin,et al.  Approximating minimum cocolorings , 2002, Inf. Process. Lett..

[16]  J. Ian Munro,et al.  Range Queries over Untangled Chains , 2010, SPIRE.

[17]  Bruce Christianson,et al.  A scalable approach to computing representative lowest common ancestor in directed acyclic graphs , 2013, Theor. Comput. Sci..

[18]  Andrzej Lingas,et al.  Unique Lowest Common Ancestors in Dags Are Almost as Easy as Matrix Multiplication , 2007, ESA.

[19]  Andrzej Lingas,et al.  LCA Queries in Directed Acyclic Graphs , 2005, ICALP.

[20]  Ming-Yang Kao,et al.  The Closest Pair Problem under the Hamming Metric , 2009, COCOON.

[21]  A. P. Gumbs,et al.  Finding , 2020, Definitions.

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

[23]  Raphael Yuster,et al.  On Minimum Witnesses for Boolean Matrix Multiplication , 2012, Algorithmica.

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

[25]  Tsvi Kopelowitz,et al.  {-1, 0, 1}-APSP and (min, max)-Product Problems , 2019, ArXiv.

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

[27]  Le Zhang,et al.  Improved Time Bounds for All Pairs Non-decreasing Paths in General Digraphs , 2018, ICALP.

[28]  Andrzej Lingas,et al.  A Path Cover Technique for LCAs in Dags , 2008, SWAT.

[29]  Allan Grønlund Jørgensen,et al.  Threesomes, Degenerates, and Love Triangles , 2014, 2014 IEEE 55th Annual Symposium on Foundations of Computer Science.

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

[31]  A. J. Stothers On the complexity of matrix multiplication , 2010 .

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

[33]  Ryan Williams,et al.  Finding, minimizing, and counting weighted subgraphs , 2009, STOC '09.

[34]  Steven Skiena,et al.  Finding least common ancestors in directed acyclic graphs , 2001, SODA '01.

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

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

[37]  Stephane Durocher,et al.  Untangled monotonic chains and adaptive range search , 2009, Theor. Comput. Sci..

[38]  Andrzej Lingas,et al.  Quantum and approximation algorithms for maximum witnesses of Boolean matrix products , 2020, CALDAM.

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

[40]  Raphael Yuster,et al.  All-Pairs Bottleneck Paths in Vertex Weighted Graphs , 2007, SODA '07.

[41]  Alfred V. Aho,et al.  On finding lowest common ancestors in trees , 1973, SIAM J. Comput..

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

[43]  François Le Gall,et al.  Algebraic complexity theory and matrix multiplication , 2014, ISSAC.

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

[45]  Paul Erdös,et al.  Some extremal results in cochromatic and dichromatic theory , 1991, J. Graph Theory.

[46]  Steven Skiena,et al.  Lowest common ancestors in trees and directed acyclic graphs , 2005, J. Algorithms.

[47]  A A Schäffer,et al.  Avoiding recomputation in linkage analysis. , 1994, Human heredity.

[48]  Reuven Bar-Yehuda,et al.  Partitioning a sequence into few monotone subsequences , 1998, Acta Informatica.

[49]  A A Schäffer,et al.  Faster sequential genetic linkage computations. , 1993, American journal of human genetics.