-3

I have a Set of lets say 100 points. And the distance of a point from any other point is given. Which means I have 100x100 dataset giving me distance of each of the 100 points from all the other 100 points. I want to form clusters from this dataset based on the condition that distance between any two points in a cluster should not be greater than x(where x can be for example 25kms.).

I am new to clustering and data science. Please guide me how to solve this problem. What libraries can most efficiently solve this problem. Any help will be appreciated. :)

  • 1
    Please repeat [on topic](https://stackoverflow.com/help/on-topic) and [how to ask](https://stackoverflow.com/help/how-to-ask) from the [intro tour](https://stackoverflow.com/tour). “Show me how to solve this coding problem” is not a Stack Overflow issue. We expect you to make an honest attempt, and *then* ask a *specific* question about your algorithm or technique. We expect you to work through existing resources before posting here; Stack Overflow is not a personal tutorial resource. – Prune Sep 30 '20 at 16:58
  • Although I do understand and completely agree with what you are saying. But along with teaching me the rules and regulations of this platform in multiple words , it would have been really helpful if you could have just mentioned a single algorithm in one or two words that could've helped me. I am not expecting a line by line code. Just a library or an algorithm. I have read multiple blogs and was confused. Hence, I asked. :) – Utkarsh Srivastava Sep 30 '20 at 17:05
  • 1
    Again, that is off-topic. Doing so would simply encourage *more* off-topic posts of this type. – Prune Sep 30 '20 at 17:41
  • I guess you are wrong when you say StackOverflow does not tell you how to solve a coding problem. I have seen questions as simple as "What does 'xyz' command does in Python" and found them useful. Whole point of StackOverflow is to help is save time. If there would've been a well framed question like mine already existing. I wouldn't have to ask this question. I had to spend 1 hour researching to find the answer which I'll post here to save time for someone like me in the future. – Utkarsh Srivastava Sep 30 '20 at 17:54
  • Please notice that SO is [not a helpdesk](https://meta.stackoverflow.com/a/255019/4685471), and its goal is certainly *not* to help save time. – desertnaut Sep 30 '20 at 18:58
  • I agree to disagree :P My point is I feel SO is not just for seasoned programmers to discuss specific implementation of complex algos but for novice/amateur and even non-coders when they feel stuck, have exhausted all resources and still cannot implement a silly algo. And the second category is the majority of SO's user base. – Utkarsh Srivastava Sep 30 '20 at 20:56

1 Answers1

-1

This can be solved using sklearn's agglomerative clustering by setting the affinity as "precomputed"

Refer this link for the solution.