DBSCAN in domains with periodic boundary conditions
Xander M. de Wit, Alessandro Gabbana
TL;DR
This work tackles clustering in spaces with periodic boundary conditions, where standard DBSCAN under open boundaries is insufficient. It introduces a periodic-extension approach that duplicates data by distance $\epsilon$ in each periodic direction, runs the conventional DBSCAN on the augmented dataset, and then links and resolves clusters across periodic copies. The method preserves compatibility with optimized neighbor-search algorithms and maintains the asymptotic $O(N\log N)$ runtime, and is implemented as a Python package built on scikit-learn. Validation on synthetic 1D/2D/3D data and a real turbulent-flow dataset demonstrates correct cluster recovery under periodic boundaries and practical applicability for physics-inspired datasets.
Abstract
Many scientific problems involve data that is embedded in a space with periodic boundary conditions. This can for instance be related to an inherent cyclic or rotational symmetry in the data or a spatially extended periodicity. When analyzing such data, well-tailored methods are needed to obtain efficient approaches that obey the periodic boundary conditions of the problem. In this work, we present a method for applying a clustering algorithm to data embedded in a periodic domain based on the DBSCAN algorithm, a widely used unsupervised machine learning method that identifies clusters in data. The proposed method internally leverages the conventional DBSCAN algorithm for domains with open boundaries, such that it remains compatible with all optimized implementations for neighborhood searches in open domains. In this way, it retains the same optimized runtime complexity of $O(N\log N)$. We demonstrate the workings of the proposed method using synthetic data in one, two and three dimensions and also apply it to a real-world example involving the clustering of bubbles in a turbulent flow. The proposed approach is implemented in a ready-to-use Python package that we make publicly available.
