Table of Contents
Fetching ...

Pattern Matching under Weighted Edit Distance

Panagiotis Charalampopoulos, Tomasz Kociumaka, Philip Wellnitz

TL;DR

This work addresses PMwED, a weighted edit-distance variant of pattern matching, by developing three regimes of near-optimal algorithms. The first achieves a conceptually simple $ ilde{O}(nk)$ time using a diagonal-band MSSP approach and Monge/SMAWK machinery; the second handles arbitrary and metric integer weights with a $ ilde{O}(n + k^{3.5} W^{4} n/m)$-time method leveraging locked fragments and fern matrices; and the third attains $ ilde{O}(n + k^{4} n/m)$ in the all-weights setting by exploiting almost periodic structure via dynamic puzzle matching. The results unify geometric and combinatorial tools (Monge matrices, SMAWK, MSSP, ferns, and the PILLAR model) to nearly match state-of-the-art PMED bounds across weight regimes, while also clarifying the landscape of lower bounds under APSP and related hypotheses. The paper’s meta-algorithmic framework in the PILLAR model facilitates adaptations to compressed, dynamic, and quantum settings. Overall, these advances significantly advance weighted approximate pattern matching, with implications for bioinformatics scoring schemes and other domains where edits carry nonuniform costs.

Abstract

In Pattern Matching with Weighted Edits (PMWED), we are given a pattern $P$ of length $m$, a text $T$ of length $n$, a positive threshold $k$, and oracle access to a weight function that specifies the costs of edits (depending on the involved characters, and normalized so that the cost of each edit is at least $1$). The goal is to compute the starting positions of all fragments of $T$ that can be obtained from $P$ with edits of total cost at most $k$. PMWED captures typical real-world applications more accurately than its unweighted variant (PMED), where all edits have unit costs. We obtain three main results: (a) a conceptually simple $\tilde{O}(nk)$-time algorithm for PMWED, very different from that of Landau and Vishkin for PMED; (b) a significantly more complicated $\tilde{O}(n+k^{3.5} \cdot W^4\cdot n/m)$-time algorithm for PMWED under the assumption that the weight function is a metric with integer values between $0$ and $W$; and (c) an $\tilde{O}(n+k^4 \cdot n/m)$-time algorithm for PMWED for the case of arbitrary weights. In the setting of metrics with small integer values, we nearly match the state of the art for PMED where $W=1$.

Pattern Matching under Weighted Edit Distance

TL;DR

This work addresses PMwED, a weighted edit-distance variant of pattern matching, by developing three regimes of near-optimal algorithms. The first achieves a conceptually simple time using a diagonal-band MSSP approach and Monge/SMAWK machinery; the second handles arbitrary and metric integer weights with a -time method leveraging locked fragments and fern matrices; and the third attains in the all-weights setting by exploiting almost periodic structure via dynamic puzzle matching. The results unify geometric and combinatorial tools (Monge matrices, SMAWK, MSSP, ferns, and the PILLAR model) to nearly match state-of-the-art PMED bounds across weight regimes, while also clarifying the landscape of lower bounds under APSP and related hypotheses. The paper’s meta-algorithmic framework in the PILLAR model facilitates adaptations to compressed, dynamic, and quantum settings. Overall, these advances significantly advance weighted approximate pattern matching, with implications for bioinformatics scoring schemes and other domains where edits carry nonuniform costs.

Abstract

In Pattern Matching with Weighted Edits (PMWED), we are given a pattern of length , a text of length , a positive threshold , and oracle access to a weight function that specifies the costs of edits (depending on the involved characters, and normalized so that the cost of each edit is at least ). The goal is to compute the starting positions of all fragments of that can be obtained from with edits of total cost at most . PMWED captures typical real-world applications more accurately than its unweighted variant (PMED), where all edits have unit costs. We obtain three main results: (a) a conceptually simple -time algorithm for PMWED, very different from that of Landau and Vishkin for PMED; (b) a significantly more complicated -time algorithm for PMWED under the assumption that the weight function is a metric with integer values between and ; and (c) an -time algorithm for PMWED for the case of arbitrary weights. In the setting of metrics with small integer values, we nearly match the state of the art for PMED where .
Paper Structure (35 sections, 59 theorems, 139 equations, 8 figures, 2 algorithms)

