Constrained Tree Inclusion

  • Gabriel Valiente
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 2676)


The tree matching problem is considered of given labeled trees P and T, determining if the pattern tree P can be obtained from the text tree T by deleting degree-one and degree-two nodes and, in the case of unordered trees, by also permuting siblings. The constrained tree inclusion problem is more sensitive to the structure of the pattern tree than the general tree inclusion problem. Further, it can be solved in polynomial time for both unordered and ordered trees. Algorithms based on the subtree homeomorphism algorithm of (Chung, 1987) are presented that solve the constrained tree inclusion problem in O(m 1.5 n) time on unordered trees with m and n nodes, and in O(mn) time on ordered trees, using O(mn) additional space. These algorithms can be improved using results of (Shamir and Tsur, 1999) to run in O((m 1.5/ logm)n) and O((m/logm)n) time, respectively.


Tree inclusion tree pattern matching subtree homeomorphism noncrossing bipartite matching 


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    S. Abiteboul, P. Buneman, and D. Suciu. Data on the Web: From Relations to Semistructured Data and XML. Morgan Kaufmann, 2000.Google Scholar
  2. 2.
    L. Alonso and R. Schott. On the tree inclusion problem. Acta Informatica, 37(9):653–670, 2001.zbMATHCrossRefMathSciNetGoogle Scholar
  3. 3.
    A. T. Berztiss. Data Structures: Theory and Practice. Academic Press, New York, 2nd edition, 1975.zbMATHGoogle Scholar
  4. 4.
    W. Chen. More efficient algorithm for ordered tree inclusion. Journal of Algorithms, 26(2):370–385, 1998.zbMATHCrossRefMathSciNetGoogle Scholar
  5. 5.
    M.-J. Chung. O(n 2.5) time algorithms for the subgraph homeomorphism problem on trees. Journal of Algorithms, 8(1):106–112, 1987.zbMATHCrossRefMathSciNetGoogle Scholar
  6. 6.
    P. Dublish. Some comments on the subtree isomorphism problem for ordered trees. Information Processing Letters, 36(5):273–275, 1990.zbMATHCrossRefMathSciNetGoogle Scholar
  7. 7.
    R. Grossi. Further comments on the subtree isomorphism for ordered trees. Information Processing Letters, 40(5):255–256, 1991.zbMATHCrossRefMathSciNetGoogle Scholar
  8. 8.
    R. Grossi. A note on the subtree isomorphism for ordered trees and related problems. Information Processing Letters, 39(2):81–84, 1991.zbMATHCrossRefMathSciNetGoogle Scholar
  9. 9.
    J. E. Hopcroft and R. M. Karp. An n 5/2 algorithm for maximum matchings in bipartite graphs. SIAM Journal on Computing, 2(4):225–231, 1973.zbMATHCrossRefMathSciNetGoogle Scholar
  10. 10.
    P. Kilpeläinen and H. Mannila. Retrieval from hierarchical texts by partial patterns. In Proc. 16th Annual Int. ACM SIGIR Conf. Research and Development in Information Retrieval, pages 214–222. ACM Press, 1993.Google Scholar
  11. 11.
    P. Kilpeläinen and H. Mannila. Ordered and unordered tree inclusion. SIAM Journal on Computing, 24(2):340–356, 1995.zbMATHCrossRefMathSciNetGoogle Scholar
  12. 12.
    D. E. Knuth. Fundamental Algorithms, volume 1 of The Art of Computer Programming. Addison-Wesley, Reading MA, 3rd edition, 1997.zbMATHGoogle Scholar
  13. 13.
    E. Mäkinen. On the subtree isomorphism problem for ordered trees. Information Processing Letters, 32(5):271–273, 1989.zbMATHCrossRefMathSciNetGoogle Scholar
  14. 14.
    F. Malucelli, T. Ottmann, and D. Pretolani. Efficient labelling algorithms for the maximum noncrossing matching problem. Discrete Applied Mathematics, 47(2):175–179, 1993.zbMATHCrossRefMathSciNetGoogle Scholar
  15. 15.
    J. Matoušek and R. Thomas. On the complexity of finding isomorphisms and other morphisms for partial k-trees. Discrete Mathematics, 108(1–3):343–364, 1992.CrossRefMathSciNetzbMATHGoogle Scholar
  16. 16.
    D. W. Matula. Subtree isomorphism in O(n 5/2). Annals of Discrete Mathematics, 2(1):91–106, 1978.zbMATHMathSciNetCrossRefGoogle Scholar
  17. 17.
    N. Nishimura, P. Ragde, and D. M. Thilikos. Finding smallest supertrees under minor containment. Int. Journal of Foundations of Computer Science, 11(3):445–465, 2000.CrossRefMathSciNetGoogle Scholar
  18. 18.
    S. W. Reyner. An analysis of a good algorithm for the subtree problem. SIAM Journal on Computing, 6(4):730–732, 1977.zbMATHCrossRefMathSciNetGoogle Scholar
  19. 19.
    T. Richter. A new algorithm for the ordered tree inclusion problem. In Proc. 8th Annual Symp. Combinatorial Pattern Matching, volume 1264 of Lecture Notes in Computer Science, pages 150–166. Springer-Verlag, 1997.Google Scholar
  20. 20.
    T. Schlieder and H. Meuss. Querying and ranking XML documents. Journal of the American Society for Information Science and Technology, 53(6):489–503, 2002.CrossRefGoogle Scholar
  21. 21.
    R. Shamir and D. Tsur. Faster subtree isomorphism. Journal of Algorithms, 33(2):267–280, 1999.zbMATHCrossRefMathSciNetGoogle Scholar
  22. 22.
    G. Valiente. An efficient bottom-up distance between trees. In Proc. 8th Int. Symp. String Processing and Information Retrieval, pages 212–219, Piscataway NJ, 2001. IEEE Computer Science Press.Google Scholar
  23. 23.
    G. Valiente. Algorithms on Trees and Graphs. Springer-Verlag, Berlin, 2002.zbMATHGoogle Scholar
  24. 24.
    R. M. Verma. Strings, trees, and patterns. Information Processing Letters, 41(3):157–161, 1992.zbMATHCrossRefMathSciNetGoogle Scholar
  25. 25.
    R. M. Verma and S. W. Reyner. An analysis of a good algorithm for the subtree problem, corrected. SIAM Journal on Computing, 18(5):906–908, 1989.zbMATHCrossRefMathSciNetGoogle Scholar
  26. 26.
    M.-S. Yu, L. Y. Tseng, and S.-J. Chang. Sequential and parallel algorithms for the maximum-weight independent set problem on permutation graphs. Information Processing Letters, 46(1):7–11, 1993.zbMATHCrossRefMathSciNetGoogle Scholar
  27. 27.
    K. Zhang. Efficient parallel algorithms for tree editing problems. In Proc. 7th Annual Symp. Combinatorial Pattern Matching, volume 1075 of Lecture Notes in Computer Science, pages 361–372, Berlin Heidelberg, 1996. Springer-Verlag.Google Scholar
  28. 28.
    K. Zhang, J. T.-L. Wang, and D. Shasha. On the editing distance between undirected acyclic graphs. International Journal of Foundations of Computer Science, 7(1):43–57, 1996.zbMATHCrossRefGoogle Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2003

Authors and Affiliations

  • Gabriel Valiente
    • 1
  1. 1.Department of SoftwareTechnical University of CataloniaBarcelonaSpain

Personalised recommendations