English

Pattern Matching under Weighted Edit Distance

Data Structures and Algorithms 2025-10-21 v1

Abstract

In Pattern Matching with Weighted Edits (PMWED), we are given a pattern PP of length mm, a text TT of length nn, a positive threshold kk, 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 11). The goal is to compute the starting positions of all fragments of TT that can be obtained from PP with edits of total cost at most kk. 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 O~(nk)\tilde{O}(nk)-time algorithm for PMWED, very different from that of Landau and Vishkin for PMED; (b) a significantly more complicated O~(n+k3.5W4n/m)\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 00 and WW; and (c) an O~(n+k4n/m)\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=1W=1.

Keywords

Cite

@article{arxiv.2510.17752,
  title  = {Pattern Matching under Weighted Edit Distance},
  author = {Panagiotis Charalampopoulos and Tomasz Kociumaka and Philip Wellnitz},
  journal= {arXiv preprint arXiv:2510.17752},
  year   = {2025}
}

Comments

96 pages + bibliography + index of results, 8 figures. Sections 7 and 8 of this article generalize and heavily draw from our earlier works arXiv:2004.08350 and arXiv:2204.03087

R2 v1 2026-07-01T06:48:03.925Z