This paper contains 35 sections, 59 theorems, 139 equations, 8 figures, 2 algorithms.

Key Result

corollary 1

cor:lb_pmwed[thm:lb_wed](erbgbxwrvp not in $\min(k^{1.5-o(1)}\cdot n/m^{0.5}, k^{2.5-o(1)}\cdot n/m)$ time) For real parameters $\delta > 0$ and $0 < \kappa \le 1$, assuming the APSP Hypothesis, there is no algorithm that solves all instances of erbgbxwrvp satisfying $k \le m^{\kappa}$ in time $\mat

Figures (8)

  • Figure 1: The bounds on the running time $t(n, k)$ of algorithms for the \ref{['erbgbxwrvp']} problem as a function of $k$ for the important case when $m = \Theta(n)$. The scales are logarithmic and sub-polynomial factors are hidden. Doubled lines represent bounds for \ref{['bspmdzgntc']}, included only when they differ by a polynomial factor from their \ref{['erbgbxwrvp']} counterparts. The bounds for \ref{['bspmdzgntc']} remain valid for \ref{['erbgbxwrvp']} with integer edit weights between $0$ and $W=n^{o(1)}$.
  • Figure 2: The band $B$ of the alignment graph $\mathsf{AG}^w(P, S)$ for a pattern $P$ of length $20$, a threshold $k=3$, and a fragment $S = P\bm{[}\,0\,\bm{.\,.}\,8\,\bm{)}\texttt{a}P\bm{[}\,9\,\bm{.\,.}\,13\,\bm{)}\texttt{c}P\bm{[}\,14\,\bm{.\,.}\,19\,\bm{)}\texttt{c}$ of $T$. The source vertices $(0,0), (0,1), (0,2), (0,3)$ in the top left and the target vertices $(20,17), (20,18), (20,19), (20,20)$ in the bottom right are marked in light purple. The distinguished band $B$ is decomposed to seven parts. The left and right parts are colored gray; $B_i$ that also occur in $\mathsf{AG}^w(P,P)$ are merged into pure parts and are colored blue. We highlight the portal vertices on the boundaries of each part of $B$.
  • Figure 3: The alignment graph of two strings $P$ and $T$; as well as a detailed view of the edge costs. To obtain the corresponding augmented alignment graph, we add a back-edge of weight $W$ for every depicted edge.
  • Figure 4: The breakpoint representation of an alignment $\mathcal{A} : P T$ and the corresponding strings, as well as an example how $\mathcal{A}$ translates fragments (and partitions) of $P$. The (edit operations of the) alignment are depicted as colored boxes; breakpoints are depicted as vertical lines separating the boxes of the alignment. For edit operations, we depict the characters involved; otherwise we depict the fragments of $P$ and $T$ that are matched. Consult \ref{['sfqpycukkb']} for a visualization of the alignment graph of $P\bm{[}\,0\,\bm{.\,.}\,11\,\bm{)}$ and $T\bm{[}\,0\,\bm{.\,.}\,12\,\bm{)}$, as well as the corresponding part of $\mathcal{A}$.
  • Figure 5: The $d$-slices $P_{d,i}$ of $P$, the $d$-slices $G^{P,S,d}_{i,i}$ of $\overline{\mathsf{AG}}^w(P,S)$, and the graph $G^{P,S,d}$ with respect to alignment $\mathcal{A}: P S$ from \ref{['oiuoqannlf', 'byutjsdglx']}. In order to conserve space but still have a meaningful example, we depict slices for $d = 1$, even though alignment alignment $\mathcal{A}$ is of cost $6$. For the depicted example this does not cause any issues. In general, the alignment needs to be fully contained in the slices---which holds when the alignment is of cost at most $d$.
  • ...and 3 more figures

Theorems & Definitions (161)

  • corollary 1
  • definition 1: The alignment graph $\mathsf{AG}^w(P, T)$ of a weight function $w$ and strings $P$, $T$, ckw23
  • definition 2
  • remark 1
  • definition 3
  • remark 2: Bounded median edit distance implies small size and small pairwise edit distance
  • theorem 1: SMAWK
  • definition 4: The augmented alignment graph $\overline{\mathsf{AG}}^w(P, T)$ for a weight function $w$ and strings $P$ and $T$, gk24
  • remark 3
  • remark 4
  • ...and 151 more