views:

133

answers:

1

My teacher asked us to implement a Dynamic Programming solution to that problem, but I'm thinking one doesn't exist since I couldn't find it using Google.

Anyway, given a graph and a k, say 3, you have to find the 3 best MSTs from it. If the graph is such that it doesn't have k subtrees, you can return either the same tree multiple times or suboptimal trees.

I can't really think of a solution to it.

+1  A: 

You had me confused for a while there and I thought you might have misunderstood the problem. The "k-MST" problem consists of finding k edges that form a subtree such that the sum of its edges is less than or equal to all other sums you can get from subtrees of k edges. But then I saw the plural s.

So ok, for your problem, I personally would try to find a DP-algorithm for finding the MST that combines with a way of generating a "next" MSTs. Since this is dynamic programming I'd look into repeatedly optimizing something (in this case de-optimizing for each step) or at various ways of partitioning edges into subsets that make sense in an MST setting. There might be several ways.

However, searching for partitions and minimum spanning trees I found this, which might be more of help if you just want the answer: http://www.scielo.br/scielo.php?script=sci_arttext&pid=S0101-74382005000200004

integer
What? A greedy algorithm is not a DP algorithm, and your answer is not at all helpful. He's asking **how** to find something, not **what** to find. -1.
IVlad
I apologize, I shall remove the reference to greedy, it was another misunderstanding (I was still thinking about k-MST, where you'd select sub-searches in a greedy manner much like most MST generation). And yes, you are right, I did not give an explicit answer, just how I would think or approach it. (Since it's a homework problem.)
integer
Clarified and added a link to actual solution.
integer
Thank you, that is indeed more helpful. +1.
IVlad