We consider the approximate pattern matching problem under the edit distance. Given a text $T$ of length $n$, a pattern $P$ of length $m$, and a threshold $k$, the task is to find the starting positions of all substrings of $T$ that can be transformed to $P$ with at most $k$ edits. More than 20 years ago, Cole and Hariharan [SODA'98, J. Comput.'02] gave an $\mathcal{O}(n+k^4 \cdot n/ m)$-time algorithm for this classic problem, and this runtime has not been improved since.
Here, we present an algorithm that runs in time $\mathcal{O}(n+k^{3.5} \sqrt{\log m \log k} \cdot n/m)$, thus breaking through this long-standing barrier. In the case where $n^{1/4+\varepsilon} \leq k \leq n^{2/5-\varepsilon}$ for some arbitrarily small positive constant $\varepsilon$, our algorithm improves over the state-of-the-art by polynomial factors: it is polynomially faster than both the algorithm of Cole and Hariharan and the classic $\mathcal{O}(kn)$-time algorithm of Landau and Vishkin [STOC'86, J. Algorithms'89].
We observe that the bottleneck case of the alternative $\mathcal{O}(n+k^4 \cdot n/m)$-time algorithm of Charalampopoulos, Kociumaka, and Wellnitz [FOCS'20] is when the text and the pattern are (almost) periodic. Our new algorithm reduces this case to a new dynamic problem (Dynamic Puzzle Matching), which we solve by building on tools developed by Tiskin [SODA'10, Algorithmica'15] for the so-called seaweed monoid of permutation matrices. Our algorithm relies only on a small set of primitive operations on strings and thus also applies to the fully-compressed setting (where text and pattern are given as straight-line programs) and to the dynamic setting (where we maintain a collection of strings under creation, splitting, and concatenation), improving over the state of the art.
In the Bicluter Editing problem the input is a graph $G$ and an integer $k$, and the goal is to decide whether $G$ can be transformed into a bicluster graph by adding and removing at most $k$ edges. In this paper we give an algorithm for Bicluster Editing whose running time is $O^*(3.116^k)$.
Tree edit distance is a well-studied measure of dissimilarity between rooted trees with node labels. It can be computed in $O(n^3)$ time [Demaine, Mozes, Rossman, and Weimann, ICALP 2007], and fine-grained hardness results suggest that the weighted version of this problem cannot be solved in truly subcubic time unless the APSP conjecture is false [Bringmann, Gawrychowski, Mozes, and Weimann, SODA 2018]. We consider the unweighted version of tree edit distance, where every insertion, deletion, or relabeling operation has unit cost. Given a parameter $k$ as an upper bound on the distance, the pr…
In this work, we revisit the fundamental and well-studied problem of approximate pattern matching under edit distance. Given an integer $k$, a pattern $P$ of length $m$, and a text $T$ of length $n \ge m$, the task is to find substrings of $T$ that are within edit distance $k$ from $P$. Our main result is a streaming algorithm that solves the problem in $\tilde{O}(k^5)$ space and $\tilde{O}(k^8)$ amortised time per character of the text, providing answers correct with high probability. (Hereafter, $\tilde{O}(\cdot)$ hides a $\mathrm{poly}(\log n)$ factor.) This answers a decade-old question: s…
The approximate period recovery problem asks to compute all $\textit{approximate word-periods}$ of a given word $S$ of length $n$: all primitive words $P$ ($|P|=p$) which have a periodic extension at edit distance smaller than $τ_p$ from $S$, where $τ_p = \lfloor \frac{n}{(3.75+ε)\cdot p} \rfloor$ for some $ε>0$. Here, the set of periodic extensions of $P$ consists of all finite prefixes of $P^\infty$. We improve the time complexity of the fastest known algorithm for this problem of Amir et al. [Theor. Comput. Sci., 2018] from $O(n^{4/3})$ to $O(n \log n)$. Our tool is a fast algorithm for App…
A maximum priority matching is a matching in an undirected graph that maximizes a priority score defined with respect to given vertex priorities. An earlier paper showed how to find maximum priority matchings in unweighted graphs. This paper describes an algorithm for bipartite graphs that is faster when the number of distinct priority classes is limited. For graphs with $k$ distinct priority classes it runs in $O(kmn^{1/2})$ time, where $n$ is the number of vertices in the graph and $m$ is the number of edges.
Many modern sequence alignment tools implement fast string matching using the space efficient data structure called FM-index. The succinct nature of this data structure presents unique challenges for the algorithm designers. In this paper, we explore the opportunities for parallelization of the exact and inexact matches and present an efficient SIMD solution for the Occ portion of the algorithm. Our implementation computes all eight Occ values required for the inexact match algorithm step in a single pass. We showcase the algorithm performance in a multi-core genome aligner and discuss effects…
The Permutation Pattern Matching problem asks, given two permutations $σ$ on $n$ elements and $π$, whether $σ$ admits a subsequence with the same relative order as $π$ (or, in the counting version, how many such subsequences are there). This natural problem was shown by Bose, Buss and Lubiw [IPL 1998] to be NP-complete, and hence we should seek exact exponential time solutions. The asymptotically fastest such solution up to date, by Berendsohn, Kozma and Marx [IPEC 2019], works in $\mathcal{O}(1.6181^n)$ time. We design a simple and faster $\mathcal{O}(1.415^{n})$ time algorithm for both the d…
Approximate pattern matching is a natural and well-studied problem on strings: Given a text $T$, a pattern $P$, and a threshold $k$, find (the starting positions of) all substrings of $T$ that are at distance at most $k$ from $P$. We consider the two most fundamental string metrics: the Hamming distance and the edit distance. Under the Hamming distance, we search for substrings of $T$ that have at most $k$ mismatches with $P$, while under the edit distance, we search for substrings of $T$ that can be transformed to $P$ with at most $k$ edits. Exact occurrences of $P$ in $T$ have a very simple …
Quasi-threshold graphs are $\{C_4, P_4\}$-free graphs, i.e., they do not contain any cycle or path of four nodes as an induced subgraph. We study the $\{C_4, P_4\}$-free editing problem, which is the problem of finding a minimum number of edge insertions or deletions to transform an input graph into a quasi-threshold graph. This problem is NP-hard but fixed-parameter tractable (FPT) in the number of edits by using a branch-and-bound algorithm and admits a simple integer linear programming formulation (ILP). Both methods are also applicable to the general $F$-free editing problem for any finite…
Aligning a sequence to a walk in a labeled graph is a problem of fundamental importance to Computational Biology. For finding a walk in an arbitrary graph with $|E|$ edges that exactly matches a pattern of length $m$, a lower bound based on the Strong Exponential Time Hypothesis (SETH) implies an algorithm significantly faster than $O(|E|m)$ time is unlikely [Equi et al., ICALP 2019]. However, for many special graphs, such as de Bruijn graphs, the problem can be solved in linear time [Bowe et al., WABI 2012]. For approximate matching, the picture is more complex. When edits (substitutions, ins…
A pattern $α$ is a string of variables and terminal letters. We say that $α$ matches a word $w$, consisting only of terminal letters, if $w$ can be obtained by replacing the variables of $α$ by terminal words. The matching problem, i.e., deciding whether a given pattern matches a given word, was heavily investigated: it is NP-complete in general, but can be solved efficiently for classes of patterns with restricted structure. If we are interested in what is the minimum Hamming distance between $w$ and any word $u$ obtained by replacing the variables of $α$ by terminal words (so matching under …
We consider the approximate pattern matching problem under edit distance. In this problem we are given a pattern $P$ of length $w$ and a text $T$ of length $n$ over some alphabet $Σ$, and a positive integer $k$. The goal is to find all the positions $j$ in $T$ such that there is a substring of $T$ ending at $j$ which has edit distance at most $k$ from the pattern $P$. Recall, the edit distance between two strings is the minimum number of character insertions, deletions, and substitutions required to transform one string into the other. For a position $t$ in $\{1,...,n\}$, let $k_t$ be the smal…
The problem of matching a query string to a directed graph, whose vertices are labeled by strings, has application in different fields, from data mining to computational biology. Several variants of the problem have been considered, depending on the fact that the match is exact or approximate and, in this latter case, which edit operations are considered and where are allowed. In this paper we present results on the complexity of the approximate matching problem, where edit operations are symbol substitutions and are allowed only on the graph labels or both on the graph labels and the query st…
In the Cograph Deletion (resp., Cograph Editing) problem the input is a graph $G$ and an integer $k$, and the goal is to decide whether there is a set of edges of size at most $k$ whose removal from $G$ (resp., removal and addition to $G$) results in a graph that does not contain an induced path with four vertices. In this paper we give algorithms for Cograph Deletion and Cograph Editing whose running times are $O^*(2.303^k)$ and $O^*(4.329^k)$, respectively.
Faster fully compressed pattern matching by recompression
本文研究了一个完全压缩的模式匹配问题。压缩由直线程序(SLP)表示,即一种上下文无关文法,只生成一个字符串;该术语完全意味着模式和文本都以压缩形式给出。使用最近开发的局部再压缩技术来处理这个问题:重构SLP,使得模式和文本的子串以相同的方式在两个SLP中编码。为此,SLP被本地解压缩,然后以统一的方式重新压缩。该技术产生用于压缩模式匹配的O((n+m)log M)算法,假设M适合O(1)机器字,其中n(m)是文本(模式)的压缩表示的大小,而M是解压缩模式的大小。如果只有m+n适合O(1)机器字,则运行时间增加到O((n+m)log M log(n+m))。算法复杂度为O(n^2m)。
The edit distance between two rooted ordered trees with $n$ nodes labeled from an alphabet~$Σ$ is the minimum cost of transforming one tree into the other by a sequence of elementary operations consisting of deleting and relabeling existing nodes, as well as inserting new nodes. Tree edit distance is a well known generalization of string edit distance. The fastest known algorithm for tree edit distance runs in cubic $O(n^3)$ time and is based on a similar dynamic programming solution as string edit distance. In this paper we show that a truly subcubic $O(n^{3-\varepsilon})$ time algorithm for …
We study the problem of approximating the edit distance of two strings in sublinear time, in a setting where one or both string(s) are preprocessed, as initiated by Goldenberg, Rubinstein, Saha (STOC '20). Specifically, in the $(k, K)$-gap edit distance problem, the goal is to distinguish whether the edit distance of two strings is at most $k$ or at least $K$. We obtain the following results: * After preprocessing one string in time $n^{1+o(1)}$, we can solve $(k, k \cdot n^{o(1)})$-gap edit distance in time $(n/k + k) \cdot n^{o(1)}$. * After preprocessing both strings separately in time $n^{…
Finding optimal matchings in dense graphs is of general interest and of particular importance in social, transportation and biological networks. While developing optimal solutions for various matching problems is important, the running times of the fastest available optimal matching algorithms are too costly. However, when the vertices of the graphs are point-sets in $R^d$ and edge weights correspond to the euclidean distances, the available optimal matching algorithms are substantially faster. In this paper, we propose a novel network embedding based heuristic algorithm to solve various match…
Cartesian tree matching is the problem of finding all substrings in a given text which have the same Cartesian trees as that of a given pattern. In this paper, we deal with Cartesian tree matching for the case of multiple patterns. We present two fingerprinting methods, i.e., the parent-distance encoding and the binary encoding. By combining an efficient fingerprinting method and a conventional multiple string matching algorithm, we can efficiently solve multiple pattern Cartesian tree matching. We propose three practical algorithms for multiple pattern Cartesian tree matching based on the Wu-…
在许多应用中,需要确定字符串的相似性。编辑距离[WF 74]方法是确定字段相似性的经典方法。一个众所周知的动态规划算法[GUS 97]用于计算编辑距离,其时间复杂度为O(nm)。(for最坏的情况,平均情况,甚至最好的情况)而不是继续改进编辑距离方法,[LL+99]采用了一种全新的方法-基于令牌的方法。它的新概念token-base-retain原始语义信息,良好的时间复杂度O(nm)(最坏,平均和最好的情况下)和良好的实验性能,使它在这方面的一个里程碑式的文件。进一步的研究表明,其字段相似度算法仍有改进的空间。本文提出了一种基于子串的字段相似度判定算法。综合起来,新算法不仅获得了更高的精度,而且在最坏情况下的时间复杂度为O(knm)(k<0.75),平均情况下的时间复杂度为O(*n),其中<6,最好情况下的时间复杂度为O(1)。在整个文件中,我们使用的比较例子的方法,以显示更高的准确性,我们的算法相比,在[LL+99]中提出的。理论分析、具体实例和实验结果表明,该算法能显著提高场相似度计算的准确性和时间复杂度。[US97] D.古塞尔德计算机科学和计算生物学中字符串、树和序列的算法。[LL Mong Li Lee,Cleansing data for mining and warehousing,第10届数据库和专家系统应用国际会议论文集(DEXA 99),第751-760页,1…
A temporal graph is a sequence of graphs (called layers) over the same vertex set -- describing a graph topology which is subject to discrete changes over time. A $Δ$-temporal matching $M$ is a set of time edges $(e,t)$ (an edge $e$ paired up with a point in time $t$) such that for all distinct time edges $(e,t),(e',t') \in M$ we have that $e$ and $e'$ do not share an endpoint, or the time-labels $t$ and $t'$ are at least $Δ$ time units apart. Mertzios et al. [STACS '20] provided a $2^{O(Δν)}\cdot |{\mathcal G}|^{O(1)}$-time algorithm to compute the maximum size of a $Δ$-temporal matching in a…
Edit distance is a measurement of similarity between two sequences such as strings, point sequences, or polygonal curves. Many matching problems from a variety of areas, such as signal analysis, bioinformatics, etc., need to be solved in a geometric space. Therefore, the geometric edit distance (GED) has been studied. In this paper, we describe the first strictly sublinear approximate near-linear time algorithm for computing the GED of two point sequences in constant dimensional Euclidean space. Specifically, we present a randomized (O(n\log^2n)) time (O(\sqrt n))-approximation algorithm. Then…
We provide an algorithm requiring only $O(N^2)$ time to compute the maximum weight independent set of interval filament graphs. This also implies an $O(N^4)$ algorithm to compute the maximum weight induced matching of interval filament graphs. Both algorithms significantly improve upon the previous best complexities for these problems. Previously, the maximum weight independent set and maximum weight induced matching problems required $O(N^3)$ and $O(N^6)$ time respectively.
A recent line of research investigates how algorithms can be augmented with machine-learned predictions to overcome worst case lower bounds. This area has revealed interesting algorithmic insights into problems, with particular success in the design of competitive online algorithms. However, the question of improving algorithm running times with predictions has largely been unexplored. We take a first step in this direction by combining the idea of machine-learned predictions with the idea of "warm-starting" primal-dual algorithms. We consider one of the most important primitives in combinator…
The edit distance between two strings is defined as the smallest number of insertions, deletions, and substitutions that need to be made to transform one of the strings to another one. Approximating edit distance in subquadratic time is "one of the biggest unsolved problems in the field of combinatorial pattern matching". Our main result is a quantum constant approximation algorithm for computing the edit distance in truly subquadratic time. More precisely, we give an $O(n^{1.858})$ quantum algorithm that approximates the edit distance within a factor of $7$. We further extend this result to a…
We introduce fast-decodable indexing schemes for edit distance which can be used to speed up edit distance computations to near-linear time if one of the strings is indexed by an indexing string $I$. In particular, for every length $n$ and every $\varepsilon >0$, one can in near linear time construct a string $I \in Σ'^n$ with $|Σ'| = O_{\varepsilon}(1)$, such that, indexing any string $S \in Σ^n$, symbol-by-symbol, with $I$ results in a string $S' \in Σ''^n$ where $Σ'' = Σ\times Σ'$ for which edit distance computations are easy, i.e., one can compute a $(1+\varepsilon)$-approximation of the e…