[Paper Review] Approximate Circular Pattern Matching Under Edit Distance
This paper presents the first O(n + (n/m)·poly(k)) time algorithms for the k-Edit Circular Pattern Matching problem under edit distance, achieving O(n) time when m = Ω(k⁶). By exploiting structural properties of approximate circular matches—either forming O(k⁴) intervals or indicating almost periodic patterns—it uses locked fragment analysis to handle the complex case, significantly improving over prior O(nk²) and O(nk log³k) solutions for large m relative to k.
In the $k$-Edit Circular Pattern Matching ($k$-Edit CPM) problem, we are given a length-$n$ text $T$, a length-$m$ pattern $P$, and a positive integer threshold $k$, and we are to report all starting positions of the substrings of $T$ that are at edit distance at most $k$ from some cyclic rotation of $P$. In the decision version of the problem, we are to check if any such substring exists. Very recently, Charalampopoulos et al. [ESA 2022] presented $O(nk^2)$-time and $O(nk \log^3 k)$-time solutions for the reporting and decision versions of $k$-Edit CPM, respectively. Here, we show that the reporting and decision versions of $k$-Edit CPM can be solved in $O(n+(n/m) k^6)$ time and $O(n+(n/m) k^5 \log^3 k)$ time, respectively, thus obtaining the first algorithms with a complexity of the type $O(n+(n/m) \mathrm{poly}(k))$ for this problem. Notably, our algorithms run in $O(n)$ time when $m=Ω(k^6)$ and are superior to the previous respective solutions when $m=ω(k^4)$. We provide a meta-algorithm that yields efficient algorithms in several other interesting settings, such as when the strings are given in a compressed form (as straight-line programs), when the strings are dynamic, or when we have a quantum computer. We obtain our solutions by exploiting the structure of approximate circular occurrences of $P$ in $T$, when $T$ is relatively short w.r.t. $P$. Roughly speaking, either the starting positions of approximate occurrences of rotations of $P$ form $O(k^4)$ intervals that can be computed efficiently, or some rotation of $P$ is almost periodic (is at a small edit distance from a string with small period). Dealing with the almost periodic case is the most technically demanding part of this work; we tackle it using properties of locked fragments (originating from [Cole and Hariharan, SICOMP 2002]).
Motivation & Objective
- To develop faster algorithms for approximate circular pattern matching under edit distance, especially when the pattern is long relative to the error threshold k.
- To overcome the limitations of prior O(nk²) and O(nk log³k) solutions by achieving a complexity dependent on (n/m)·poly(k), which is sublinear in n when m is large.
- To handle the challenging case where a rotation of the pattern is almost periodic (i.e., close to a string with small period) using advanced techniques from string combinatorics.
- To extend the framework to dynamic, compressed (SLP), and quantum computation settings, demonstrating broad applicability.
Proposed method
- The algorithm partitions the solution space into two cases: either approximate circular occurrences form O(k⁴) intervals that can be computed efficiently, or the pattern is almost periodic.
- For the almost periodic case, the method uses properties of locked fragments—originally introduced by Cole and Hariharan—to detect and handle strings with small edit distance to a periodic string.
- A meta-algorithm is designed to unify solutions across different computational models, including dynamic strings, compressed strings (SLPs), and quantum computation.
- In the dynamic setting, the approach maintains persistent strings with efficient concatenation, splitting, and string creation operations using a PILLAR-based data structure.
- For compressed strings (SLPs), the algorithm leverages SLP-specific operations to compute edit distance without decompressing the strings, achieving sublinear time in the uncompressed size.
- In the quantum model, the method exploits quantum speedups for LCP and pattern matching queries, reducing query time to Õ(√n) per operation.
Experimental results
Research questions
- RQ1Can we achieve an O(n + (n/m)·poly(k)) time algorithm for k-Edit Circular Pattern Matching, improving upon the previous O(nk²) and O(nk log³k) bounds?
- RQ2What structural properties of approximate circular matches allow us to decompose the problem into efficiently solvable subcases?
- RQ3How can we efficiently detect and handle the case where a rotation of the pattern is almost periodic (i.e., at small edit distance from a periodic string)?
- RQ4Can the algorithmic framework be extended to dynamic strings, compressed strings (SLPs), and quantum computation models with provable efficiency gains?
Key findings
- The reporting version of k-Edit CPM is solved in O(n + (n/m)·k⁶) time, which is optimal when m = Ω(k⁶), achieving O(n) time in that regime.
- The decision version runs in O(n + (n/m)·k⁵ log³k) time, improving over the previous O(nk log³k) solution when m = ω(k⁴).
- The almost periodic case is handled via locked fragment analysis, a technically intricate component that enables the overall efficiency gain.
- In the dynamic setting, the algorithm supports updates and queries in O(log N + |U|) and O(log N) time, respectively, with k-Edit CPM solved in O((|T|/|P|)·k⁶ log²N) time for reporting.
- For SLP-compressed strings, the algorithm runs in O(m log N + n k⁶ log²N log log N) time, avoiding full decompression.
- In the quantum model, the reporting and decision versions run in Õ((n/√m)·k⁶) and Õ((n/√m)·k⁵) time, respectively, leveraging quantum speedups for LCP and pattern matching.
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.