Abstract
In this paper, we describe a linear time algorithm for testing whether or not there is a path of a tree T (¦V(T)¦= n) that coincides with a string s (¦s¦ = m). In the algorithm, O(n/m) vertices are selected from V(T) such that any path of length more than m −2 must contain at least one of the selected vertices. A search is performed using the selected vertices as ‘bases’. A suffix tree is used effectively in the algorithm. Although the size of the alphabet is assumed to be bounded by a constant in this paper, the algorithm can be applied to the case of unbounded alphabets by increasing the time complexity to O(n log n).
The author thanks to Prof. Tomio Hirata in Nagoya University for helpful comments. This research was partially supported by the Grand-in-Aid for Scientific Research on Priority Areas, ”Genome Informatics”, of the Ministry of Education, Science and Culture of Japan.
This is a preview of subscription content, log in via an institution.
Preview
Unable to display preview. Download preview PDF.
References
A. Amir, G. Benson, and M. Farach. “Alphabet independent two dimensional pattern matching”. In Proceedings of ACM Symposium on Theory of Computing, pp. 59–68, 1992.
A. Apostolico, C. Iliopoulos, G. M. Landau, B. Schieber, and U. Vishkin. “Parallel construction of a suffix tree with applications”. Algorithmica, Vol. 3, pp. 347–365, 1988.
R. Boyer and S. Moore. “A fast string searching algorithm”. Communications of the ACM, Vol. 20, pp. 762–772, 1977.
M. J. Chung. “O(n 2.5) time algorithms for the subgraph homeomorphism on trees”. Journal of Algorithms, Vol. 8, pp. 106–112, 1987.
M. Dubiner, Z. Galil, and E Magen. “Faster tree pattern matching”. In Proceedings of IEEE Symposium on Foundations of Computer Science, pp. 145–150, 1990.
M. R. Garey and D. S. Johnson. “Computers and Intractability: A Guide to the Theory of NP-completeness”. Freeman, San Francisco, 1979.
D. E. Knuth, J. Morris, and V. Pratt. “Fast pattern matching in strings”. SIAM Journal on Computing, Vol. 6, pp. 323–350, 1977.
S. R. Kosaraju. “Efficient tree pattern matching”. In Proceedings of IEEE Symposium on Foundations of Computer Science, pp. 178–183, 1989.
G. M. Landau and U. Vishkin. “Fast parallel and serial approximate string matching”. Journal of Algorithms, Vol. 10, pp. 157–169, 1989.
A. Lingas. “Subgraph isomorphism for connected graphs of bounded valence and bounded separator is in NC”. In Proceedings of the 1988 International Conference on Parallel Processing, pp. 304–307, 1988.
E. M. McCreight. “A space-efficient suffix tree construction algorithm”. Journal of the ACM, Vol. 23, pp. 262–272, 1976.
S. W. Reyner. “An analysis of a good algorithm for the subtree problems”. SIAM Journal on Computing, Vol. 6, pp. 730–732, 1977.
R. E. Stobaugh. “Chemical substructure searching”. Journal of Chemical Information and Computer Sciences, Vol. 25, pp. 271–275, 1985.
E. H. Sussenguth. “A graph-theoretic algorithm for matching chemical structures”. Journal of Chemical Documentation, Vol. 5, pp. 36–43, 1965.
Author information
Authors and Affiliations
Editor information
Rights and permissions
Copyright information
© 1993 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Akutsu, T. (1993). A linear time pattern matching algorithm between a string and a tree. In: Apostolico, A., Crochemore, M., Galil, Z., Manber, U. (eds) Combinatorial Pattern Matching. CPM 1993. Lecture Notes in Computer Science, vol 684. Springer, Berlin, Heidelberg. https://doi.org/10.1007/BFb0029792
Download citation
DOI: https://doi.org/10.1007/BFb0029792
Published:
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-540-56764-6
Online ISBN: 978-3-540-47732-7
eBook Packages: Springer Book Archive