The Dynamic Time Warping (DTW) distance is a popular similarity measure for polygonal curves (i.e., sequences of points). It finds many theoretical and practical applications, especially for temporal data, and is known to be a robust, outlier-insensitive alternative to the Fr\'echet distance. For static curves of at most $n$ points, the DTW distance can be computed in $O(n^2)$ time in constant dimension. This tightly matches a SETH-based lower bound, even for curves in $\mathbb{R}^1$. We study dynamic algorithms for the DTW distance. We accommodate local changes to one or both curves, such as inserting or deleting vertices and, after each operation, can report the updated DTW distance. We give such a data structure with update and query time $O(n^{1.5} \log n)$, where $n$ is the maximum length of the curves. The natural follow-up question is whether this time bound can be improved; under the aforementioned SETH-based lower bound, we could even hope for linear update time. We refute these hopes and prove that our data structure is conditionally optimal, up to subpolynomial factors. More precisely, we prove that, already for curves in $\mathbb{R}^1$, there is no dynamic algorithm to maintain the DTW distance with update and query time $O(n^{1.5 - \delta})$ for any constant~$\delta > 0$, unless the Negative-$k$-Clique Hypothesis fails. This holds even if one of the curves is fixed at all times, whereas the points of the other curve may only undergo substitutions. In fact, we give matching upper and lower bounds for various further trade-offs between update and query time, even in cases where the lengths of the curves differ. The Negative-$k$-Clique Hypothesis is a recent but well-established hypothesis from fine-grained complexity, that generalizes the famous APSP Hypothesis, and successfully led to several lower bounds.
翻译:暂无翻译