The tree inclusion problem

  • Pekka Kilpeläinen
  • Heikki Mannila
CAAP Colloquium On Trees In Algebra And Programming
Part of the Lecture Notes in Computer Science book series (LNCS, volume 493)


We consider the following problem: Given ordered albeled trees S and T, can S be obtained from T by deleting nodes? Deletion of the root node u of a subtree with children 〈T 1, ..., T n 〉 means replacing the subtree by the trees T 1, ..., T n . The problem is motivated by the study of query languages for structured text data bases. The simple solutions to this problem require exponential time. We give an algorithm based on dynamic programming requiring O(|S||T|) time and space.


Query Language Editing Distance Tree Inclusion Unordered Tree Outermost Loop 
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.


  1. [Bee90]
    Beeri, C., A formal approach to object-oriented databases. Data & Knowledge Engineering 5 (1990), 353–382.Google Scholar
  2. [CPT90]
    Cai, J., Paige, R., Tarjan, R., More efficient bottom-up tree pattern matching. In: Proc. of the 15th Colloqium on Trees in Algebra and Programming (CAAP'90), p. 72–86.Google Scholar
  3. [DGM90]
    Dubiner, M., Galil, Z., Magen, E., Faster tree pattern matching. In: Proc. of the Symposium on Foundations of Computer Science (FOCS'90), p. 145–150.Google Scholar
  4. [GoT87]
    Gonnet, G., Tompa, F., Mind your grammar — a new approach to text databases. In: Proc. of the Conference on Very Large Data Bases (VLDB'87), p. 339–346.Google Scholar
  5. [HoO82]
    Hoffman, C.M., O'Donnell, M.J., Pattern matching in trees. J. ACM, 29, 1 (January 1982), 68–95.Google Scholar
  6. [Joh87]
    Johnson, D.S., The NP-completeness column: an ongoing guide. J. Algorithms 8 (1987), 285–303.Google Scholar
  7. [Hir75]
    Hirschberg, D.S., A linear space algorithm for computing maximal common subsequences. CACM 18, 6 (June 1975), 341–343.Google Scholar
  8. [Kil91]
    Kilpeläinen, P., Query languages for structured text databases. Ph.D. Thesis, University of Helsinki; in preparation.Google Scholar
  9. [Knu69]
    Knuth, D.E., The Art of Computer Programming, Vol. 1. Addison-Wesley 1969.Google Scholar
  10. [Kos89]
    Kosaraju, S.R., Efficient tree pattern matching. In: Proc. of the Symposium on Foundations of Computer Science (FOCS'89), p. 178–183.Google Scholar
  11. [MaR90]
    Mannila, H., Räihä, K.-J., On query languages for the p-string data model. In: Information Modelling and Knowledge Bases, H. Kangassalo, S. Ohsuga, H. Jaakkola (eds.), IOS Press, 1990, p. 469–482.Google Scholar
  12. [Rey77]
    Reyner, S.W., An analysis of a good algorithm for the subtree problem. SIAM J. Computing 6, 4 (December 1977), 730–732.Google Scholar
  13. [RoS86]
    Robertson, N., Seymour, P.D., Graph Minors. II. Algorithmic aspects of tree-width. J. Algorithms 7 (1986), 309–322.Google Scholar
  14. [ShZ90]
    Shasha, D., Zhang, K., Fast algorithms for the unit cost editing distance between trees. J. Algorithms 11 (1990), 581–621.Google Scholar
  15. [Tai79]
    Tai, K.-C., The tree-to-tree correction problem. J. ACM 26, 3 (July 1979), 422–433.Google Scholar
  16. [ZhS89]
    Zhang, K., Shasha, D., Simple fast algorithms for the editing distance between trees and related problems. SIAM Journal of Computing 18, 6 (December 1989), 1245–1262.Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 1991

Authors and Affiliations

  • Pekka Kilpeläinen
    • 1
  • Heikki Mannila
    • 1
  1. 1.Department of Computer ScienceUniversity of HelsinkiHelsinkiFinland

Personalised recommendations