Dynamic Dyck and Tree Edit Distance: Decompositions and Reductions to String Edit Distance

Abstract

We present the first dynamic algorithms for Dyck and tree edit distances with subpolynomial update times. Dyck edit distance measures how far a parenthesis string is from a well-parenthesized expression, while tree edit distance quantifies the minimum number of node insertions, deletions, and substitutions required to transform one rooted, ordered, labeled tree into another. Despite extensive study, no prior work has addressed efficient dynamic algorithms for these problems, which naturally arise in evolving structured data such as LaTeX documents, JSON or XML files, and RNA secondary structures. Our main contribution is a set of reductions and decompositions that transform Dyck and tree edit distance instances into efficiently maintainable string edit distance instances, which can be approximated within a no(1) factor in no(1) update time. For Dyck edit distance, our reduction incurs only polylogarithmic overheads in approximation and update time, yielding an no(1)-approximation with no(1) updates. For tree edit distance, we introduce a new static reduction that improves the best-known approximation ratio from n3/4 to O(n) and removes the restriction to constant-degree trees. Extending this reduction dynamically achieves n1/2+o(1) approximation with no(1) update time. A key component is a dynamic maintenance algorithm for history-independent heavy-light decompositions, of independent interest. We also provide a novel static and dynamic decomposition achieving an O(k n)-approximation when the tree edit distance is at most k. Combined with the trivial bound k n, this yields a dynamic deterministic O(n n)-approximation. In the static setting, our algorithm runs in near-linear time; dynamically, it requires only polylogarithmic updates, improving on prior linear-time static O(n)-approximation.

0

Turn this paper into a full lesson

ArcXiv compiles a staged curriculum from this paper: 8-12 lessons across beginner → advanced, synthesised section guides, visuals, flashcards, a quiz, exercises, and on-demand deep dives per section. Grounded in the abstract, never invented.

Discussion (0)

Sign in to join the discussion.

Loading comments…