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 ?
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.
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.
Thanks!
The O(pn2) algorithms also solves for a much more general version of the problem (with weighted vertices and custom distance functions) so that's cool!