On the closest pair of points problem
Martin Hitz, Michaela Hitz
TL;DR
The paper revisits the closest-pair of points problem in the plane and introduces two deterministic algorithms, cppAPs and cppMM, rooted in packing theory and grid-based pruning, to improve practical performance over classical methods. cppMM is proven to have $O(n)$ time for uniformly distributed inputs, using a packing-bound grid to realize a deterministic, linear-time average-case algorithm, while cppAPs offers a simple but extremely fast all-pairs variant with strong empirical performance despite an $O(n^2)$ worst case. An extensive empirical study compares these methods against classical algorithms across distributions and up to $n = 2^{25}$, showing cppMM dominating for large-scale problems. The work provides practical, easy-to-implement deterministic options for CPP with notable impact on large point-cloud tasks in computational geometry.
Abstract
We introduce two novel algorithms for the problem of finding the closest pair in a cloud of $n$ points based on findings from mathematical optimal packing theory. Both algorithms are deterministic, show fast effective runtimes, and are very easy to implement. For our main algorithm, cppMM, we prove $O(n)$ time complexity for the case of uniformly distributed points. Our second algorithm, cppAPs, is almost as simple as the brute-force approach, but exhibits an extremely fast empirical running time, although its worst-case time complexity is also $O(n^2)$. We embed the new algorithms in a review of the most prominent contenders and empirically demonstrate their runtime behavior for problem sizes up to $n =$ 33,554,432 points observed in our C++ test environment. For large $n$, cppMM dominates the other algorithms under study.
