Chose the farthest k points from given n points

后端 未结 4 1830
故里飘歌
故里飘歌 2021-02-02 17:22

I have a set S of n points in dimension d for which I can calculate all pairwise distances if need be. I need to select k points in this set so that t

4条回答
  •  失恋的感觉
    2021-02-02 17:54

    How about this greedy algorithm:

    1. add to the solution the 2 points with the greatest distance between them in S
    2. until you reach a solution of size k, add to the solution the point for which the sum of distances from it to all the points already in the solution is the greatest.

    Lets call the greatest distance between any 2 point D, for each point we add to the solution, we add at least D due to the triangle inequality. so the solution will be at least (k-1)*D, while any solution will have (k-1)^2 distances, none of them exceeds D, so at the worse case you get a solution k times the optimum.

    I'm not sure this is the tightest bound that can be proved for this heuristic.

提交回复
热议问题