World's most popular travel blog for travel bloggers.

How many minimal spanning trees are there when all edge costs are distinct?

, , No Comments
Problem Detail: 

Suppose all costs on edges are distinct. How many minimal spanning trees are possible?

I dont know if this question is supposed to be easy or hard, but all I can come up with is one, because Kruskal's, and any other greedy algorithm should choose all the smallest weighted edges first. Then, if all weights on all edges are distinct, then there are no two equivalently weighted minimum spanning trees if a greedy algorithm is used.

Asked By : agent154

Answered By : vonbrand

Consider Kruskal's or Prim's algorithms to get minimal spanning trees. They consider arcs in increasing order of cost. If all costs are different, the order in which they are added is fixed, and so is the spanning tree constructed. It is unique in this case.

Best Answer from StackOverflow

Question Source : http://cs.stackexchange.com/questions/10728

0 comments:

Post a Comment

Let us know your responses and feedback