I am looking for an efficient algorithm for the following problem:
Given the many points in 2D space, where each point is determined by its X and Y coordinates. It is required to split this set of points into a set of clusters, so if the distance between two arbitrary points is less than a certain threshold, these points must belong to one cluster:

In other words, such a cluster is a set of points that are fairly close to each other.
A naive algorithm might look like this:
- Let R be the resulting list of clusters, initially empty
- Let P be a list of points, initially contains all points
- P C, . P
- Pi P
4. Pc C
4AA. (Pi, Pc) < , Pi C P
- C 4, 4
- C R. P , 3
. , ?
P.S. apriori