Pattern Matching with Variables: Efficient Algorithms and Complexity Results

被引:4
作者
Fernau, Henning [1 ,2 ]
Manea, Florin [3 ]
Mercas, Robert [4 ]
Schmid, Markus L. [1 ,5 ]
机构
[1] Univ Trier, Fachbereich 4, Abt Informat Wissensch, Trier, Germany
[2] Univ Trier, FB 4, Abt Informat, D-54286 Trier, Germany
[3] Gottingen Univ, Inst Comp Sci, Goldschmidtstr 7, D-37077 Gottingen, Germany
[4] Loughborough Univ, Dept Comp Sci, Haslegrave Bldg, Loughborough LE11 3TU, Leics, England
[5] Rudower Chaussee 25, D-12489 Berlin, Adlershof, Germany
关键词
Combinatorial pattern Matching; combinatorics on words; patterns with variables; NP-complete string problems; LANGUAGES; PARALLEL;
D O I
10.1145/3369935
中图分类号
TP301 [理论、方法];
学科分类号
081202 ;
摘要
A pattern alpha (i.e., a string of variables and terminals) matches a word w, if w can be obtained by uniformly replacing the variables of alpha 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.
引用
收藏
页数:37
相关论文
共 39 条
[1]   Generalized function matching [J].
Amir, Amihood ;
Nor, Igor .
JOURNAL OF DISCRETE ALGORITHMS, 2007, 5 (03) :514-523
[2]   FINDING PATTERNS COMMON TO A SET OF STRINGS [J].
ANGLUIN, D .
JOURNAL OF COMPUTER AND SYSTEM SCIENCES, 1980, 21 (01) :46-62
[3]   Parameterized pattern matching: Algorithms and applications [J].
Baker, BS .
JOURNAL OF COMPUTER AND SYSTEM SCIENCES, 1996, 52 (01) :28-42
[4]   Diverse Palindromic Factorization is NP-Complete [J].
Bannai, Hideo ;
Gagie, Travis ;
Inenaga, Shunsuke ;
Karkkainen, Juha ;
Kempa, Dominik ;
Piatkowski, Marcin ;
Sugimoto, Shiho .
INTERNATIONAL JOURNAL OF FOUNDATIONS OF COMPUTER SCIENCE, 2018, 29 (02) :143-163
[5]   Expressive Languages for Path Queries over Graph-Structured Data [J].
Barcelo, Pablo ;
Libkin, Leonid ;
Lin, Anthony W. ;
Wood, Peter T. .
ACM TRANSACTIONS ON DATABASE SYSTEMS, 2012, 37 (04)
[6]  
Campeanu C., 2003, International Journal of Foundations of Computer Science, V14, P1007, DOI 10.1142/S012905410300214X
[7]  
Clifford R, 2009, LECT NOTES COMPUT SC, V5721, P295, DOI 10.1007/978-3-642-03784-9_29
[8]  
Condon A, 2008, LECT NOTES COMPUT SC, V5092, P265
[9]   The complexity of string partitioning [J].
Condon, Anne ;
Manuch, Jan ;
Thachuk, Chris .
JOURNAL OF DISCRETE ALGORITHMS, 2015, 32 :24-43
[10]   SQUARES, CUBES, AND TIME-SPACE EFFICIENT STRING SEARCHING [J].
CROCHEMORE, M ;
RYTTER, W .
ALGORITHMICA, 1995, 13 (05) :405-425