Skip to main content
QUICK REVIEW

[Paper Review] Exact Analysis of Pattern Matching Algorithms with Probabilistic Arithmetic Automata

Tobias Marschall, Sven Rahmann|arXiv (Cornell University)|Sep 30, 2010
Algorithms and Data CompressionComputer Science18 references3 citations
TL;DR

This paper presents a general framework using probabilistic arithmetic automata (PAAs) to compute the exact distribution of character accesses for window-based pattern matching algorithms—such as Horspool, BDM, and BOM—under arbitrary random text models, including i.i.d., Markov, and HMMs. The method enables precise, non-asymptotic performance analysis by constructing and minimizing deterministic arithmetic automata (DAAs), yielding exact cost distributions and comparative statistics for algorithmic behavior on specific patterns.

ABSTRACT

We propose a framework for the exact probabilistic analysis of window-based pattern matching algorithms, such as Boyer-Moore, Horspool, Backward DAWG Matching, Backward Oracle Matching, and more. In particular, we show how to efficiently obtain the distribution of such an algorithm's running time cost for any given pattern in a random text model, which can be quite general, from simple uniform models to higher-order Markov models or hidden Markov models (HMMs). Furthermore, we provide a technique to compute the exact distribution of \emph{differences} in running time cost of two algorithms. In contrast to previous work, our approach is neither limited to simple text models, nor to asymptotic statements, nor to moment computations such as expectation and variance. Methodically, we use extensions of finite automata which we call deterministic arithmetic automata (DAAs) and probabilistic arithmetic automata (PAAs) [13]. To our knowledge, this is the first time that substring- or suffix-based pattern matching algorithms are analyzed exactly. Experimentally, we compare Horspool's algorithm, Backward DAWG Matching, and Backward Oracle Matching on prototypical patterns of short length and provide statistics on the size of minimal DAAs for these computations.

Motivation & Objective

  • To provide an exact, non-asymptotic probabilistic analysis of window-based pattern matching algorithms, overcoming limitations of prior work focused on asymptotics or moments.
  • To enable analysis under general text models, including i.i.d., higher-order Markov, and hidden Markov models, rather than restricted to simple uniform models.
  • To develop a framework that computes the exact distribution of character access costs for any given pattern, not just expectations or variances.
  • To compare two algorithms directly by computing the exact distribution of their cost differences, enabling pattern-specific performance evaluation.

Proposed method

  • Construct deterministic arithmetic automata (DAAs) that model the cost (e.g., character accesses) of pattern matching algorithms for a given pattern and window state.
  • Minimize DAAs using adapted DFA minimization techniques to reduce state space and improve computational efficiency.
  • Extend DAAs to probabilistic arithmetic automata (PAAs) by incorporating text model probabilities, enabling exact distribution computation over finite text lengths.
  • Use a product construction to build difference DAAs that model the cost difference between two algorithms, allowing direct comparison.
  • Apply the framework to Horspool, B(N)DM, and BOM algorithms on short patterns, using various text models.
  • Implement and evaluate the method on real patterns, with performance measured via DAA size and computation time.

Experimental results

Research questions

  • RQ1What is the exact distribution of character access costs for a given pattern-matching algorithm on a random text of finite length, under general text models?
  • RQ2How do the performance distributions of Horspool, B(N)DM, and BOM compare on specific patterns, and what factors influence their relative efficiency?
  • RQ3Can the exact distribution of cost differences between two algorithms be computed, and what insights does this yield about their relative behavior?
  • RQ4To what extent can DAA minimization reduce the state space and improve computational feasibility for longer patterns?
  • RQ5Does the minimal DAA size grow polynomially with pattern length, and how does it compare to prior constructions?

Key findings

  • The framework enables exact computation of the full distribution of character access costs for any window-based pattern matching algorithm, not just moments like expectation or variance.
  • For patterns of length 6 over {A,C,G,T}, minimal DAAs had an average of 42.8 states for B(N)DM, 41.8 for BOM, and 22 for Horspool, showing significant state space reduction via minimization.
  • Computing individual cost distributions took 0.3 to 0.6 seconds per pattern, while computing cost differences took 14 to 36 seconds, demonstrating practical feasibility.
  • BOM can outperform B(N)DM on some patterns (e.g., 48.2% probability on CAAAAA), despite always having shifts no better than B(N)DM, due to window content effects.
  • The minimal DAA size appears to grow polynomially with pattern length, suggesting potential scalability for practical pattern lengths.
  • The method outperforms prior conference versions in both DAA construction simplicity and minimization efficiency, enabling analysis of longer patterns.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.