Abstract
We propose a fast and dynamic algorithm for Density-Based Spatial Clustering of Applications with Noise (DBSCAN) that efficiently supports online updates. Traditional DBSCAN algorithms, designed for batch processing, become computationally expensive when applied to dynamic datasets, particularly in large-scale applications where data continuously evolves. To address this challenge, our algorithm leverages the Euler Tour Trees data structure, enabling dynamic clustering updates without the need to reprocess the entire dataset. This approach preserves a near-optimal accuracy in density estimation, as achieved by the state-of-the-art static DBSCAN method (Esfandiari et al., 2021). Our method achieves an improved time complexity of $O(d \log^3(n) + \log^4(n))$ for every data point insertion and deletion, where $n$ and $d$ denote the total number of updates and the data dimension, respectively. Empirical studies also demonstrate significant speedups over conventional DBSCANs in real-time clustering of dynamic datasets, while maintaining comparable or superior clustering quality.
Introduction
Density-Based Spatial Clustering of Applications with Noise (DBSCAN) is a fundamental tool in data science, valued for its ability to discover clusters of arbitrary shapes and robustly identify outliers. However, its widespread adoption in large-scale, real-time applications is hindered by two primary bottlenecks: high computational complexity ($O(n^2)$ in its original form) and a static design. In environments where data streams continuously—such as sensor networks or evolving user interactions—re-running a batch algorithm from scratch for every update is computationally prohibitive.
While recent advancements have introduced near-linear static versions of DBSCAN, a truly dynamic solution has remained elusive. This paper introduces DynamicDBSCAN, the first algorithm to support efficient point insertions and deletions with polylogarithmic update times while maintaining the near-optimal clustering accuracy of state-of-the-art static methods.
Methodology: LSH and Euler Tour Trees
DynamicDBSCAN achieves its efficiency by decoupling density estimation from connectivity management through two key technical pillars.
Locality Sensitive Hashing (LSH)
To avoid the $O(n^2)$ cost of pairwise distance calculations, the algorithm employs LSH to group points into "buckets." Points in close spatial proximity are likely to share a hash bucket, allowing for rapid identification of "core points" (dense regions) without exhaustive searching.
Euler Tour Trees (ETT)
The core innovation for handling dynamic updates is the use of Euler Tour Trees. Instead of maintaining a full graph of all point connections, DynamicDBSCAN represents clusters as a spanning forest.
When a new point is inserted and bridges two separate regions, the ETT performs a link operation. Conversely, when a point removal causes a cluster to split, a cut operation is performed. These operations are executed in $O(\log n)$ time using Euler Tour Sequences, which represent tree structures as linear sequences that are easy to manipulate. By maintaining only a "skeleton" of dense regions, the algorithm avoids redundant computations, achieving a remarkably low update complexity of $O(d \log^3 n + \log^4 n)$.
Empirical Evaluation
The researchers evaluated DynamicDBSCAN against synthetic "Blobs" (200k points) and several real-world benchmarks, including MNIST, Fashion-MNIST, KDDCup99, and Covertype. High-dimensional datasets were preprocessed using Principal Component Analysis (PCA) to reduce dimensionality to 20 before clustering.
Key Results
The experimental results highlight the algorithm's superior performance in both speed and scalability without sacrificing clustering quality.
- Massive Speedups: On the Blobs dataset, DynamicDBSCAN was approximately 3x faster than the state-of-the-art static LSH-based method (EMZ) and 8x faster than the standard Scikit-Learn implementation when processing a stream of 200,000 points.
- Scalability: On the Covertype dataset (~581k points), DynamicDBSCAN completed in 874 seconds, whereas the static EMZ required over 4,000 seconds. Standard DBSCAN was unable to run due to memory constraints.
- High Fidelity: Clustering quality, measured by the Adjusted Rand Index (ARI), remained virtually identical to static counterparts, proving that the dynamic updates do not degrade accuracy even as the dataset size increases.
Conclusion and Future Work
DynamicDBSCAN provides a scalable solution for clustering evolving datasets. By leveraging spanning forests and ETTs, it maintains high-quality clusters with minimal computational overhead. While the algorithm introduces some memory overhead ($O((n+d)\log n)$), its speed and accuracy make it a powerful tool for real-time applications. Future research may explore extending this dynamic framework to hierarchical clustering methods like HDBSCAN.
Summary updated