LCA Queries in Directed Acyclic Graphs
نویسندگان
چکیده
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)-time algorithm for finding genealogical distances considerably improving the previously known O(n) timebound 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 1 4−ω ), where ω = 2.376 is the exponent of the fastest known matrix multiplication algorithm. This improves the previously known O(n w+3 2 ) time-bound for the general all-pairs LCA problem in dags.
منابع مشابه
Computing Lowest Common Ancestors in Directed Acyclic Graphs
Finding the lowest common ancestor of a given pair of nodes is a fundamental algorithmic problem. In this paper we study the lowest common ancestor(LCA) problem on directed acyclic graphs (DAGs). A lowest common ancestor of two nodes a and b is a node c which is a common ancestor of a and b and no other node is both a common ancestor of a and b and a proper descendant of c. LCA on trees have be...
متن کاملLowest Common Ancestors in Trees and Directed Acyclic Graphs1
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. The ideas presented are not novel theoretical contributions, but they lay the ...
متن کاملLowest common ancestors in trees and directed acyclic graphs
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 presen...
متن کاملEffective Rule Induction from Molecular Structures Represented by Labeled Graphs
Acyclic conjunctive queries form a polynomially evaluable fragment of definite nonrecursive first-order Horn clauses. Labeled graphs, a special class of relational structures, provide a natural way for representing chemical compounds. We propose an algorithm specific to learning acyclic conjunctive queries predicting certain properties of molecules represented by labeled graphs. To compensate f...
متن کاملFast Lowest Common Ancestor Computations in Dags
This work studies lowest common ancestor problems in directed acyclic graphs. We present fast algorithms for solving the All-Pairs Representative LCA and AllPairs All LCA problems with expected running time of O(n2 log n) and O(n3 log log n) respectively. The speed-ups over recently developed methods are achieved by applying transitive reduction on the input dags. The algorithms are experimenta...
متن کامل