Given two strings $A[1..n]$ and $B[1..m]$, and a set of operations allowed to edit the strings, the edit distance between $A$ and $B$ is the minimum number of operations required to transform $A$ into $B$. Sequentially, a standard Dynamic Programming (DP) algorithm solves edit distance with $\Theta(nm)$ cost. In many real-world applications, the strings to be compared are similar and have small edit distances. To achieve highly practical implementations, we focus on output-sensitive parallel edit-distance algorithms, i.e., to achieve asymptotically better cost bounds than the standard $\Theta(nm)$ algorithm when the edit distance is small. We study four algorithms in the paper, including three algorithms based on Breadth-First Search (BFS) and one algorithm based on Divide-and-Conquer (DaC). Our BFS-based solution is based on the Landau-Vishkin algorithm. We implement three different data structures for the longest common prefix (LCP) queries needed in the algorithm: the classic solution using parallel suffix array, and two hash-based solutions proposed in this paper. Our DaC-based solution is inspired by the output-insensitive solution proposed by Apostolico et al., and we propose a non-trivial adaption to make it output-sensitive. All our algorithms have good theoretical guarantees, and they achieve different tradeoffs between work (total number of operations), span (longest dependence chain in the computation), and space. We test and compare our algorithms on both synthetic data and real-world data. Our BFS-based algorithms outperform the existing parallel edit-distance implementation in ParlayLib in all test cases. By comparing our algorithms, we also provide a better understanding of the choice of algorithms for different input patterns. We believe that our paper is the first systematic study in the theory and practice of parallel edit distance.
翻译:给定两个字符串$A[1..n]$和$B[1..m]$,以及一组允许对字符串进行编辑的操作集,$A$与$B$的编辑距离是将$A$转换为$B$所需的最少操作次数。在串行计算中,标准动态规划(DP)算法以$\Theta(nm)$代价求解编辑距离。在许多实际应用中,待比较字符串具有相似性且编辑距离较小。为实现高度实用的算法,我们聚焦于输出敏感的并行编辑距离算法,即当编辑距离较小时,获得渐进优于标准$\Theta(nm)$算法的代价界。本文研究四种算法,包括三种基于广度优先搜索(BFS)的算法和一种基于分治(DaC)的算法。我们的BFS方案基于Landau-Vishkin算法,针对算法所需的最长公共前缀(LCP)查询实现了三种不同数据结构:经典的并行后缀数组方案,以及本文提出的两种基于哈希的方案。基于DaC的解决方案受Apostolico等人提出的输出不敏感方案启发,我们提出了一种非平凡改进使其具备输出敏感性。所有算法均具有良好的理论保证,并在工作量(总操作数)、跨度(计算中最长依赖链)和空间之间实现不同权衡。我们在合成数据与真实数据上测试并比较了各算法。在所有测试案例中,基于BFS的算法均优于ParlayLib中现有的并行编辑距离实现。通过算法对比,我们亦为不同输入模式下的算法选择提供了更深入的理解。我们相信本文是首个针对并行编辑距离理论与实践的系统性研究。