arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2507.02548cs.DS
收藏

有界加权编辑距离:动态算法与匹配下界

Bounded Weighted Edit Distance: Dynamic Algorithms and Matching Lower Bounds

Itai Boneh, Egor Gorbachev, Tomasz Kociumaka

AI总结:

本文研究动态加权编辑距离问题,提出一种动态算法以 $\tilde{O}(k^{3-γ})$ 每次更新时间维护距离,并通过条件性下界证明其在 $γ\in [0.5,1)$ 范围内的细粒度最优性。

摘要:

两个字符串 $X,Y\in Σ^*$ 的编辑距离 $ed(X,Y)$ 是将 $X$ 转换为 $Y$ 所需的最少字符编辑(插入、删除和替换)次数。其加权对应物 $ed^w(X,Y)$ 最小化编辑的总代价,这些代价由函数 $w$ 指定,并经过归一化使得每次编辑的代价至少为 1。教科书中的动态规划过程,在给定字符串 $X,Y\in Σ^{\le n}$ 以及对 $w$ 的预言机访问的情况下,可以在 $O(n^2)$ 时间内计算 $ed^w(X,Y)$。然而,如果计算出的距离(记为 $k$)较小,则可以实现更好的运行时间:单位权重下为 $O(n+k^2)$ [Landau and Vishkin; JCSS'88],任意权重下为 $\tilde{O}(n+\sqrt{nk^3})$ [Cassis, Kociumaka, Wellnitz; FOCS'23]。本文研究加权编辑距离问题的动态版本,其目标是对于随时间变化的字符串 $X,Y\in Σ^{\le n}$ 维护 $ed^w(X,Y)$,每次更新指定为对 $X$ 或 $Y$ 的一次编辑。最近,Gorbachev 和 Kociumaka [STOC'25] 证明了在 $\tilde{O}(n+k^2)$ 时间的预处理之后,未加权距离 $ed(X,Y)$ 可以在每次更新 $\tilde{O}(k)$ 时间内维护;这里 $k$ 表示 $ed(X,Y)$ 的当前值。他们的算法可以推广到小的整数权重,但其底层方法不适用于大的权重。我们的主要结果是一个动态算法,在 $\tilde{O}(nk^γ)$ 时间的预处理之后,可以在每次更新 $\tilde{O}(k^{3-γ})$ 时间内维护 $ed^w(X,Y)$。这里 $γ\in [0,1]$ 是一个实数权衡参数,$k\ge 1$ 是在预处理时固定的整数阈值,当 $ed^w(X,Y)>k$ 时返回 $\infty$。我们通过条件性下界来补充我们的算法,证明了对于 $γ\in [0.5,1)$ 我们的权衡具有细粒度最优性,并证明了我们固定 $k$ 的选择是合理的。

英文摘要:

The edit distance $ed(X,Y)$ of two strings $X,Y\in Σ^*$ is the minimum number of character edits (insertions, deletions, and substitutions) needed to transform $X$ into $Y$. Its weighted counterpart $ed^w(X,Y)$ minimizes the total cost of edits, which are specified using a function $w$, normalized so that each edit costs at least one. The textbook dynamic-programming procedure, given strings $X,Y\in Σ^{\le n}$ and oracle access to $w$, computes $ed^w(X,Y)$ in $O(n^2)$ time. Nevertheless, one can achieve better running times if the computed distance, denoted $k$, is small: $O(n+k^2)$ for unit weights [Landau and Vishkin; JCSS'88] and $\tilde{O}(n+\sqrt{nk^3})$ for arbitrary weights [Cassis, Kociumaka, Wellnitz; FOCS'23]. In this paper, we study the dynamic version of the weighted edit distance problem, where the goal is to maintain $ed^w(X,Y)$ for strings $X,Y\in Σ^{\le n}$ that change over time, with each update specified as an edit in $X$ or $Y$. Very recently, Gorbachev and Kociumaka [STOC'25] showed that the unweighted distance $ed(X,Y)$ can be maintained in $\tilde{O}(k)$ time per update after $\tilde{O}(n+k^2)$-time preprocessing; here, $k$ denotes the current value of $ed(X,Y)$. Their algorithm generalizes to small integer weights, but the underlying approach is incompatible with large weights. Our main result is a dynamic algorithm that maintains $ed^w(X,Y)$ in $\tilde{O}(k^{3-γ})$ time per update after $\tilde{O}(nk^γ)$-time preprocessing. Here, $γ\in [0,1]$ is a real trade-off parameter and $k\ge 1$ is an integer threshold fixed at preprocessing time, with $\infty$ returned whenever $ed^w(X,Y)>k$. We complement our algorithm with conditional lower bounds showing fine-grained optimality of our trade-off for $γ\in [0.5,1)$ and justifying our choice to fix $k$.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