A labelled tree P is an embedded subtree of a labelled tree T if P can be obtained by deleting some nodes from T: if a node v is deleted, all edges adjacent to v are also deleted and replaced by edges going from the parent of v (if it exists) to the children of v. Deciding whether P is an embedded subtree of T is known to be NP-complete. Given two trees (a target T and a pattern P) and a natural number w, we address two problems: 1) counting the number of windows of T having height exactly w and containing the pattern P as an embedded subtree, and 2) counting the number of slices of T having height exactly w and containing the pattern P as an embedded subtree. Our algorithms run in time O(|T|(w − h(P)+2)4|P|), where |T| (respectively, |P|) is the size of T (respectively, P), and h(P) is the height of P. Bibliography: 10 titles.
Similar content being viewed by others
References
P. Bille, “A survey on tree edit distance and related problems,” Theoret. Comput. Sci., 337, 217–239 (2005).
L. Boasson, P. Cegielski, I. Guessarian, and Yu. Matiyasevich, “Window accumulated subsequence matching is linear,” Ann. Pure Appl. Logic, 113, 59–80 (2001).
P. Cegielski, I. Guessarian, and Yu. Matiyasevich, “Tree inclusion problems,” RAIRO, 42, No. 1, 5–20 (2008).
P. Cegielski, I. Guessarian, Yu. Lifshits, and Yu. Matiyasevich, “Window subsequence problems for compressed texts,” CSR’06, Lect. Notes Comput. Sci., 3697, 127–136 (2006).
Y. Chi, R. Muntz, S. Nijssen, and J. Kok, “Frequent subtree mining — an overview,” Fund. Inform., 66, 161–198 (2005).
A. Durand and E. Grandjean, “First-order queries on structures of bounded degree are computable with constant delay,” ACM Trans. Comput. Log., 8, No. 4 (2007).
J. Flum and M. Grohe, Parameterized Complexity Theory, Springer-Verlag, Berlin (2006).
C. Hoffmann and M. O’Donnell, “Pattern matching in trees,” J. ACM, 28, No. 1, 68–95 (1982).
P. Kilpelainen, “Tree matching problems with applications to structured text databases,” PhD Thesis, Helsinki (1992), http://thesis.helsinki.fi/julkaisut/mat/tieto/vk/kilpelainen/ .
P. Kilpelainen and H. Mannila, “Ordered and unordered tree inclusion,” SIAM J. Comput., 24, No. 2 B, 340–356 (1995).
Author information
Authors and Affiliations
Corresponding author
Additional information
Dedicated to Yu. Matiyasevich on the occasion of his 60th birthday.
Published in Zapiski Nauchnykh Seminarov POMI, Vol. 358, 2008, pp. 3–53.
Rights and permissions
About this article
Cite this article
Guessarian, I., Cégielski, P. Tree inclusions in windows and slices. J Math Sci 158, 623–632 (2009). https://doi.org/10.1007/s10958-009-9401-7
Received:
Published:
Issue Date:
DOI: https://doi.org/10.1007/s10958-009-9401-7