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 complexity of the algorithm. As Jack pointed out, finding the minimum area triangle is 3sum-hard and in any case not well suited to my application.
I am hoping there is a more efficient algorithm for finding the minimum perimeter (i.e. |AB|+|AC|+|BC|) triangle or something similar (e.g. minimum |AB|²+|AC|²+|BC|².) I know of no reason why this should be 3sum-hard as the existence of 3 colinear points elsewhere would not affect the result.
Note: my points have eight dimensions, so any algorithm that is restricted to fewer dimensions is not suitable.
There is an obvious algorithm which works in O(n^2)
.
1) perform Delaunay triangluation - O(n log n)
, so we get a planar graph.
As it is Delaunay triangluation, which maximises the minimum angle, it is clear that the closest 3 points must be connected by at least 2 edges (but they don't necessarily need to form the triangle!). Otherwise there would be more closer points or more closed angles.
2) for each point (vertex of the graph), we examine each couple of adjacent edges and look the 3 vertices defined by these 2 edges.
How much time will the step 2) will take? Since the graph is planar, the number of edges is <= 3n - 6, i.e. O(n)
. So this step will take O(n^2)
in the worst case (O(n)
in the typical case, where the degree of each vertex is limited).
So the whole algorithm is O(n^2)
. Note that the step 2) is somehow naive (brute force) solution, so I think there is a space for improvement (also, the steps 1 and 2 could probably be merged somehow).