中文

An O(n^3)-Time Algorithm for Tree Edit Distance

数据结构与算法 2010-12-01 v3

摘要

The {\em edit distance} between two ordered trees with vertex labels 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. In this paper, we present a worst-case O(n3)O(n^3)-time algorithm for this problem, improving the previous best O(n3logn)O(n^3\log n)-time algorithm~\cite{Klein}. Our result requires a novel adaptive strategy for deciding how a dynamic program divides into subproblems (which is interesting in its own right), together with a deeper understanding of the previous algorithms for the problem. We also prove the optimality of our algorithm among the family of \emph{decomposition strategy} algorithms--which also includes the previous fastest algorithms--by tightening the known lower bound of Ω(n2log2n)\Omega(n^2\log^2 n)~\cite{Touzet} to Ω(n3)\Omega(n^3), matching our algorithm's running time. Furthermore, we obtain matching upper and lower bounds of Θ(nm2(1+lognm))\Theta(n m^2 (1 + \log \frac{n}{m})) when the two trees have different sizes mm and~nn, where m<nm < n.

关键词

引用

@article{arxiv.cs/0604037,
  title  = {An O(n^3)-Time Algorithm for Tree Edit Distance},
  author = {Erik D. Demaine and Shay Mozes and Benjamin Rossman and Oren Weimann},
  journal= {arXiv preprint arXiv:cs/0604037},
  year   = {2010}
}

备注

10 pages, 5 figures, 5 .tex files where TED.tex is the main one