Question: Consider the following algorithm which seeks to find a minimum spanning tree in a connected graph with positive weights on its edges. We start a
Consider the following algorithm which seeks to find a minimum spanning tree in a connected graph with positive weights on its edges. We start a modified version of DFS from an arbitrary node, initialize T and continue as follows:
A: From u the node where DFS currently is construct N the list of neighbors of u sorted by nondecreasing weight.
Find the first node v in N such that v has not already been visited.
If such a node does not exist backtrack.
else if such a node does exist
Add u v to T Mark v as visited. If T is n return T else move oto v and go to A
Does this algorithm always find a minimum spanning tree? Explain or give a counterexample.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
