Let's say I have a general tree. What algorithm can I use to find a shortest walk that starts at the root, passes through exactly $k$ different leaves, and ends at the root? Passing through a node/edge more than once is allowed.
For example, consider this graph:
For $k = 1$, the shortest walk would have the node 4. For $k = 2$, the leaf nodes would be 4 and 12. For $k = 3$, the leaves would be 4, 16 and 17.
What I actually need is the length of the shortest walk (if this simplifies anything).
I could not find an algorithm for this, but maybe I searched with the wrong terms.