arXivDaily arXiv每日学术速递 周一至周五更新
感恩节,周五至周末无更新,大家顺遂。周一再来吧
arXiv 2402.07732cs.DS
收藏

带失配和通配符的模式匹配

Pattern Matching with Mismatches and Wildcards

Gabriel Bathie, Panagiotis Charalampopoulos, Tatiana Starikovskaya

AI总结:

该研究针对带通配符的近似模式匹配问题,提出了基于锚点思想的高效算法,在小参数场景下优于现有方法,还给出了k失配出现位置的结构刻画与下界构造。

摘要:

在这项工作中,我们研究带通配符的近似模式匹配问题。给定长度为$m$、包含$D$个通配符的模式$P$,长度为$n$的文本$T$,以及整数$k$,我们的目标是找出$T$中所有与$P$的汉明距离不超过$k$的片段。\n 我们的核心贡献是提出了一种运行时间为$O(n+(D+k)(G+k)\cdot n/m)$的算法来解决该问题。其中$G \le D$表示$P$中最大通配符片段的数量。我们通过对[Charalampopoulos等人,FOCS'20]提出的无通配符失配模式匹配思路进行非平凡的拓展,推导出了该算法。当$D$、$G$和$k$相对于$n$较小时,我们的算法优于现有最优方法。例如,当$m = n/2$、$k=G=n^{2/5}$且$D=n^{3/5}$时,我们的算法运行时间为$O(n)$,超过了此前所有已知算法所需的$Ω(n^{6/5})$时间复杂度。\n 在带通配符的精确模式匹配(即$k=0$)场景下,我们提出了一种更简洁的算法,运行时间为$O(n+DG\cdot n/m)$,该算法清晰体现了我们的主要技术创新:利用$P$中不属于任何通配符密度远大于$D/m$的$P$片段的位置,作为待查找(近似)出现位置的锚点。值得注意的是,当$DG = o(m\log m)$时,我们的算法性能优于[Cole和Hariharan,STOC'02]以及[Clifford和Clifford,IPL'04]提出的基于FFT的最优$O(n\log m)$时间算法。\n 我们还补充了关于$P$的$k$失配出现位置的结构刻画,完善了算法结果。我们证明,在长度为$O(m)$的文本中,这些出现位置可划分为$O((D+k)(G+k))$个等差数列。此外,我们利用关于无等差级数集合的组合结果[Elkin,SODA'10],构造了一类具有$Ω((D+k)k)$个出现位置等差数列的无限示例族。

英文摘要:

In this work, we address the problem of approximate pattern matching with wildcards. Given a pattern $P$ of length $m$ containing $D$ wildcards, a text $T$ of length $n$, and an integer $k$, our objective is to identify all fragments of $T$ within Hamming distance $k$ from $P$. Our primary contribution is an algorithm with runtime $O(n+(D+k)(G+k)\cdot n/m)$ for this problem. Here, $G \le D$ represents the number of maximal wildcard fragments in $P$. We derive this algorithm by elaborating in a non-trivial way on the ideas presented by [Charalampopoulos et al., FOCS'20] for pattern matching with mismatches (without wildcards). Our algorithm improves over the state of the art when $D$, $G$, and $k$ are small relative to $n$. For instance, if $m = n/2$, $k=G=n^{2/5}$, and $D=n^{3/5}$, our algorithm operates in $O(n)$ time, surpassing the $Ω(n^{6/5})$ time requirement of all previously known algorithms. In the case of exact pattern matching with wildcards ($k=0$), we present a much simpler algorithm with runtime $O(n+DG\cdot n/m)$ that clearly illustrates our main technical innovation: the utilisation of positions of $P$ that do not belong to any fragment of $P$ with a density of wildcards much larger than $D/m$ as anchors for the sought (approximate) occurrences. Notably, our algorithm outperforms the best-known $O(n\log m)$-time FFT-based algorithms of [Cole and Hariharan, STOC'02] and [Clifford and Clifford, IPL'04] if $DG = o(m\log m)$. We complement our algorithmic results with a structural characterization of the $k$-mismatch occurrences of $P$. We demonstrate that in a text of length $O(m)$, these occurrences can be partitioned into $O((D+k)(G+k))$ arithmetic progressions. Additionally, we construct an infinite family of examples with $Ω((D+k)k)$ arithmetic progressions of occurrences, leveraging a combinatorial result on progression-free sets [Elkin, SODA'10].

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

↑