# Property Matching and Weighted Matching

## Abstract

Pattern Matching with Properties (Property Matching, for short), involves a string matching between the pattern and the text, and the requirement that the text part satisfies some property.

It is straightforward to do sequential matching in a text with properties. However, indexing in a text with properties becomes difficult if we desire the time to be output dependent. We present an algorithm for indexing a text with properties in *O*(*n*log|Σ|+*n* loglog*n*) time for preprocessing and *O*(|*P*|log|Σ|+*tocc* _{ π }) per query, where *n* is the length of the text, *P* is the sought pattern, Σ is the alphabet, and *tocc* _{ π } is the number of occurrences of the pattern that satisfy some property *π*.

As a practical use of Property Matching we show how to solve Weighted Matching problems using techniques from Property Matching. Weighted sequences have been introduced as a tool to handle a set of sequences that are not identical but have many local similarities. The weighted sequence is a “statistical image” of this set, where we are given the probability of every symbol’s occurrence at every text location. Weighted matching problems are pattern matching problems where the given text is weighted.

We present a reduction from Weighted Matching to Property Matching that allows off-the-shelf solutions to numerous weighted matching problems including indexing, swapped matching, parameterized matching, approximate matching, and many more. Assuming that one seeks the occurrence of pattern *P* with probability *ε* in weighted text *T* of length *n*, we reduce the problem to a property matching problem of pattern *P* in text *T*′ of length \(O(n(\frac{1}{\epsilon})^2 \log \frac{1}{\epsilon})\).

## Keywords

Pattern Match Match Problem Query Time Weighted Match Approximate Match## Preview

Unable to display preview. Download preview PDF.

## References

- 1.Amir, A., Keselman, D., Landau, G., Lewenstein, M., Lewenstein, N., Rodeh, M.: Indexing and dictionary matching with one error. Journal of Algorithms 37, 309–325 (2000); Preliminary version appeared in Dehne, F., Gupta, A., Sack, J.-R., Tamassia, R. (eds.) WADS 1999. LNCS, vol. 1663, pp. 181–192. Springer, Heidelberg (1999)CrossRefGoogle Scholar
- 2.Cormen, T.H., Leiserson, C.E., Rivest, R.L., Stein, C.: Introduction to Algorithms, 2nd edn. MIT Press and McGraw-Hill (2001)Google Scholar
- 3.Farach, M., Muthukrishnan, S.: Perfect hashing for strings: Formalization and algorithms. In: Proc. 7th Combinatorial Pattern Matching Conference (CPM), pp. 130–140 (1996)Google Scholar
- 4.Iliopoulos, C.S., Mouchard, L., Perdikuri, K., Tsakalidis, A.: Computing the repetitions in a weighted sequence. In: Proceeding of the Prague Stringology Conference, pp. 91–98 (2003)Google Scholar
- 5.Thompson, J.D., Higgins, D.G., Gibson, T.J.: Clustal w: Improving the sensitivity of progressive multiple sequence alignment through sequence weighting, position-specific gap penalties and weight matrix choice. Nucleic Acids Research 22, 4673–4680 (1994)CrossRefGoogle Scholar
- 6.Weiner, P.: Linear pattern matching algorithm. In: Proc. 14 IEEE Symposium on Switching and Automata Theory, pp. 1–11 (1973)Google Scholar