• retagged by
21,591 views
38 38 votes

Consider the undirected graph below:

Using Prim's algorithm to construct a minimum spanning tree starting with node A, which one of the following sequences of edges represents a possible order in which the edges would be added to construct the minimum spanning tree?

  1. $\text{(E, G), (C, F), (F, G), (A, D), (A, B), (A, C)}$
  2. $\text{(A, D), (A, B), (A, C), (C, F), (G, E), (F, G)}$
  3. $\text{(A, B), (A, D), (D, F), (F, G), (G, E), (F, C)}$
  4. $\text{(A, D), (A, B), (D, F), (F, C), (F, G), (G, E)}$

4 Answers

Best answer
43 43 votes

Answer is D.

$A$ and $B$ produce disconnected components with the GIVEN order in options which is NEVER allowed by prims's algorithm.

$C$ produces connected component every instant a new edge is added BUT when first vertex is chosen(first vertex is chosen randomly) first edge must be the minimum weight edge that is chosen . Therefore, $(A,D)$ MUST be chosen BEFORE $(A,B)$. Therefore,  $C$ is FALSE.

• edited by
10 10 votes
There are two correct sequences

i) (A, D), (A, B), (A, C), (C, F), (F, G), (G, E)  (not given in the options)

ii) (A, D), (A, B), (D, F), (F, C), (F, G), (G, E)  Option- D
0 0 votes

 

Here 2 different Answers are possible .

 

in the first image we visited vertex $C$ firstly before vertex $F$ then we get the answer which does not match with anyone of them and this is wrong answer bcoz it makes cycle

iin the second image we visited vertex $F $  firstly before vertex  $C$ then we get the answer which does  match with option D 

 

so the final answer is option D

• edited by
Answer:
Position:
Show:

Related questions

38 38 votes
5 answers 5 answers
23.2k
23.2k views
Ishrat Jahan asked Oct 28, 2014
23,161 views
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­n...
33 33 votes
5 answers 5 answers
9.5k
9.5k views
Ishrat Jahan asked Nov 2, 2014
9,452 views
Consider a list of recursive algorithms and a list of recurrence relations as shown below. Each recurrence relation corresponds to exactly one algorithm and is used to de...
62 62 votes
7 answers 7 answers
23.0k
23.0k views
Ishrat Jahan asked Nov 2, 2014
22,975 views
Let $f(n)$, $g(n)$ and $h(n)$ be functions defined for positive integers such that $f(n) = O(g(n))$, $g(n) \neq O(f(n))$, $g(n) = O(h(n))$, and $h(n) = O(g(n))$.Which one...
1 1 vote
1 answers 1 answer
1.2k
1.2k views
Debargha Mitra Roy asked Aug 25, 2024
1,232 views
Which of the statement is/are correct?(a) First edge added by Kruskal’s algorithm can be the last edge added by prim’s algorithm(b) In a graph, if one raises the length o...