Pattern Matching with Independent Wildcard Gaps
Fan Min, Xindong Wu, Zhenyu Lu · 2009
Pattern matching is fundamental in applications such as biological sequence analysis and text indexing. A wildcard gap matches any subsequence with a length between two user specified integers, therefore introducing much adaptability to patterns. However, most existing works require that gaps in a pattern be the same. In this paper, we define a new pattern matching problem where gaps are independently specified. The objective is to compute the number of all matches. Since this number is exponential with respect to the maximal gap flexibility and the pattern length, counting matches one by one is computationally infeasible. We develop an efficient algorithm, named pattern matching with independent wildcard gaps (PAIG) for this problem, and propose two approaches to enhance its performance further. For the final version, the time complexity is O(Ll2W2), where L is the sequence length, l is the pattern length, and W is the maximal gap flexibility. The space complexity is O(lW), making PAIG easy to run in a Java Applet. Experimental results validate the efficiency of PAIG and confirm our analysis about its different versions.