Exact Algorithm for CDTW
- The paper introduces an exact polynomial-time algorithm for CDTW by using a dynamic programming framework that propagates piecewise-quadratic cost functions.
- It employs a detailed cell-based approach to match continuous subsegments of 1D curves, ensuring bounded cost function complexity.
- Extensions show that while exact solutions exist for 2D polygonal norms, approximations under Euclidean norms enhance practical applicability.
Continuous Dynamic Time Warping (CDTW) generalizes classical Dynamic Time Warping (DTW) to operate directly on the continuous parameterizations of polygonal curves. Unlike standard DTW—which matches sample points—CDTW matches subsegments flexibly, producing a similarity measure robust to sampling rate and outliers. Despite theoretical and practical advantages, the CDTW problem has required careful algorithmic development to realize exact polynomial-time solutions, particularly for 1D and certain 2D settings.
1. Formal Definition of CDTW
Given two 1D polygonal curves and (with respective arc-length parameter ranges , ), the CDTW similarity is defined via monotone parameterizations. The cost of matching is
where is a monotone path from to with or norm in (or for multi-dimensional cases) (Buchin et al., 2022).
2. Dynamic Programming Framework for 1D Curves
The key challenge for CDTW is to propagate cost functions on cell boundaries in the continuous parameter space. The algorithm by Buchin et al. (Buchin et al., 2022) divides the domain into a grid, managing cost as piecewise-quadratic functions on cell boundaries.
- On boundary , for , the maintained cost is
- Propagation through cells considers all input points to an output , combining existing cost and the path integral .
Each cell induces three cases for the optimal path structure, resulting in only new quadratic pieces per input piece, computable in time (Lemma~3.3, 4.3).
3. Polynomial-Time Algorithm and Complexity Bound
Combinatorial arguments show that the total number of quadratic pieces of all cost functions over the DP is across the grid. The main steps are:
- Partition the set of anti-diagonal boundaries into subsegments (Lemma~5.1).
- On each subsegment of the -th anti-diagonal, there are at most quadratic pieces (Lemma~5.2).
- Construct lower envelopes of these quadratics via stack-based scanning in time per cell, where is the number of input pieces.
This yields an -time and -space exact algorithm for one-dimensional curves (Buchin et al., 2022).
4. Function Representation and Recurrence Propagation
Boundary cost functions on cell segments are maintained as lists of quadratic pieces over intervals. Propagation involves mapping each input quadratic to new output quadratics (types A, B, or C by optimal path type):
1 2 3 4 |
for each quadratic (a, b, c) in input:
compute O(1) output quadratics via path structure analysis
add to output list
envelope := build_lower_envelope(output_list) |
The lower envelope maintenance is facilitated by the no-crossing property of optimal paths (Lemma 4.1), which ensures dominance can be resolved efficiently.
5. Extensions to 2D and General Norms
Exact computation under the Euclidean norm () for 2D curves is proven impossible in the algebraic computation model—certain CDTW values are transcendental and demand non-elementary operations (Baker's theorem; (Buchin et al., 25 Nov 2025)). However, for polygonal norms (e.g., the gauge norm induced by a regular -gon), an exact polynomial-time CDTW algorithm exists.
- Parameter-space is partitioned into cells.
- Boundary cost functions are maintained as stacks of piecewise-quadratic segments.
- Propagation in each cell exploits geometric properties (valley lines/direct crossings), and candidates for cost are derived as bivariate quadratics.
- Overlay and lower envelope construction on border intervals scales as per cell, with global complexity , where is the total number of pieces (Buchin et al., 25 Nov 2025).
For the Euclidean setting, a -approximation is achievable by substituting the Euclidean norm with a polygonal norm , with capturing the desired precision.
6. Critical Properties and Algorithmic Guarantees
- The 1D exact algorithm is the first to guarantee polynomial (quintic) bound on cost function complexity for CDTW (Buchin et al., 2022).
- The method avoids any grid discretization, maintaining continuous DP propagation throughout.
- For 2D polygonal norms, exact computability and polynomial-time guarantee hold; for , only approximation is possible in algebraic models.
- The dynamic programming propagation exploits invariants: local complexity growth is strictly bounded, cumulative minimality is stack-preserving, and envelope update does not explode the number of pieces.
7. Practical Considerations and Limitations
- While is polynomial, the exponent is high; heuristics and pruning strategies are needed for practical application.
- Implementation demands robust representation and management of piecewise-quadratic functions and lower envelopes.
- Extending to higher dimensions or different norms (beyond polygonal) may introduce further complexity or intractability.
- Real-world clustering experiments demonstrate practical CDTW advantages over DTW and Fréchet measures (Buchin et al., 2022).
References:
- Buchin et al. "Computing Continuous Dynamic Time Warping of Time Series in Polynomial Time" (Buchin et al., 2022)
- "Fundamentals of Computing Continuous Dynamic Time Warping in 2D under Different Norms" (Buchin et al., 25 Nov 2025)