Fast Lowest Common Ancestor Computations in Dags

  • Stefan Eckhardt
  • Andreas Michael Mühling
  • Johannes Nowak
Part of the Lecture Notes in Computer Science book series (LNCS, volume 4698)


This work studies lowest common ancestor computations in directed acyclic graphs. We present fast algorithms for solving the All-Pairs Representative LCA and All-Pairs All LCA problems with expected running time of O(n 2 logn) and O(n 3 loglogn) respectively, where the expectation is taken over a distribution of input graphs. The speed-ups over recently developed methods are achieved by applying transitive reduction on the input dags. The algorithms are experimentally evaluated against previous approaches demonstrating a significant improvement. On the purely theoretical side, we improve the upper bound for All-Pairs All LCA to O(n 3.3399). We give first fully dynamic algorithms for both All-Pairs Representative LCA and All-Pairs All LCA. Here, the non-trivial update complexities are O(n 2.5) and O(n 3) respectively, with constant query times.


Directed Acyclic Graph Transitive Closure Query Time Phylogenetic Network Path Cover 
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.
    Aho, A.V., Hopcroft, J.E., Ullman, J.D.: On finding lowest common ancestors in trees. SIAM J. Comput. 5(1), 115–132 (1976)zbMATHCrossRefMathSciNetGoogle Scholar
  2. 2.
    Aït-Kaci, H., Boyer, R.S., Lincoln, P., Nasr, R.: Efficient implementation of lattice operations. ACM Trans. Prog. Lang. Syst. 11(1), 115–146 (1989)CrossRefGoogle Scholar
  3. 3.
    An, Y., Janssen, J., Milios, E.E.: Characterizing and mining the citation graph of the computer science literature. Knowl. Inf. Syst. 6(6), 664–678 (2004)CrossRefGoogle Scholar
  4. 4.
    Barak, A.B., Erdős, P.: On the maximal number of strongly independent vertices in a random directed acyclic graph. SIAM J. on Algebraic and Discrete Methods 5(4), 508–514 (1984)zbMATHGoogle Scholar
  5. 5.
    Baumgart, M., Eckhardt, S., Griebsch, J., Kosub, S., Nowak, J.: All-pairs common-ancestor problems in weighted directed acyclic graphs. In: Proc. ESCAPE 2007. LNCS, vol. 4614, pp. 282–293. Springer, Heidelberg (2007)Google Scholar
  6. 6.
    Bender, M.A., Farach-Colton, M., Pemmasani, G., Skiena, S., Sumazin, P.: Lowest common ancestors in trees and directed acyclic graphs. J. Algorithms 57(2), 75–94 (2005)zbMATHCrossRefMathSciNetGoogle Scholar
  7. 7.
    Bender, M.A., Pemmasani, G., Skiena, S., Sumazin, P.: Finding least common ancestors in directed acyclic graphs. In: Proc. SODA 2001, pp. 845–854 (2001)Google Scholar
  8. 8.
    Berkman, O., Vishkin, U.: Finding level-ancestors in trees. J. Comput. Syst. Sci. 48(2), 214–230 (1994)zbMATHCrossRefMathSciNetGoogle Scholar
  9. 9.
    Cole, R., Hariharan, R.: Dynamic LCA queries on trees. SIAM J. Comput. 34(4), 894–923 (2005)zbMATHCrossRefMathSciNetGoogle Scholar
  10. 10.
    Coppersmith, D.: Rectangular matrix multiplication revisited. J. Complexity 13(1), 42–49 (1997)zbMATHCrossRefMathSciNetGoogle Scholar
  11. 11.
    Coppersmith, D., Winograd, S.: Matrix multiplication via arithmetic progressions. Journal of Symbolic Computation 9(3), 251–280 (1990)zbMATHCrossRefMathSciNetGoogle Scholar
  12. 12.
    Czumaj, A., Kowaluk, M., Lingas, A.: Faster algorithms for finding lowest common ancestors in directed acyclic graphs. ECCC (111) (2006)Google Scholar
  13. 13.
    Eckhardt, S., Mühling, A.M., Nowak, J.: Fast lca computations in directed acyclic graphs. Technical Report TUM-I0707, Inst. f. Informatik, TU München (2006)Google Scholar
  14. 14.
    Goralćíková, A., Koubek, V.: A reduct-and-closure algorithm for graphs. In: Becvar, J. (ed.) Mathematical Foundations of Computer Science 1979. LNCS, vol. 74, pp. 301–307. Springer, Heidelberg (1979)Google Scholar
  15. 15.
    Harel, D., Tarjan, R.E.: Fast algorithms for finding nearest common ancestors. SIAM J. Comput. 13(2), 338–355 (1984)zbMATHCrossRefMathSciNetGoogle Scholar
  16. 16.
    Hummel, B., Kosub, S.: Acyclic type-of-relationship problems on the internet: An experimental analysis. Technical report, Inst. f. Informatik, TU München (2007)Google Scholar
  17. 17.
    Huson, D.H., Bryant, D.: Application of phylogenetic networks in evolutionary studies. Mol. Biol. Evol. 23(2), 254–267 (2006)CrossRefGoogle Scholar
  18. 18.
    Kosub, S., Maaß, M.G., Täubig, H.: Acyclic type-of-relationship problems on the internet. In: Erlebach, T. (ed.) CAAN 2006. LNCS, vol. 4235, pp. 98–111. Springer, Heidelberg (2006)CrossRefGoogle Scholar
  19. 19.
    Kowaluk, M., Lingas, A.: LCA queries in directed acyclic graphs. In: Caires, L., Italiano, G.F., Monteiro, L., Palamidessi, C., Yung, M. (eds.) ICALP 2005. LNCS, vol. 3580, pp. 241–248. Springer, Heidelberg (2005)Google Scholar
  20. 20.
    Nykänen, M., Ukkonen, E.: Finding lowest common ancestors in arbitrarily directed trees. Inf. Process. Lett. 50(1), 307–310 (1994)zbMATHCrossRefGoogle Scholar
  21. 21.
    Sankowski, P.: Dynamic transitive closure via dynamic matrix inverse (extended abstract). In: Proc. FOCS 2004, pp. 509–517 (2004)Google Scholar
  22. 22.
    Schieber, B., Vishkin, U.: On finding lowest common ancestors: Simplification and parallelization. SIAM J. Comput. 17(6), 1253–1262 (1988)zbMATHCrossRefMathSciNetGoogle Scholar
  23. 23.
    Simon, K.: An improved algorithm for transitive closure on acyclic digraphs. Theor. Comput. Sci. 58, 325–346 (1988)zbMATHCrossRefGoogle Scholar
  24. 24.
    Tarjan, R.E.: Applications of path compression on balanced trees. J. ACM 26(4), 690–715 (1979)zbMATHMathSciNetGoogle Scholar
  25. 25.
    Wang, B.-F., Tsai, J.-N., Chuang, Y.-C.: The lowest common ancestor problem on a tree with an unfixed root. Information Sciences 119(1–2), 125–130 (1999)zbMATHCrossRefMathSciNetGoogle Scholar
  26. 26.
    Wen, Z.: New algorithms for the LCA problem and the binary tree reconstruction problem. Inf. Process. Lett. 51(1), 11–16 (1994)zbMATHCrossRefGoogle Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2007

Authors and Affiliations

  • Stefan Eckhardt
    • 1
  • Andreas Michael Mühling
    • 1
  • Johannes Nowak
    • 1
  1. 1.Fakultät für Informatik, Technische Universität München, Boltzmannstraße 3, D-85748 GarchingGermany

Personalised recommendations