Блог пользователя throwaway_1234

Автор throwaway_1234, история, 9 лет назад, По-английски

I thought of this problem and I was wondering if there is any polynomial time solution?

Given a weighted tree of N nodes, pick K nodes such that sum of distances from each node to the nearest picked node is minimized.

For K = 1, the answer is the centroid of the tree. What about K > 1 ?

  • Проголосовать: нравится
  • +8
  • Проголосовать: не нравится

»
9 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

I think you can binary search for the distance possible, and then use a greedy algorithm, where you take nodes as high as you can in the tree.

»
9 лет назад, скрыть # |
 
Проголосовать: нравится +26 Проголосовать: не нравится

Your problem (on general graphs) is called as "K-median". A quick search reveals that the problem on trees can be solved in O(KN2) time [1].

[1] Tamir, A. An O(pn2) algorithm for the p-median and related problems on tree graphs.