
the logic behind the algorithm is the following
The input parameters are, epsilon, minpts and distance_measure
Step 1: pick a random unvisited point p from the input data
Step 2: Check if there are at least minpts number of points in the epsilon neighborhood of p
Step 3: If not, then mark p as noise else ExpandCluster(p)
The ExpandCluster functon has the following logic
Step 1: add point p to cluster c
Step 2: iterate over all neighouring points of p
Step 3: for each neighbouring point check if there are at least minpts number of points in epsilon neighborhood
Step 4: If yes, then add the neighbouring points of the p' to the neighbouring points of p
Step 4: add neighbouring points to the cluster c
The advantages of DBSCAN is its speed, ability to capture robust shapes of clusters, robustness to outliers
The disadvatnage of DBSCAN is the inability to cluster datasets with varying density
To address these issues the following algorithms have been developed

OPTICS is an algorithm that tries to solve this issue
It introduces two new cocncepts the core-distance and reachability
core-distance is the minimum epsilon for which the given core will include minpts number of points
reachability is the max between euclidean distance to the point q and core-distance for give the point p.
It is important to note that OPTICS by itself is not a clustering algorithm, however, it produces a reachability plot which could be used to sperate the clusters in the data.
The logic of algorithm is to process the points with priority based on their reachability distance, which uncovers hidden structures in the data and allows to cluster them. OPTICS itself is not a clustering algoirthm, but it can be converted to so by selecting a treshold value for the hierarchical reachability structure.
The weakness of OPTICS is that it is too computationaly heavy and does not scale for big data.
The HDBSCAN came to rescue this situation
