Take the 2-minute tour ×
MathOverflow is a question and answer site for professional mathematicians. It's 100% free, no registration required.

I'm looking for the algorithm that efficiently locates the "Loneliest Person on the Planet", where "loneliest" is defined as:

Maximum minimum distance to another person -- that is, the person for whom the closest other person is farthest away.

Assume a (admittedly miraculous) input of the list of the exact latitude/longitude of every person on Earth at a particular time.

Also take as provided a function d(p1, p2) that returns the distance on the surface of the earth between p1 and p2-- I know this is not trivial, but it's "just spherical geometry" and not the important (to me) part of the question.

What's the most efficient way to find the loneliest person?

Certainly one solution is to calculate d(...) for every pair of people on the globe, then sort every person's list of distances in ascending order, take the first item from every list and sort those in descending order and take the largest. But that involves n*(n-1) invocations of d(...), n sorts of n-1 items and one last sort of n items. Last I checked, n in this case is somewhere north of six billion, right? So we can do better?

share|improve this question
add comment

4 Answers

up vote 14 down vote accepted

This paper gives an O(n log n) algorithm for the "all-nearest-neighbors" problem: given a set of points S, find all the values m(p) where p is a point of S and m(p) is the minimum distance from p to a point of S \ {p}. Then the "loneliest point" is the point p which maximizes m(p). So your problem can be solved in O(n log n) time, which is pretty good.

(In case it's not clear, I'm applying their algorithm to the set of points viewed as living inside R^3, using the fact that there's an order-preserving relationship between distance along the sphere and straight-line distance in R^3.)

share|improve this answer
    
Thanks very much for a great answer! –  Joe Sinnott Oct 20 '09 at 3:18
add comment

This is called the "largest empty circle problem" in Computational Geometry, and has an O(n log n) solution provided that you are given the convex hull of the points and the corresponding Voronoi diagrams. There is a very readable paper on the problem here.

share|improve this answer
    
Thanks very much for your help! –  Joe Sinnott Oct 20 '09 at 3:18
add comment

Let's iteratively come up with a candidate, "the loneliest person so far", and at each step weed out lots of people who we can see aren't as lonely.

Pick a person at random, and calculate their "loneliness". Since they're the first, they are by default the loneliest person so far.

Now let's start searching for a new candidate. Pick a person at random, find everyone within the our current record loneliness. Either this set is empty, or not. If it's empty, we've found a new loneliest person, calculate their loneliness, and continue. Otherwise, mark everyone in that ball as happy, which just means we remove them from the pool of people we sample randomly (but not from any future calculations of loneliness).

This eventually finds the loneliest person.

Before we think about how efficient this is, let's make an optimisation. Optionally, pretend the world is a torus (following a fine tradition; Arnol'd's Classical Mechanics does this in a footnote while talking about weather forecasting). As usual, it's not essential.

Now, before we begin, sort everyone into two lists, one by latitude and one by longitude. We can now use this to efficiently find everyone within some radius, without having to evaluate every pair-wise distance. We can also improve the other step, calculating the loneliness of a new candidate.

Finally, on second thoughts I've decided that actually working out the complexity of this algorithm sounds like too much work right now. :-)

share|improve this answer
    
Thanks very much for taking the time to answer! –  Joe Sinnott Oct 20 '09 at 3:19
add comment

It may be possible to reformulate your problem so that "distance-based outlier" algorithms will apply.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.