[Paper Review] Fast and Compact Regular Expression Matching
This paper presents improved algorithms for regular expression matching, approximate regular expression matching, string edit distance, and subsequence indexing by leveraging word-level parallelism and the Four Russian technique on a word RAM model. It achieves faster query times and reduced space usage—particularly eliminating alphabet-size dependencies—by combining dynamic programming with efficient data structures like van Emde Boas trees and optimized tabulation.
We study 4 problems in string matching, namely, regular expression matching, approximate regular expression matching, string edit distance, and subsequence indexing, on a standard word RAM model of computation that allows logarithmic-sized words to be manipulated in constant time. We show how to improve the space and/or remove a dependency on the alphabet size for each problem using either an improved tabulation technique of an existing algorithm or by combining known algorithms in a new way.
Motivation & Objective
- To improve the time and space efficiency of regular expression matching on a word RAM model with logarithmic word size.
- To remove the dependency on alphabet size in approximate regular expression matching and string edit distance algorithms.
- To optimize subsequence indexing by reducing preprocessing space or query time through hybrid data structures.
- To unify and enhance existing algorithms using the Four Russian technique and advanced data structures like van Emde Boas trees.
- To provide faster, more compact solutions for fundamental string matching problems without sacrificing correctness or generality.
Proposed method
- Uses the Four Russian technique to tabulate subproblems in dynamic programming, reducing time complexity by a factor related to word size.
- Applies word-level parallelism to process multiple characters simultaneously, improving constant-factor performance in regular expression matching.
- Combines a compressed automaton representation with van Emde Boas trees for successor queries to accelerate subsequence indexing.
- Introduces a hierarchical data structure that groups characters into blocks, using fast successor queries within blocks and long jumps between blocks.
- Employs a recent rank/select data structure for large alphabets to reduce space from O(n) words to O(n log σ) bits while maintaining fast query times.
- Optimizes string edit distance by applying tabulation to the standard dynamic programming table, reducing time complexity with a log²k factor and eliminating alphabet-size dependence.
Experimental results
Research questions
- RQ1Can regular expression matching be made faster and more space-efficient by exploiting word-level parallelism and tabulation?
- RQ2How can the alphabet-size dependency in approximate regular expression matching and string edit distance be removed without sacrificing performance?
- RQ3What is the optimal trade-off between preprocessing time, space, and query time in subsequence indexing for large alphabets?
- RQ4Can the Four Russian technique be effectively combined with modern data structures like van Emde Boas trees to improve string matching algorithms?
- RQ5Is it possible to achieve sublinear query time in subsequence indexing while using near-linear or sublinear preprocessing space?
Key findings
- Regular expression matching is solved in O(nm/k + n + m log m) time and O(2^k + m) space for any k ≤ w, matching Myers’ time complexity with significantly reduced space.
- Approximate regular expression matching is solved in O(mn log(d+2)/k + n + m log m) time and O(2^k + m) space, independent of alphabet size.
- String edit distance is computed in O(mn log²k / k² + m + n) time and O(2^k + min(m,n)) space for arbitrary alphabets, removing the constant-alphabet assumption.
- Subsequence indexing achieves O(m log log σ) query time with O(n) preprocessing space, or O(m) query time with O(nσ^ε) preprocessing space for any ε > 0.
- A hybrid data structure combining block-based automata and van Emde Boas trees enables O(m log log σ) query time with O(n) space, improving over prior O(nσ) space solutions.
- Using advanced rank/select structures, subsequence indexing can be implemented in O(n log σ + o(n log σ)) bits of space with O(m log log σ) query time, matching the fastest known query time with optimal space.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.