Abstract
We study data structures for storing a set of polygonal curves in ${\rm R}^d$ such that, given a query curve, we can efficiently retrieve similar curves from the set, where similarity is measured using the discrete Fr'echet distance or the dynamic time warping distance. To this end we devise the first locality-sensitive hashing schemes for these distance measures. A major challenge is posed by the fact that these distance measures internally optimize the alignment between the curves. We give solutions for different types of alignments including constrained and unconstrained versions. For unconstrained alignments, we improve over a result by Indyk from 2002 for short curves. Let $n$ be the number of input curves and let $m$ be the maximum complexity of a curve in the input. In the particular case where $m \leq \frac{\alpha}{4d} \log n$, for some fixed $\alpha>0$, our solutions imply an approximate near-neighbor data structure for the discrete Fr'echet distance that uses space in $O(n^{1+\alpha}\log n)$ and achieves query time in $O(n^{\alpha}\log^2 n)$ and constant approximation factor. Furthermore, our solutions provide a trade-off between approximation quality and computational performance: for any parameter $k \in [m]$, we can give a data structure that uses space in $O(2^{2k}m^{k-1} n \log n + nm)$, answers queries in $O( 2^{2k} m^{k}\log n)$ time and achieves approximation factor in $O(m/k)$.
Introduction
Retrieving similar trajectories or time series from large-scale databases is a critical task in modern data science, with applications spanning vessel tracking, speech recognition, and biological sequence analysis. The primary challenge in these domains is that curves are inherently "slippery" objects. Unlike points in Euclidean space, the similarity between two curves depends on their alignment—the specific mapping of points on one curve to points on the other.
The two most prominent measures for this purpose are the discrete Fréchet distance (often described as the "dog-leash" distance) and Dynamic Time Warping (DTW). While effective, both are computationally expensive to compute, typically requiring quadratic time relative to the number of vertices, $m$. For a database of $n$ curves, a linear scan becomes prohibitively slow. While Locality-Sensitive Hashing (LSH) is the standard technique for accelerating approximate nearest-neighbor searches in high-dimensional spaces, it has historically struggled to accommodate the alignment-optimizing nature of curve distances. This work presents the first LSH schemes specifically designed for these measures.
The Alignment Challenge
The core difficulty in applying LSH to curves is that the distance measure itself involves an optimization over all possible alignments. Standard LSH functions map similar points to the same bucket, but for curves, "similarity" is not fixed; it is discovered through the alignment process. The authors overcome this by introducing hashing schemes that effectively "absorb" the complexity of the alignment through geometric simplification.
Proposed LSH Schemes
The paper introduces three primary variations of LSH for curves:
- The Basic Scheme (Linear Approximation): This approach involves "snapping" every vertex of a curve to a randomly shifted $d$-dimensional grid of resolution $\delta$. By removing consecutive duplicate vertices, the curve is reduced to a sequence of grid cells. This sequence serves as the hash value. If two curves are close in Fréchet distance, their snapped representations are highly likely to be identical.
- Constant Approximation Scheme: To achieve an approximation factor independent of the curve length $m$, the authors utilize an asymmetric approach. They independently perturb the vertices of the input curves and the query curve before snapping them to a fixed grid. This method is particularly powerful for "short" curves where $m \leq O(\log n)$.
- The Trade-off Scheme: This scheme allows for a tunable balance between performance and accuracy. By randomly partitioning curves into $k$ subsequences and applying the basic LSH to each, the approximation factor can be reduced to $O(m/k)$. This provides a flexible framework for different application requirements.
Key Results and Performance Bounds
The theoretical results established in this paper provide a hierarchy of performance bounds for the discrete Fréchet distance and its variants. A significant highlight is the "zero false-positive" property: if two curves are further apart than the defined approximation threshold, they are guaranteed not to collide in the hash table.
As shown in Table 1, the basic scheme achieves near-linear space complexity and fast query times with a linear approximation factor. The trade-off scheme demonstrates how increasing the parameter $k$ improves the approximation factor at the cost of increased space and query time. For the specific case of short curves, the data structures provide a practical alternative to previous theoretical results that often required exponential space.
Extensions and Future Work
The authors also extend these techniques to constrained distances, where the alignment is restricted to prevent unrealistic warping—a common requirement in time-series analysis. While the basic scheme carries over to DTW, providing the first provable LSH for that measure, the constant approximation techniques do not translate as easily because DTW does not satisfy the triangle inequality.
Future research directions include investigating whether these approximation bounds are tight and exploring the empirical performance of these grid-based hashing schemes on real-world datasets, such as GPS trajectories or sensor data. The current work sets a new theoretical foundation for efficient curve retrieval in high-dimensional spaces.
Summary updated