Order Preserving Pattern Matching on Trees and DAGs

The order preserving pattern matching (OPPM) problem is, given a pattern string p and a text string t, find all substrings of t which have the same relative orders as p. In this paper, we consider two variants of the OPPM problem where a set of text strings is given as a tree or a DAG. We show that the OPPM problem for a single pattern p of length m and a text tree T of size N can be solved in \(O(m+N)\) time with O(m) working space if the characters of p are drawn from an integer alphabet of polynomial size. The time complexity becomes \(O(m \log m + N)\) if the pattern p is over a general ordered alphabet. We then show that the OPPM problem for a single pattern and a text DAG is NP-complete.

[1]  Wojciech Rytter,et al.  A linear time algorithm for consecutive permutation pattern matching , 2013, Inf. Process. Lett..

[2]  Peter Weiner,et al.  Linear Pattern Matching Algorithms , 1973, SWAT.

[3]  Joong Chae Na,et al.  A fast algorithm for order-preserving pattern matching , 2015, Inf. Process. Lett..

[4]  Ricardo A. Baeza-Yates,et al.  Searching Subsequences , 1991, Theor. Comput. Sci..

[5]  Moshe Lewenstein,et al.  Pattern Matching in Hypertext , 1997, J. Algorithms.

[6]  Jorma Tarhio,et al.  A filtration method for order-preserving matching , 2016, Inf. Process. Lett..

[7]  Gonzalo Navarro,et al.  Parameterized matching on non-linear structures , 2009, Inf. Process. Lett..

[8]  Rudolf Fleischer,et al.  Order Preserving Matching , 2013, Theor. Comput. Sci..

[9]  Dong Kyue Kim,et al.  String Matching in Hypertext , 1995, CPM.

[10]  Moshe Lewenstein,et al.  Hypertext Searching - A Survey , 2014, Language, Culture, Computation.

[11]  Prosenjit Bose,et al.  Pattern Matching for Permutations , 1993, WADS.

[12]  Simone Faro,et al.  Efficient Algorithms for the Order Preserving Pattern Matching Problem , 2016, AAIM.

[13]  Zvi Galil,et al.  Faster tree pattern matching , 1990, Proceedings [1990] 31st Annual Symposium on Foundations of Computer Science.

[14]  Imre Simon String Matching Algorithms and Automata , 1994, Results and Trends in Theoretical Computer Science.