Questions tagged [closest-points]
95 questions
27
votes
1 answer
Nearest Neighbor Search: Python
I have a 2 dimensional array:
MyArray = array([6588252.24, 1933573.3, 212.79, 0, 0],
[6588253.79, 1933602.89, 212.66, 0, 0],
etc...)
The first two elements MyArray[0] and MyArray[1] are the X and Y coordinates of…
![](../../users/profiles/1101351.webp)
Dlinet
- 1,093
- 3
- 14
- 22
21
votes
4 answers
Closest group of 3 points
Is there a known, efficient algorithm for finding the closest group of three points in a cloud?
This is similar to the closest pair of points problem but I am looking for three points instead of two.
Edit
The definition of "closest" will affect the…
![](../../users/profiles/12048.webp)
finnw
- 45,253
- 22
- 134
- 212
12
votes
6 answers
How to align two unequal sized timeseries numpy array?
I have two numpy arrays containing timeseries (unix timestamps).
I want to find pairs of timestamps (1 from each array) whose difference is within a threshold.
For achieving this, I need to align two of the time series data into two arrays, such…
![](../../users/profiles/840546.webp)
Dexters
- 2,225
- 3
- 29
- 50
8
votes
4 answers
Closest Pair Implemetation Python
I am trying to implement the closest pair problem in Python using divide and conquer, everything seems to work fine except that in some input cases, there is a wrong answer. My code is as follows:
def closestSplitPair(Px,Py,d):
X =…
![](../../users/profiles/2125355.webp)
maverick93
- 143
- 1
- 3
- 13
7
votes
1 answer
Boost Library and closest points
I can find the distance between a point MyPoint and a polygon MyPolygon with
double dist = boost::geometry::distance(MyPoint, MyPolygon)
obviously the actual closest point on MyPolygon has to be computed somewhere. Is there an easy way to get that…
![](../../users/profiles/3049681.webp)
user3049681
- 267
- 3
- 11
6
votes
1 answer
Closest pair of points algorithm
I am trying to implement a simpler version of this algorithm but which works better than the quadratic algorithm. My idea basically is to sort the points by only x coordinate and try to solve it from there. Once I sort my array of points by x…
![](../../users/profiles/947933.webp)
Paul
- 911
- 3
- 15
- 22
6
votes
2 answers
Closest pair of points algorithm variation
I know this may be a duplicate, but it seems like a variation on the 'Closest pair of Points' algorithm.
Given a Set of N points (x, y) in the unit square and a distance d, find all pair of points such that the distance between them is at most…
![](../../users/profiles/814601.webp)
Fernando
- 7,445
- 5
- 42
- 77
6
votes
2 answers
Haskell to find the distance between the two closest points
Given a list of points in a two dimensional space, you want to perform a function in
Haskell to find the distance between the two closest points.
example:
Input: project [(1,5), (3,4), (2,8), (-1,2), (-8.6), (7.0), (1.5), (5.5), (4.8),…
![](../../users/profiles/59468.webp)
franvergara66
- 9,675
- 17
- 51
- 98
5
votes
4 answers
Algorithm, closest point between list elements
I have n ordered lists of unequal size (where I do not know beforehand how many lists there are going to be). I need to find the minimum average distance between one element in each list.
For example given n=3 for three lists:
a = [14, 22, 36, 48]
b…
![](../../users/profiles/6394069.webp)
D.A.
- 93
- 1
- 9
5
votes
1 answer
Closest Pair of Points in 3+ Dimensions (Divide and Conquer)
I am struggling to wrap my head around how the divide and conquer algorithm works for dimensions greater than 2, specifically how to find the closest pair of points between two sub-problems.
I know that I need to only consider points within a…
![](../../users/profiles/5599146.webp)
DonGato
- 73
- 1
- 4
5
votes
5 answers
Closest pair of points across a line
I have two sets of 2D points, separated from each other by a line in the plane. I'd like to efficiently find the pair of points, consisting of one point from each set, with the minimum distance between them. There's a really convenient looking paper…
![](../../users/profiles/787480.webp)
Sneftel
- 34,359
- 11
- 60
- 94
4
votes
2 answers
Closest pair algorithm for comparing points from 2 different arrays
I would like to compare the points from one array to the points from another array and find the closest pair. Till now whatever I have come across is with a single array. I do not want to compare the points from the same array.
The brute force…
![](../../users/profiles/3002448.webp)
Lawrence
- 417
- 5
- 14
4
votes
2 answers
Finding Nearest Node for Each Node
I have 2 sets of nodes - Set A and Set B. Each set is of size 25,000.
I am given a percentage (lets say 20%). I need to find the minimum distance such that 20% of the nodes in Set A are within that distance of any node in Set B.
Solution:
Find the…
![](../../users/profiles/1889720.webp)
Evorlor
- 6,158
- 16
- 60
- 122
4
votes
1 answer
Fastest way to find n closest nodes to a given node in a directed weighted graph
Right now I'm performing Dijkstra's algorithm on the entire graph and forming a min-heap of the nodes by total distance from the origin node. I then remove the top n elements from the heap.
This strikes me as seriously inefficient. Suppose I need to…
![](../../users/profiles/1177590.webp)
ask
- 1,934
- 7
- 29
- 38
3
votes
1 answer
find closest lat long to a input lat long Sql server 2008
Hi I have a point cloud in my database (Sql server 2008 spatial). That is about 6 million records. There are 3 columns: id, value , geom.
What is the most optimized way of getting the 'value' at input lat long ??
I am new to spatial queries in SQL…
![](../../users/profiles/726239.webp)
Shaunak
- 16,227
- 4
- 48
- 81