A new algorithm for the ordered tree inclusion problem
In the problem of ordered tree inclusion two ordered labeled trees P and T are given, and the pattern tree P matches the target tree T at a node x, if there exists a one-to-one map f from the nodes of P to the nodes of T which preserves the labels, the ancestor relation and the left-to-right ordering of the nodes. In  Kilpeläinen and Mannila give an algorithm that solves the problem of ordered tree inclusion in time and space Θ(∣P∣ · ∣T∣). In this paper we present a new algorithm for the ordered tree inclusion problem with time complexity O(∣Σ p ∣ · ∣T∣ +#matches · DEPTH(T)), where Σ p is the alphabet of the labels of the pattern tree and #matches is the number of pairs (v, w) ∈ P * T with LABEL(v)=LABEL(w). The space complexity of our algorithm is O ∣gS p ∣ · ∣T∣ + #matches).
KeywordsTarget Tree Suitable Candidate Parse Tree Label Tree Mapping Range
Unable to display preview. Download preview PDF.
- 1.M. Dubiner, Z. Galil and E. Magen, Faster Tree Pattern Matching, Proc. 31st FOCS (1990), pp. 145–150.Google Scholar
- 2.G. H. Gonnet and F. Wm. Tompa, Mind your Grammar-a New Approach to Text Databases, Proc. of the Conf. on Very Large Databases 1987 (VLDB'87), pp. 339–346.Google Scholar
- 3.C. M. Hoffman and M. J. O'Donnell, Pattern Matching in Trees, JACM 29 (1982), pp. 68–95.Google Scholar
- 4.P. Kilpeläinen, G. Linden, H. Mannila and E. Nikunen, A Structured Document Database System, in R. Furuta (ed.), EP'90-Proc. of the Int. Conf. on Electronic Publishing, Document Manipulation & Typography, The Cambridge Series on Electronic Publishing, Cambridge University Press, 1990.Google Scholar
- 5.P. Kilpeläinen and H. Mannila, Retrieval from Hierarchical Texts by Partial Patterns, in R. Korfhage, E. Rasmussen and P. Willet (eds.), SIGIR '93-Proc. of the 16th Ann. Int. ACM SIGIR Conf. on Research and Development in Informational Retrieval 1993, pp. 214–222.Google Scholar
- 6.P. Kilpeläinen and H. Mannila, Query Primitives for Tree-Structured Data, Proc. 5th CPM (1994), pp. 213–225.Google Scholar
- 7.P. Kilpeläinen and H. Mannila, Ordered and Unordered Tree Inclusion, SIAM J. Comput. 24 (1995), pp. 340–356.Google Scholar
- 8.D. E. Knuth, The Art of Computer Programming, Vol. 1, Addison-Wesley, Reading, MA, 1969, p. 347.Google Scholar
- 9.S. R. Kosaraju, Efficient Tree Pattern Matching, Proc. 30th FOCS (1989), pp. 178–183.Google Scholar
- 10.K. Zhang and D. Shasha, Simple Fast Algorithms for the Editing Distance between Trees and Related Problems, SIAM J. Comput. 18 (1989), pp. 1245–1262.Google Scholar