Walking the Dog Fast in Practice: Algorithm Engineering of the Fréchet Distance

Karl Bringmann, Marvin Künnemann, André Nusser

Abstract

The Fréchet distance is a fundamental metric for curve similarity, yet its $O(n^2)$ computational complexity often hinders practical application. This paper introduces a high-performance implementation leveraging recursive divide-and-conquer, sophisticated pruning rules, and adaptive filters. Our approach achieves up to 100x speedup over state-of-the-art methods while providing verifiable certificates of correctness for real-world trajectory data.

Introduction

The Fréchet distance is considered the "gold standard" for comparing trajectories, such as GPS traces or handwriting. It is often described using the analogy of a person walking a dog: both move along their respective paths, and the Fréchet distance is the minimum leash length required to complete the walk without either party moving backward. While theoretically powerful, computing this distance for two curves of length $n$ takes $O(n^2)$ time. This quadratic bottleneck makes it difficult to search through thousands of long trajectories in modern Geographic Information Systems (GIS).

Methods

The authors focus on the decider problem: given two curves and a distance $\delta$, is the Fréchet distance $\le \delta$? Their approach improves the classic Alt-Godau algorithm through several "algorithm engineering" techniques designed to exploit the non-adversarial nature of real-world data.

The free-space diagram (left) and the corresponding curve matching (right) illustrate the search for a valid path within distance δ.

Recursive Divide-and-Conquer and Pruning

Instead of filling out a massive $n \times m$ grid (the "free-space diagram"), the algorithm splits the problem into smaller boxes. They introduced four key pruning rules to skip entire sections of the search space. For example, if a box has no "reachable" entry points or if the boundaries are "simple," the algorithm can jump ahead without exploring the interior.

Recursive decomposition and pruning simplify the search space by identifying and skipping non-essential regions.

Adaptive Filters and Certification

The implementation utilizes "Greedy" and "Equal-time" filters with adaptive step sizes. Instead of moving one vertex at a time, these filters use heuristic checks based on the triangle inequality to leap across long segments. Furthermore, for every "Yes/No" answer, the algorithm produces a certificate—a short proof that a third party can easily verify to ensure correctness.

Results

The implementation was evaluated on diverse datasets, including the GeoLife dataset (17,000 real-world GPS trajectories) and handwritten characters. Key findings include:

  • Massive Speedups: The new approach is up to 100x faster than the winning implementation of the ACM SIGSPATIAL GIS Cup 2017.
  • Query Performance: When integrated into near-neighbor search structures, it improved query times by up to 30x.
  • Practical Certification: Generating a proof only slows the decider down by about 50%, a small price for guaranteed reliability.

Conclusion

This research bridges the gap between pessimistic theoretical bounds and practical GIS needs. By recognizing that real-world trajectories have significant "simple" structure, the authors' pruning rules and adaptive filters make the Fréchet distance a viable tool for large-scale applications. Future work will explore extensions to higher dimensions and integration into standard computational geometry libraries.

Summary updated

BibTeX
@article{bringmann2019walking,
  author = {Karl Bringmann and Marvin Künnemann and André Nusser},
  title = {{Walking the Dog Fast in Practice: Algorithm Engineering of the Fréchet Distance}},
  journal = {J. Comput. Geom.},
  year = {2019},
}
Figure