Skip to main content

A linear time pattern matching algorithm between a string and a tree

  • Conference paper
  • First Online:

Part of the book series: Lecture Notes in Computer Science ((LNCS,volume 684))

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.

Unable to display preview. Download preview PDF.

References

  1. 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.

    Google Scholar 

  2. 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.

    Google Scholar 

  3. R. Boyer and S. Moore. “A fast string searching algorithm”. Communications of the ACM, Vol. 20, pp. 762–772, 1977.

    Google Scholar 

  4. M. J. Chung. “O(n 2.5) time algorithms for the subgraph homeomorphism on trees”. Journal of Algorithms, Vol. 8, pp. 106–112, 1987.

    Google Scholar 

  5. 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.

    Google Scholar 

  6. M. R. Garey and D. S. Johnson. “Computers and Intractability: A Guide to the Theory of NP-completeness”. Freeman, San Francisco, 1979.

    Google Scholar 

  7. D. E. Knuth, J. Morris, and V. Pratt. “Fast pattern matching in strings”. SIAM Journal on Computing, Vol. 6, pp. 323–350, 1977.

    Google Scholar 

  8. S. R. Kosaraju. “Efficient tree pattern matching”. In Proceedings of IEEE Symposium on Foundations of Computer Science, pp. 178–183, 1989.

    Google Scholar 

  9. G. M. Landau and U. Vishkin. “Fast parallel and serial approximate string matching”. Journal of Algorithms, Vol. 10, pp. 157–169, 1989.

    Google Scholar 

  10. 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.

    Google Scholar 

  11. E. M. McCreight. “A space-efficient suffix tree construction algorithm”. Journal of the ACM, Vol. 23, pp. 262–272, 1976.

    Google Scholar 

  12. S. W. Reyner. “An analysis of a good algorithm for the subtree problems”. SIAM Journal on Computing, Vol. 6, pp. 730–732, 1977.

    Google Scholar 

  13. R. E. Stobaugh. “Chemical substructure searching”. Journal of Chemical Information and Computer Sciences, Vol. 25, pp. 271–275, 1985.

    Google Scholar 

  14. E. H. Sussenguth. “A graph-theoretic algorithm for matching chemical structures”. Journal of Chemical Documentation, Vol. 5, pp. 36–43, 1965.

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Alberto Apostolico Maxime Crochemore Zvi Galil Udi Manber

Rights and permissions

Reprints 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

Publish with us

Policies and ethics