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中现有的并行编辑距离实现。通过比较我们的算法,我们还对不同输入模式的算法选择提供了更深入的理解。我们相信,本文是首次对并行编辑距离理论与实践的体系化研究。