The tree inclusion problem
Open Access
- 15 July 2011
- journal article
- research article
- Published by Association for Computing Machinery (ACM) in ACM Transactions on Algorithms
- Vol. 7 (3) , 1-47
Abstract
Given two rooted, ordered, and labeled trees P and T the tree inclusion problem is to determine if P can be obtained from T by deleting nodes in T . This problem has recently been recognized as an important query primitive in XML databases. Kilpeläinen and Mannila [1995] presented the first polynomial-time algorithm using quadratic time and space. Since then several improved results have been obtained for special cases when P and T have a small number of leaves or small depth. However, in the worst case these algorithms still use quadratic time and space. Let n S , l S , and d S denote the number of nodes, the number of leaves, and the depth of a tree S ∈ P , T . In this article we show that the tree inclusion problem can be solved in space O ( n T ) and time: O⎛⎝min⎧⎨⎩lPnTlPlT log log nT + nTnPnTlog nT+ nT log nT⎫⎬⎭⎞⎠. This improves or matches the best known time complexities while using only linear space instead of quadratic. This is particularly important in practical applications, such as XML databases, where the space is likely to be a bottleneck.Keywords
Funding Information
- Fifth Framework Programme (IST-2001-35443)
This publication has 21 references indexed in Scilit:
- A survey on tree edit distance and related problemsTheoretical Computer Science, 2005
- Finding hot query patterns over an XQuery streamThe VLDB Journal, 2004
- Querying and ranking XML documentsJournal of the American Society for Information Science and Technology, 2002
- Deterministic DictionariesJournal of Algorithms, 2001
- Faster Subtree IsomorphismJournal of Algorithms, 1999
- More Efficient Algorithm for Ordered Tree InclusionJournal of Algorithms, 1998
- Simple Fast Algorithms for the Editing Distance between Trees and Related ProblemsSIAM Journal on Computing, 1989
- O(n2.5) time algorithms for the subgraph homeomorphism problem on treesJournal of Algorithms, 1987
- Pattern Matching in TreesJournal of the ACM, 1982
- The Tree-to-Tree Correction ProblemJournal of the ACM, 1979