in reply to Sorting by geographical proximity / clumping groups of items based on X and Y
You're describing a clustering problem. If you know how many clumps you want to end up with, you
can run a k-means
clustering algorithm, which is just a mathematical formulation of Notromda's suggestion.
Because you have a desired maximum distance, you can choose the number of clusters (K) by starting with K=1,
and running k-means clustering. If the distance between elements in any cluster is too big, increment K and recluster.
Iterate until until all clusters meet the maximum distance criterion.
Brian
Brian
|
---|
In Section
Seekers of Perl Wisdom