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

线性时间内文法压缩串的模式匹配

Pattern Matching on Grammar-Compressed Strings in Linear Time

Moses Ganardi, Paweł Gawrychowski

摘要:

文本处理算法中考虑的最基本问题是模式匹配:给定长度为$m$的模式$p$和长度为$n$的文本$t$,$p$是否出现在$t$中?这个基本问题的多个版本已经被考虑过了,现在我们知道在实践和理论上都很快的算法。然而,生成和存储的数据量的快速增长带来了设计直接对数据的压缩表示进行操作的算法的需求。在压缩模式匹配问题中,我们给出文本的压缩表示,其中$n$是压缩表示的长度,$N$是文本的长度,以及长度为$m$的未压缩模式。最具挑战性的(但在处理高度重复的数据时也是相关的,比如生物信息)场景是当所选择的压缩方法能够描述指数长度的字符串时(在其表示的大小上)。这种压缩方法的一种优雅的形式是直线程序,它只是描述一个字符串的上下文无关文法。虽然已经知道对于这种压缩方法,压缩的模式匹配问题可以在$O(m+n\log N)$时间内解决,但是设计线性时间算法仍然是开放的。我们解决这个悬而未决的问题,提出了一个$O(n+m)$时间算法,给定一个上下文无关文法大小$n$,产生一个单一的字符串$t$和模式$p$的长度$m$,决定是否$p$出现在$t$作为一个子串。为此,我们设计改进的解决方案的加权祖先问题和子串连接问题。

英文摘要:

The most fundamental problem considered in algorithms for text processing is pattern matching: given a pattern $p$ of length $m$ and a text $t$ of length $n$, does $p$ occur in $t$? Multiple versions of this basic question have been considered, and by now we know algorithms that are fast both in practice and in theory. However, the rapid increase in the amount of generated and stored data brings the need of designing algorithms that operate directly on compressed representations of data. In the compressed pattern matching problem we are given a compressed representation of the text, with $n$ being the length of the compressed representation and $N$ being the length of the text, and an uncompressed pattern of length $m$. The most challenging (and yet relevant when working with highly repetitive data, say biological information) scenario is when the chosen compression method is capable of describing a string of exponential length (in the size of its representation). An elegant formalism for such a compression method is that of straight-line programs, which are simply context-free grammars describing exactly one string. While it has been known that compressed pattern matching problem can be solved in $O(m+n\log N)$ time for this compression method, designing a linear-time algorithm remained open. We resolve this open question by presenting an $O(n+m)$ time algorithm that, given a context-free grammar of size $n$ that produces a single string $t$ and a pattern $p$ of length $m$, decides whether $p$ occurs in $t$ as a substring. To this end, we devise improved solutions for the weighted ancestor problem and the substring concatenation problem.

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

↑