TL;DR
This paper introduces the first subquadratic-time approximation schemes for Dynamic Time Warping (DTW) and Edit Distance (ED) between point sequences in $d$-dimensional space. By leveraging the geometric properties of "well-behaved" sequences—such as GPS trajectories or protein backbones—the authors break the quadratic time barrier that has long limited these essential similarity measures.
What Problem Does This Paper Address?
Measuring the similarity between trajectories (sequences of points in $\mathbb{R}^d$) is a fundamental task in fields ranging from robotics and video surveillance to bioinformatics and finance. Two of the most popular measures are Dynamic Time Warping (DTW), which handles sequences with different sampling rates, and Edit Distance (ED), which is robust against outliers.
The "gold standard" for computing these is dynamic programming (DP), which takes $O(n^2)$ time. For massive datasets, this quadratic cost is a dealbreaker. Worse, recent theoretical results (based on the Strong Exponential Time Hypothesis) suggest that a truly subquadratic algorithm for arbitrary sequences is likely impossible.
The authors ask: Can we break this "quadratic wall" if we restrict ourselves to the types of "well-behaved" sequences actually found in the real world?
Methods
The authors propose a framework that "sparsifies" the standard dynamic programming table. Instead of calculating every single cell in the $n \times n$ grid, their algorithm focuses only on regions where the optimal alignment path is likely to travel.
- Geometric Filtering: They use a Quadtree-based approach and Well-Separated Pair Decomposition (WSPD)—a classic tool in computational geometry—to identify pairs of point clusters that are "well-separated."
- Rectangle Construction: They partition the DP table into a small number of rectangular regions. Within each rectangle, the distance between any point in sequence $P$ and any point in sequence $Q$ is roughly the same.
- Efficient Pathfinding: Because the weights inside these rectangles are nearly constant, the authors use specialized data structures (like Cartesian trees for range-minimum queries) to quickly calculate the "cheapest" path through the rectangles in amortized constant time.
- Approximation: By allowing a small error $(1 + \epsilon)$, they can ignore the vast majority of the DP table that doesn't contribute to the optimal solution.
Datasets
This is a theoretical paper focused on algorithmic complexity and proofs. Consequently, it does not use empirical datasets or benchmarks for evaluation. The "data" discussed consists of mathematical families of sequences:
- $\kappa$-packed curves: Curves where the length of the curve inside any ball is bounded (common in GPS data).
- $\kappa$-bounded curves: Curves that don't stray too far from the straight line between any two of their points.
- Backbone sequences: Sequences where points are spaced relatively evenly and don't bunch up (modeling protein structures).
Key Insights and Ideas
- Geometry Beats SETH: While general string matching might be stuck at $O(n^2)$, the geometric constraints of physical trajectories (they can't be everywhere at once) allow for much faster processing.
- The "Aha" Moment: The realization that the DP table for DTW/ED can be treated as a geometric object. By covering the table with a near-linear number of "constant-weight" rectangles, the problem shifts from exhaustive calculation to efficient geometric search.
- Unified Framework: The authors show that the same core technique works for both DTW and ED, despite their different handling of "gaps" and "matches."
Key Results
The paper proves that for sequences of length $n$ in $\mathbb{R}^d$:
- For $\kappa$-packed and $\kappa$-bounded sequences: The $(1+\epsilon)$-approximation can be computed in near-linear time ($O(n \log n)$), where the constant factor depends on $\kappa$ and $\epsilon$.
- For backbone sequences: The algorithm achieves subquadratic time:
- DTW: $O(\frac{1}{\epsilon} n^{2-1/d} \log n)$
- ED: $O(\frac{1}{\epsilon} n^{2-1/(d+1)} \log n)$
- These represent the first known algorithms to achieve these bounds for these distance measures in a geometric setting.
Limitations and Future Work
- Worst-Case Performance: For "pathological" or highly complex sequences that fill space (like a Peano curve), the algorithm still reverts to $O(n^2)$ complexity.
- Backbone Gap: While the results for backbone sequences are subquadratic, they are not yet near-linear. The authors specifically highlight the open question of whether a near-linear algorithm exists for backbone sequences in $\mathbb{R}^2$.
- Implementation: As a theoretical work, the constants hidden in the $O$-notation (especially the dependence on $d$ and $\epsilon$) might be large. Future work could involve practical implementations to see how these algorithms perform on real-world GPS or protein data compared to existing heuristics.
Summary updated