TY - JOUR
T1 - Lowest common ancestors in trees and directed acyclic graphs
AU - Bender, Michael A.
AU - Farach-Colton, Martín
AU - Pemmasani, Giridhar
AU - Skiena, Steven
AU - Sumazin, Pavel
N1 - Funding Information:
✩ This work appeared in preliminary form in publications: [M.A. Bender, M. Farach-Colton, The LCA problem revisited, in: Latin American Theoretical Informatics, April 2000, pp. 88–94. [2]] and [M.A. Bender, G. Pemmasani, S. Skiena, P. Sumazin, Finding least common ancestors in directed acyclic graphs, in: Proceedings of the 12th Annual ACM–SIAM Symposium on Discrete Algorithms, ACM Press, January 2001, pp. 235–244. [3]]. * Corresponding author. E-mail addresses: bender@cs.sunysb.edu (M.A. Bender), farach@cs.rutgers.edu (M. Farach-Colton), giri@cs.sunysb.edu (G. Pemmasani), skiena@cs.sunysb.edu (S. Skiena), ps@cs.pdx.edu (P. Sumazin). 1 Supported in part by NSF Grants EIA-0112849, CCR-0208670 and HRL Laboratories, ISX Corporation, and Sandia National Laboratories. 2 Supported in part by NSF Career Development Award CCR-9501942, NATO Grant CRG 960215, NSF/NIH Grant BIR 94-12594-03-CONF, NSF grant CCR-9820879. 3 Supported in part by NSF Grant CCR-9625669 and ONR Award N00149710589. 4 Supported by NSF Grant DBI-0306152.
PY - 2005/11
Y1 - 2005/11
N2 - We study the problem of finding lowest common ancestors (LCA) in trees and directed acyclic graphs (DAGs). Specifically, we extend the LCA problem to DAGs and study the LCA variants that arise in this general setting. We begin with a clear exposition of Berkman and Vishkin's simple optimal algorithm for LCA in trees. Their ideas lay the foundation for our work on LCA problems in DAGs. We present an algorithm that finds all-pairs-representative LCA in DAGs in Õ(n2.688) operations, provide a transitive-closure lower bound for the all-pairs-representative-LCA problem, and develop an LCA-existence algorithm that preprocesses the DAG in transitive-closure time. We also present a suboptimal but practical O(n3) algorithm for all-pairs-representative LCA in DAGs that uses ideas from the optimal algorithms in trees and DAGs. Our results reveal a close relationship between the LCA, all-pairs-shortest-path, and transitive-closure problems. We conclude the paper with a short experimental study of LCA algorithms in trees and DAGs. Our experiments and source code demonstrate the elegance of the preprocessing-query algorithms for LCA in trees. We show that for most trees the suboptimal Θ(nlogn)-preprocessing Θ(1)-query algorithm should be preferred, and demonstrate that our proposed O(n3) algorithm for all-pairs-representative LCA in DAGs performs well in both low and high density DAGs.
AB - We study the problem of finding lowest common ancestors (LCA) in trees and directed acyclic graphs (DAGs). Specifically, we extend the LCA problem to DAGs and study the LCA variants that arise in this general setting. We begin with a clear exposition of Berkman and Vishkin's simple optimal algorithm for LCA in trees. Their ideas lay the foundation for our work on LCA problems in DAGs. We present an algorithm that finds all-pairs-representative LCA in DAGs in Õ(n2.688) operations, provide a transitive-closure lower bound for the all-pairs-representative-LCA problem, and develop an LCA-existence algorithm that preprocesses the DAG in transitive-closure time. We also present a suboptimal but practical O(n3) algorithm for all-pairs-representative LCA in DAGs that uses ideas from the optimal algorithms in trees and DAGs. Our results reveal a close relationship between the LCA, all-pairs-shortest-path, and transitive-closure problems. We conclude the paper with a short experimental study of LCA algorithms in trees and DAGs. Our experiments and source code demonstrate the elegance of the preprocessing-query algorithms for LCA in trees. We show that for most trees the suboptimal Θ(nlogn)-preprocessing Θ(1)-query algorithm should be preferred, and demonstrate that our proposed O(n3) algorithm for all-pairs-representative LCA in DAGs performs well in both low and high density DAGs.
KW - Cartesian tree
KW - Directed cyclic graph (DAG)
KW - Lowest common ancestor (LCA)
KW - Range minimum query (RMQ)
KW - Shortest path
UR - http://www.scopus.com/inward/record.url?scp=27144489067&partnerID=8YFLogxK
UR - http://www.scopus.com/inward/citedby.url?scp=27144489067&partnerID=8YFLogxK
U2 - 10.1016/j.jalgor.2005.08.001
DO - 10.1016/j.jalgor.2005.08.001
M3 - Article
AN - SCOPUS:27144489067
SN - 0196-6774
VL - 57
SP - 75
EP - 94
JO - Journal of Algorithms
JF - Journal of Algorithms
IS - 2
ER -