TY - GEN
T1 - Dynamic Dyck and Tree Edit Distance
T2 - 66th IEEE Annual Symposium on Foundations of Computer Science, FOCS 2025
AU - Das, Debarati
AU - Gilbert, Jacob
AU - Hajiaghayi, Mohammad Taghi
AU - Kociumaka, Tomasz
AU - Saha, Barna
N1 - Publisher Copyright:
© 2025 IEEE.
PY - 2025
Y1 - 2025
N2 - In this paper, we present the first dynamic algorithms for Dyck edit distance and tree edit distance that achieve subpolynomial update times. Dyck edit distance measures how far a parenthesis string is from a wellparenthesized expression (i.e., the Dyck language), while tree edit distance quantifies the minimum number of node insertions, deletions, and substitutions required to transform one rooted, ordered, and labeled tree into another. These problems have been studied extensively since the 1970s, with recent advances in both algorithmic efficiency and fine-grained complexity lower bounds. Despite this progress, no prior work has addressed efficient dynamic algorithms for these problems, even though many real-world applications involve evolving structured data such as LaTeX, JSON, XML, HTML, hierarchical datasets, and RNA secondary structures. We take the first step in this direction by designing new approximation algorithms for Dyck and tree edit distances in the dynamic setting. Our key technical contribution is a set of novel reduction and decomposition techniques that transform instances of Dyck and tree edit distance into efficiently maintainable instances of string edit distance. Leveraging existing dynamic algorithms for string edit distance, we obtain an nO(1) approximation for Dyck edit distance with nO(1) update time. This builds upon and significantly extends prior work on Dyck language decomposition ([Saha, FOCS'14] and [Koucký & Saks; SODA'23]). For tree edit distance, we introduce a new static reduction that improves the best-known approximation bound from O(n3/4) [Akutsu, Fukagawa, and Takasu; Algorithmica, 2010] to O(sqrt n). Moreover, while the previous result was restricted to constant-degree trees, ours holds for arbitrary trees. We then extend our reduction dynamically, yielding a dynamic tree edit distance algorithm with an approximation factor of n1/2+o(1) and update time nO(1). A core component of our approach is a new dynamic maintenance algorithm for heavy-light decomposition, a widely used technique in tree algorithms. Given its broad applicability, we believe this result is of independent interest. Finally, we introduce a novel static and dynamic decomposition method that achieves an O(k)-approximation for tree edit distance when the tree edit distance is at most k; combined with the trivial bound k ≤ n, this yields a deterministic O(sqrt n)-approximation. While similar decompositions exist for strings, no prior work has successfully extended them to trees. Our approach breaks this barrier, improving the best-known approximations for tree edit distance both in the static and dynamic setting. In the static setting, our algorithm runs in O(n) time; in the dynamic setting, it only requires a polylogarithmic worst-case update time. The state-of-the-art near-lineartime static algorithm for tree edit distance previously achieved an O(sqrt n)-approximation [Boroujeni, Ghodsi, Hajiaghayi, and Seddighin; STOC'19].
AB - In this paper, we present the first dynamic algorithms for Dyck edit distance and tree edit distance that achieve subpolynomial update times. Dyck edit distance measures how far a parenthesis string is from a wellparenthesized expression (i.e., the Dyck language), while tree edit distance quantifies the minimum number of node insertions, deletions, and substitutions required to transform one rooted, ordered, and labeled tree into another. These problems have been studied extensively since the 1970s, with recent advances in both algorithmic efficiency and fine-grained complexity lower bounds. Despite this progress, no prior work has addressed efficient dynamic algorithms for these problems, even though many real-world applications involve evolving structured data such as LaTeX, JSON, XML, HTML, hierarchical datasets, and RNA secondary structures. We take the first step in this direction by designing new approximation algorithms for Dyck and tree edit distances in the dynamic setting. Our key technical contribution is a set of novel reduction and decomposition techniques that transform instances of Dyck and tree edit distance into efficiently maintainable instances of string edit distance. Leveraging existing dynamic algorithms for string edit distance, we obtain an nO(1) approximation for Dyck edit distance with nO(1) update time. This builds upon and significantly extends prior work on Dyck language decomposition ([Saha, FOCS'14] and [Koucký & Saks; SODA'23]). For tree edit distance, we introduce a new static reduction that improves the best-known approximation bound from O(n3/4) [Akutsu, Fukagawa, and Takasu; Algorithmica, 2010] to O(sqrt n). Moreover, while the previous result was restricted to constant-degree trees, ours holds for arbitrary trees. We then extend our reduction dynamically, yielding a dynamic tree edit distance algorithm with an approximation factor of n1/2+o(1) and update time nO(1). A core component of our approach is a new dynamic maintenance algorithm for heavy-light decomposition, a widely used technique in tree algorithms. Given its broad applicability, we believe this result is of independent interest. Finally, we introduce a novel static and dynamic decomposition method that achieves an O(k)-approximation for tree edit distance when the tree edit distance is at most k; combined with the trivial bound k ≤ n, this yields a deterministic O(sqrt n)-approximation. While similar decompositions exist for strings, no prior work has successfully extended them to trees. Our approach breaks this barrier, improving the best-known approximations for tree edit distance both in the static and dynamic setting. In the static setting, our algorithm runs in O(n) time; in the dynamic setting, it only requires a polylogarithmic worst-case update time. The state-of-the-art near-lineartime static algorithm for tree edit distance previously achieved an O(sqrt n)-approximation [Boroujeni, Ghodsi, Hajiaghayi, and Seddighin; STOC'19].
UR - https://www.scopus.com/pages/publications/105034368879
UR - https://www.scopus.com/pages/publications/105034368879#tab=citedBy
U2 - 10.1109/FOCS63196.2025.00041
DO - 10.1109/FOCS63196.2025.00041
M3 - Conference contribution
AN - SCOPUS:105034368879
T3 - Proceedings - Annual IEEE Symposium on Foundations of Computer Science, FOCS
SP - 767
EP - 786
BT - Proceedings - 2025 IEEE 66th Annual Symposium on Foundations of Computer Science, FOCS 2025
PB - IEEE Computer Society
Y2 - 14 December 2025 through 17 December 2025
ER -