Input: sample data set DS, parameters (Eps, Minpts) Output: data cluster set C DBSCAN (DS, Eps, Minpts) Begin
Mark all points in DS as unvisited;
Do
Randomly choose an unvisited xi;
Mark xi as visited;
If points in xi’s -neighborhood are no less than Minpts
Create a new data cluster (DC);
Set N consist of points in xi’s -neighborhood;
For each point xj in N
If xj is unvisited
Mark xj as visited;
If points in xj’s Eps-neighborhood are no less than Minpts, add points to N;
End if
If xj is not a member of any data cluster, add xj to DC;
End if
End if
End for;
Output DC;
Else mark xi as a noise point;
End if
Until all unvisited points are visited;
Output C
End |