Quantcast
Channel: compute all n-th closest points of all points in a dataset - Stack Overflow
Viewing all articles
Browse latest Browse all 3

compute all n-th closest points of all points in a dataset

$
0
0

I have dataset of 1000 points on a plane. I represented all the possible pairs of points in P and calculated the distances of all possible pairs.What I have to do is: For a given n, calculate all the n-th nearest points for all points p in P.

What I did before:

P_pairs = [((33, 9), (34, 13)), ((33, 9), (62, 119)), ((33, 9), (33, 7)), ((33, 9), (48, 123)), ...]listofdistances =  [{'((33, 9), (34, 13))': 4.123105625617661}, {'((33, 9), (62, 119))': 113.75851616472501}, {'((33, 9), (33, 7))': 2.0}, ...]

In this context, I am stuck in sorting listofdistances such that for every point, there are the minimum n distances as values left.

Maybe I have to calculate the n-th nearest points directly, instead of calculating all the distances of the points. But I don't exactly know how.


Viewing all articles
Browse latest Browse all 3

Latest Images

Trending Articles





Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>
<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596344.js" async> </script>