English

Tree Edit Distance Cannot be Computed in Strongly Subcubic Time (unless APSP can)

Data Structures and Algorithms 2017-03-28 v1

Abstract

The edit distance between two rooted ordered trees with nn nodes labeled from an alphabet~Σ\Sigma 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(n3)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(n3ε)O(n^{3-\varepsilon}) time algorithm for tree edit distance is unlikely: For Σ=Ω(n)|\Sigma| = \Omega(n), a truly subcubic algorithm for tree edit distance implies a truly subcubic algorithm for the all pairs shortest paths problem. For Σ=O(1)|\Sigma| = O(1), a truly subcubic algorithm for tree edit distance implies an O(nkε)O(n^{k-\varepsilon}) algorithm for finding a maximum weight kk-clique. Thus, while in terms of upper bounds string edit distance and tree edit distance are highly related, in terms of lower bounds string edit distance exhibits the hardness of the strong exponential time hypothesis [Backurs, Indyk STOC'15] whereas tree edit distance exhibits the hardness of all pairs shortest paths. Our result provides a matching conditional lower bound for one of the last remaining classic dynamic programming problems.

Keywords

Cite

@article{arxiv.1703.08940,
  title  = {Tree Edit Distance Cannot be Computed in Strongly Subcubic Time (unless APSP can)},
  author = {Karl Bringmann and Paweł Gawrychowski and Shay Mozes and Oren Weimann},
  journal= {arXiv preprint arXiv:1703.08940},
  year   = {2017}
}
R2 v1 2026-06-22T18:57:29.325Z