LCA Queries in Directed Acyclic Graphs

  • Miroslaw Kowaluk
  • Andrzej Lingas
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 3580)


We present two methods for finding a lowest common ancestor (LCA) for each pair of vertices of a directed acyclic graph (dag) on n vertices and m edges.

The first method is surprisingly natural and solves the all-pairs LCA problem for the input dag on n vertices and m edges in time O(nm). As a corollary, we obtain an O(n 2)-time algorithm for finding genealogical distances considerably improving the previously known O(n 2.575) time-bound for this problem.

The second method relies on a novel reduction of the all-pairs LCA problem to the problem of finding maximum witnesses for Boolean matrix product. We solve the latter problem and hence also the all-pairs LCA problem in time \(O(n^{{2}+\frac{1}{4-\omega}})\), where ω =2.376 is the exponent of the fastest known matrix multiplication algorithm. This improves the previously known \(O(n^{\frac{\omega+3}{2}})\) time-bound for the general all-pairs LCA problem in dags.


Common Ancestor Direct Acyclic Graph Transitive Closure Source Vertex Lower Common Ancestor 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    Alon, N., Naor, M.: Derandomization, Witnesses for Boolean Matrix Multiplication and Construction of Perfect hash functions. Algorithmica 16, 434–449 (1996)zbMATHCrossRefMathSciNetGoogle Scholar
  2. 2.
    Bender, M.A., Pemmasani, G., Skiena, S., Sumazin, P.: Finding Least Common Ancestors in Directed Acyclic Graphs. In: Proc. the 12th Annual ACM-SIAM Symposium on Discrete Algorithms (SODA), pp. 845–853 (2001)Google Scholar
  3. 3.
    Galil, Z., Margalit, O.: Witnesses for Boolean Matrix Multiplication and Shortest Paths. Journal of Complexity, 417–426 (1993)Google Scholar
  4. 4.
    Cottingham Jr., R.W., Idury, R.M., Shäffer, A.A.: Genetic linkage computations. American Journal of Human Genetics 53, 252–263 (1993)Google Scholar
  5. 5.
    Nykänen, M., Ukkonen, E.: Finding lowest common ancestors in arbitrarily directed trees. Inf. Process. Lett. 50(6), 307–310 (1994)zbMATHCrossRefGoogle Scholar
  6. 6.
    Shäffer, A.A., Gupta, S.K., Shriram, K., Cottingham Jr., R.W.: Avoiding recomputation in linkage analysis. Human Heredity 44, 225–237 (1994)CrossRefGoogle Scholar
  7. 7.
    Tarjan, R.E.: Applications of path compression on balanced trees. Journal of the ACM 26(4), 690–715 (1979)zbMATHCrossRefMathSciNetGoogle Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2005

Authors and Affiliations

  • Miroslaw Kowaluk
    • 1
  • Andrzej Lingas
    • 2
  1. 1.Institute of InformaticsWarsaw UniversityWarsaw
  2. 2.Department of Computer ScienceLund UniversityLund

Personalised recommendations