989 views
0 votes
0 votes

Link to actual Question - https://gateoverflow.in/3355/gate2008-it-45?show=214096#c214096

For the undirected, weighted graph given below, which of the following sequences of edges represents a correct execution of Prim's algorithm to construct a Minimum Span­ning Tree?

B) (c, e), (c, f), (f, d), (d, a), (a, b), (g, h), (h, f), (g, i)

===================================

is this explanation of option (b) valid ? 

as we're starting from vertex c then we will choose the minimum edge from all the adjacent vertices of c. 

So, here (c,e) = 7 is chosen before (c,f) which is 3 and that makes it false b/c (c,f) should be chosen first.

1 Answer

Best answer
1 votes
1 votes
  • prims algorithm always gives connected graph.
  • kruskal algorithm may or may not be connectrd

but in option a and b both gives disconnected graph so it is false.

selected by

Related questions

0 votes
0 votes
3 answers
2
iarnav asked Apr 29, 2018
1,572 views
Question 1) The shortest-path tree computed by Dijkstra's algorithm is necessarily an MST?Question2 ) Prim's algorithm works with negative weighted edges?
0 votes
0 votes
2 answers
4
iarnav asked Apr 28, 2018
395 views
Let G be a connected simple graph with non distinct edge weights. Now, e be the lightest edge in G. So, does this edge e is present in every MST of G?My take - when all e...