Reputation: 21
so I have a clustering task where I had to make clusters in which distance between each points is not higher than 30km. I only had longitude and latitude. So I used DBSCAN algorithm for that(got result I needed), converted latitude and longitude points to distance in kilometers and got 11 clusters. There you can see how they are plotted here .
As you can see some clusters have only 1 point. But anyway my question is how can I find a maximum and minimum distances between cluster points?In other words, I need to find two cluster points which are closest to each other and two points which are furthest from each other and find their distances. I found some solutions with other cluster algorithms, but didn't find anything for DBSCAN.
Upvotes: 2
Views: 1267
Reputation: 77454
You have to compute them yourself, because DBSCAN does not use pairwise distances.
There are functions to compute pairwise distances, and then you can simply call max()
and min()
(here you have to pay attention to not include the diagonal).
If this is too slow, you may want to look into bounding techniques using the triangle inequality. For farthest points, begin with a border point if possible, find the farthest point to this one; and then once more. This will give you good candidates to bound further search.
Upvotes: 2