Abstract
A pattern ɑ (i.e., a string of variables and terminals) matches a word w, if w can be obtained by uniformly replacing the variables of ɑ by terminal words. The respective matching problem, i.e., deciding whether or not a given pattern matches a given word, is generally NP-complete, but can be solved in polynomial-time for restricted classes of patterns. We present efficient algorithms for the matching problem with respect to patterns with a bounded number of repeated variables and patterns with a structural restriction on the order of variables. Furthermore, we show that it is NP-complete to decide, for a given number k and a word w, whether w can be factorised into k distinct factors. As an immediate consequence of this hardness result, the injective version (i.e., different variables are replaced by different words) of the matching problem is NP-complete even for very restricted classes of patterns.
- Amihood Amir and Igor Nor. 2007. Generalized function matching. J. Discrete Algor. 5, 3 (2007), 514--523.Google Scholar
Digital Library
- Dana Angluin. 1980. Finding patterns common to a set of strings. J. Comput. System Sci. 21 (1980), 46--62.Google Scholar
Cross Ref
- Brenda S. Baker. 1996. Parameterized pattern matching: Algorithms and applications. J. Comput. System Sci. 52 (1996), 28--42.Google Scholar
Digital Library
- Hideo Bannai, Travis Gagie, Shunsuke Inenaga, Juha Kärkkäinen, Dominik Kempa, Marcin Piatkowski, and Shiho Sugimoto. 2018. Diverse palindromic factorization is NP-complete. Int. J. Found. Comput. Sci. 29, 2 (2018), 143--164.Google Scholar
Cross Ref
- Pablo Barceló, Leonid Libkin, Anthony W. Lin, and Peter T. Wood. 2012. Expressive languages for path queries over graph-structured data. ACM Trans. Database Syst. 37 (2012).Google Scholar
- Cezar Câmpeanu, Kai Salomaa, and Sheng Yu. 2003. A formal study of practical regular expressions. Int. J. Found. Comput. Sci. 14 (2003), 1007--1018.Google Scholar
Cross Ref
- Raphaël Clifford, Aram Wettroth Harrow, Alexandru Popa, and Benjamin Sach. 2009. Generalised matching. In Proceedings of the 16th International Symposium on String Processing and Information Retrieval (SPIRE’09). 295--301.Google Scholar
Digital Library
- Anne Condon, Ján Manuch, and Chris Thachuk. 2008. Complexity of a collision-aware string partition problem and its relation to oligo design for gene synthesis. In Proceedings of the 14th Annual International Conference on Computing and Combinatorics (COCOON’08). 265--275.Google Scholar
Digital Library
- Anne Condon, Ján Manuch, and Chris Thachuk. 2015. The complexity of string partitioning. J. Discrete Algor. 32 (2015), 24--43.Google Scholar
Digital Library
- Maxime Crochemore. 1981. An optimal algorithm for computing the repetitions in a word. Inform. Process. Lett. 12, 5 (1981), 244--250.Google Scholar
Cross Ref
- Maxime Crochemore and Wojciech Rytter. 1991. Usefulness of the Karp-Miller-Rosenberg algorithm in parallel computations on strings and arrays. Theoret. Comput. Sci. 88, 1 (1991), 59--82.Google Scholar
Digital Library
- Maxime Crochemore and Wojciech Rytter. 1995. Squares, cubes, and time-space efficient string searching. Algorithmica 13, 5 (1995), 405--425.Google Scholar
Cross Ref
- Thomas Erlebach, Peter Rossmanith, Hans Stadtherr, Angelika Steger, and Thomas Zeugmann. 2001. Learning one-variable pattern languages very efficiently on average, in parallel, and by asking queries. Theoret. Comput. Sci. 261 (2001), 119--156.Google Scholar
Digital Library
- Henning Fernau, Florin Manea, Robert Mercas, and Markus L. Schmid. 2015. Pattern matching with variables: Fast algorithms and new hardness results. In Proceedings of the 32nd International Symposium on Theoretical Aspects of Computer Science (STACS’15). 302--315.Google Scholar
- Henning Fernau, Florin Manea, Robert Mercas, and Markus L. Schmid. 2018. Revisiting Shinohara’s algorithm for computing descriptive patterns. Theoret. Comput. Sci. 733 (2018), 44--54.Google Scholar
Cross Ref
- Henning Fernau and Markus L. Schmid. 2015. Pattern matching with variables: A multivariate complexity analysis. Info. Comput. 242 (2015), 287--305.Google Scholar
Digital Library
- Henning Fernau, Markus L. Schmid, and Yngve Villanger. 2015. On the parameterised complexity of string morphism problems. Theory Comput. Syst. (2015).Google Scholar
- Dominik D. Freydenberger. 2013. Extended regular expressions: Succinctness and decidability. Theory Comput. Syst. 53 (2013), 159--193.Google Scholar
Cross Ref
- Jeffrey E. F. Friedl. 2006. Mastering Regular Expressions (3rd ed.). O’Reilly, Sebastopol, CA.Google Scholar
- Michael R. Garey and David S. Johnson. 1979. Computers and Intractability: A Guide to the Theory of NP-Completeness. W. H. Freeman 8 Co., New York, NY.Google Scholar
Digital Library
- Dan Gusfield. 1997. Algorithms on Strings, Trees, and Sequences: Computer Science and Computational Biology. Cambridge University Press, New York, NY.Google Scholar
Digital Library
- Oscar H. Ibarra, Ting-Chuen Pong, and Stephen M. Sohn. 1995. A note on parsing pattern languages. Pattern Recogn. Lett. 16 (1995), 179--182.Google Scholar
Digital Library
- Juhani Karhumäki, Wojciech Plandowski, and Filippo Mignosi. 2000. The expressibility of languages and relations by word equations. J. ACM 47 (2000), 483--505.Google Scholar
Digital Library
- Juha Kärkkäinen, Peter Sanders, and Stefan Burkhardt. 2006. Linear work suffix array construction. J. ACM 53, 6 (2006), 918--936.Google Scholar
Digital Library
- Michael J. Kearns and Leonard Pitt. 1989. A polynomial-time algorithm for learning k-variable pattern languages from examples. In Proceedings of the 2nd Annual Workshop on Computational Learning Theory (COLT’89). 57--71.Google Scholar
- Tomasz Kociumaka, Jakub Radoszewski, Wojciech Rytter, and Tomasz Walen. 2012. Efficient data structures for the factor periodicity problem. In Proceedings of the 19th International Symposium on String Processing and Information Retrieval (SPIRE’12). 284--294.Google Scholar
Digital Library
- Tomasz Kociumaka, Jakub Radoszewski, Wojciech Rytter, and Tomasz Walen. 2015. Internal pattern matching queries in a text and applications. In Proceedings of the 26th Annual ACM-SIAM Symposium on Discrete Algorithms (SODA’15). 532--551.Google Scholar
Cross Ref
- Dmitry Kosolobov, Florin Manea, and Dirk Nowotka. 2017. Detecting one-variable patterns. In Proceedings of the 24th International Symposium on String Processing and Information Retrieval (SPIRE’17). 254--270.Google Scholar
Cross Ref
- M. Lothaire. 1997. Combinatorics on Words. Cambridge University Press.Google Scholar
- M. Lothaire. 2002. Algebraic Combinatorics on Words. Cambridge University Press, Cambridge/New York.Google Scholar
- Alexandru Mateescu and Arto Salomaa. 1994. Finite degrees of ambiguity in pattern languages. RAIRO Informatique Théoretique et Applications 28 (1994), 233--253.Google Scholar
Cross Ref
- Yen K. Ng and Takeshi Shinohara. 2008. Developments from enquiries into the learnability of the pattern languages from positive data. Theoret. Comput. Sci. 397 (2008), 150--165.Google Scholar
Digital Library
- Sebastian Ordyniak and Alexandru Popa. 2016. A parameterized study of maximum generalized pattern matching problems. Algorithmica 75 (2016), 1--26.Google Scholar
Digital Library
- Daniel Reidenbach. 2008. Discontinuities in pattern inference. Theoret. Comput. Sci. 397 (2008), 166--193.Google Scholar
Digital Library
- Daniel Reidenbach and Markus L. Schmid. 2010. A polynomial time match test for large classes of extended regular expressions. In Proceedings of the 15th International Conference on Implementation and Application of Automata (CIAA’10). 241--250.Google Scholar
- Daniel Reidenbach and Markus L. Schmid. 2014. Patterns with bounded treewidth. Info. Comput. 239 (2014), 87--99.Google Scholar
Digital Library
- Markus L. Schmid. 2013. A note on the complexity of matching patterns with variables. Info. Process. Lett. 113, 19–21 (2013), 729--733.Google Scholar
Digital Library
- Markus L. Schmid. 2016. Computing equality-free and repetitive string factorisations. Theoret. Comput. Sci. 618 (2016), 42--51.Google Scholar
Digital Library
- Takeshi Shinohara. 1982. Polynomial time inference of pattern languages and its application. In Proceedings of the 7th IBM Symposium on Mathematical Foundations of Computer Science (MFCS’82). 191--209.Google Scholar
Index Terms
Pattern Matching with Variables: Efficient Algorithms and Complexity Results
Recommendations
Matching Patterns with Variables
Combinatorics on WordsAbstractA pattern (i. e., a string of variables and terminals) matches a word w, if w can be obtained by uniformly replacing the variables of by terminal words. The respective matching problem, i. e., deciding whether or not a given pattern matches a ...
Pattern matching with variables
A pattern α, i.e., a string that contains variables and terminals, matches a terminal word w if w can be obtained by uniformly substituting the variables of α by terminal words. Deciding whether a given terminal word matches a given pattern is NP-...
Parity Permutation Pattern Matching
WALCOM: Algorithms and ComputationAbstractGiven two permutations, a pattern and a text , Parity Permutation Pattern Matching asks whether there exists a parity and order preserving embedding of into . While it is known that Permutation Pattern Matching is in , we show that adding the ...






Comments