🌌 DBSCAN
Density-based clustering
Clusters: 0
Noise points: 0
Preset
Setup
Controls
Stats
Clusters
0
Noise
0
Points
0
Status
Ready
Click the canvas to add points.
Info & Theory

DBSCAN (Density-Based Spatial Clustering of Applications with Noise) finds clusters as dense regions separated by sparse ones. It needs two parameters: a radius ε and a count minPts.

Three kinds of point

  • Core: has at least minPts points within radius ε (counting itself).
  • Border: within ε of a core point but not itself dense enough.
  • Noise: neither — a sparse outlier, drawn as a grey ✕.

Growing a cluster

Pick an unvisited core point and start a cluster. Add every point in its ε-neighbourhood to a queue; for each dequeued point that is itself a core point, add its neighbours too. The cluster keeps expanding through chains of dense points until the frontier is exhausted.

Versus k-means

Unlike k-means, DBSCAN does not need you to pick the number of clusters — it discovers however many dense regions exist. It also follows arbitrary shapes (the Moons and Rings presets are non-convex, where k-means fails) and reports outliers explicitly as noise rather than forcing every point into a cluster.

Choosing ε and minPts

Too small an ε (or too large a minPts) labels everything noise; too large an ε merges everything into one blob. Drag the sliders to feel the trade-off.

About DBSCAN — Density-Based Clustering

DBSCAN (Density-Based Spatial Clustering of Applications with Noise) is a machine learning algorithm that groups data points into clusters based on local density. It classifies every point as a core point (with at least minPts neighbours within radius epsilon), a border point (near a core point but not dense enough itself), or noise (an isolated outlier). Unlike centroid-based methods, DBSCAN grows clusters by expanding through chains of dense neighbourhoods, discovering groups of any shape without requiring you to specify the number of clusters in advance.

DBSCAN was introduced in 1996 and has since become a cornerstone algorithm in spatial data analysis, anomaly detection, geospatial clustering, and image segmentation. It is especially useful in real-world datasets where clusters are irregularly shaped and outliers must be identified explicitly.

Frequently Asked Questions

What does DBSCAN stand for and how does it work?

DBSCAN stands for Density-Based Spatial Clustering of Applications with Noise. The algorithm scans each data point and counts how many other points lie within a user-defined radius epsilon (epsilon-neighbourhood). If that count reaches a threshold called minPts, the point is labelled a core point and a cluster is grown from it by recursively adding all reachable neighbours. Points that are reachable from a core point but not dense enough themselves become border points, while isolated points that belong to no cluster are labelled noise.

How do I use the simulation controls?

Choose a point-cloud preset (Moons, Rings, or Blobs) using the top buttons, then adjust the Epsilon slider to set the neighbourhood radius and the minPts slider to set the density threshold. Press Run to animate the clustering step by step, or Step to advance one micro-step at a time. You can also click anywhere on the canvas to add custom data points. The stats panel shows the current number of clusters, noise points, and algorithm status in real time.

What happens when I change the epsilon or minPts values?

Increasing epsilon enlarges the neighbourhood radius, causing more points to be counted as neighbours; too large a value merges all points into a single cluster. Decreasing epsilon shrinks the radius, causing more points to be labelled noise. Increasing minPts raises the density requirement for a core point, producing fewer, tighter clusters with more noise; decreasing it allows sparser regions to form clusters. The sweet spot between these two parameters determines the quality and granularity of the clustering result.

What is the mathematical definition of density-reachability?

A point q is directly density-reachable from point p (given epsilon and minPts) if q lies within the epsilon-neighbourhood of p and p is a core point. A point q is density-reachable from p if there is a chain of points p1, p2, ..., pn where p1 = p, pn = q, and each pi+1 is directly density-reachable from pi. Two points are density-connected if there exists a point o from which both are density-reachable. A cluster is defined as a maximal set of mutually density-connected points. Noise points are those that are not density-reachable from any core point.

Where is DBSCAN used in the real world?

DBSCAN is widely used in geospatial analysis to find clusters of GPS coordinates such as traffic hotspots, crime scenes, or earthquake epicentres. It is applied in astronomy to group stars and galaxies in survey data, in biology for clustering cells in flow cytometry, in e-commerce to detect unusual purchasing patterns as anomalies, and in computer vision for grouping pixels in image segmentation. Its ability to ignore outliers as noise makes it particularly valuable in noisy sensor data from IoT devices and autonomous vehicles.

What is a common misconception about DBSCAN compared to k-means?

A common misconception is that DBSCAN is simply a more flexible version of k-means that always produces better results. In reality, DBSCAN struggles with datasets that have clusters of widely varying densities, because a single global epsilon value cannot simultaneously capture both a tight dense cluster and a sparse spread-out cluster. K-means, despite requiring the number of clusters in advance, can outperform DBSCAN on well-separated spherical blobs with similar sizes. The two algorithms are complementary rather than one being universally superior.

Who created DBSCAN and when was it published?

DBSCAN was introduced in 1996 by Martin Ester, Hans-Peter Kriegel, Jorg Sander, and Xiaowei Xu at the Second International Conference on Knowledge Discovery and Data Mining (KDD-1996). The original paper, titled "A density-based algorithm for discovering clusters in large spatial databases with noise," became one of the most cited papers in data mining. In 2014, the authors received the SIGKDD Test of Time Award, recognising the lasting influence of the algorithm nearly two decades after its publication.

What other clustering algorithms are related to DBSCAN?

OPTICS (Ordering Points To Identify the Clustering Structure) is a direct extension of DBSCAN that overcomes the varying-density limitation by producing a reachability plot instead of a fixed partition. HDBSCAN (Hierarchical DBSCAN) builds a hierarchy of clusters at multiple density levels and selects the most stable ones, making it more robust on real-world data. Mean-shift clustering is another density-based method that finds cluster centres by iteratively shifting points toward regions of higher density. Affinity propagation and spectral clustering share some ideas about connectivity but operate on different mathematical principles.

How is DBSCAN used in engineering and technology?

In autonomous driving, DBSCAN is used to cluster 3D point clouds from LiDAR sensors, grouping returns that belong to the same physical object such as a pedestrian or another vehicle. In network security, it detects botnet activity by clustering IP addresses that exhibit similar traffic patterns, flagging isolated addresses as potential anomalies. In manufacturing, it identifies defective product clusters in sensor streams on production lines. Cloud platforms such as AWS and Google Cloud include DBSCAN in their managed machine learning services for large-scale spatial analytics.

What are the current research frontiers around DBSCAN?

Active research directions include scalable variants of DBSCAN for distributed and streaming data, such as PDBSCAN (parallel DBSCAN on MapReduce/Spark) and STING-based approximations that reduce the O(n^2) complexity bottleneck. Researchers are also exploring adaptive parameter selection methods that automatically estimate epsilon from the data distribution using k-nearest-neighbour distance plots or machine learning surrogates. Deep clustering combines DBSCAN with neural network embeddings so that the distance metric itself is learned, making the algorithm effective on image, text, and graph data where Euclidean distance is not meaningful.