Computer Science · Artificial Intelligence
Fast Bit-Vector Algorithms for Approximate String Matching Under Indel Distance
See on the mapAbstract
Abstract. The approximate string matching problem is to find all lo-cations at which a query p of length m matches a substring of a text t of length n with at most k differences (insertions, deletions, substitutions). The fastest solutions in practice for this problem are the bit-parallel NFA simulation algorithms of Wu & Manber [4] and Baeza-Yates & Navarro [1], and the bit-parallel dynamic programming algorithm of Myers [3]. In this paper we present modified versions of these algorithms to deal with the restricted case where only insertions and deletions (called indel for short) are permitted. We also show test results with the algorithms. 1 IndelMYE Algorithm The bit-parallel approximate string matching algorithm of Myers [3], MYE, is based on the classical dynamic programming approach where a (m+1) × (n+1) matrix D is computed using the well-known recurrence Di,j = min {Di−1,j−1 + δ(pi, tj), Di−1,j, Di,j−1}, subject to the boundary condition D0,j = 0 and Di,0 = i, where δ(pi, tj) = 0 iff pi = tj, and 1 otherwise. The solution to the approximate string matching problem is all the locations j where Dm,j ≤ k. MYE is based on the observation that the vertical and horizontal differences between adjacent cells in D (i.e. Di,j − Di−1,j and Di,j − Di,j−1) have the value-1, 0, or 1, and the diagonal differences (i.e. Di,j −Di−1,j−1) have the value 0 or 1. This enables the algorithm, as presented in [2], to use the following length-m bit-vectors to represent the vertical, horizontal and diagonal differences: