Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

( 5 0 ) [ Prim ' s MST algorithm: tracing ] Run the Prim's algorithm implemented using a priority queue ( see below )

(50)[Prim's MST algorithm: tracing] Run the Prim's algorithm implemented using a
priority queue (see below) against the graph shown below. Give your answers as follows.
a) Run the algorithm assuming the node a is picked as the start node s, and show the algorithm
run trace (see the specification below).
b) Run the algorithm assuming the node g is picked as the start node s, and show the algorithm
run trace (see the specification below).
c) Draw the resulting minimum spanning tree on the graph. Show the included edges in colored
or thick lines.
Specification of the algorithm run tracing: For each algorithm run tracing, show the content of
the cut S, the content of the MST T, and the content of the priority queue Q at the end of the
While loop in each iteration. Specifically, show the content of S as a set of nodes, the content of
T as a set of edges, and the content of Q as a set of ordered pairs of a node number and a priority
key. (For ease of grading, please show the end nodes of an edge in the alphabetical order (e.g.,
(a,d)), and list the priority queue elements in the alphabetic order of node number.) For example,
when the start node is a, their contents before the 1st iteration is S={},T={}, and ,
(b,),(c,),(d,),(e,),(f,),(g,).
Initialize Q of V with (v)larr for each node v in V.
Pick an arbitrary node as the start node s.
Slarr{},Tlarr{},(s)larr0.
while (Q is not empty)
v=ExtractMin(Q).
Add v to S.
if vs then add the edge (pred(v),v) to T.// pred -= "predecessor"
for each edge e=(v,w) such that w!inS
if (ce(w)){
(w)=ce,pred(w)=v.
ChangeKey(Q, w,(w).
}
}
endwhile
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Essential Data Protection For Estate Agencies In Singapore 2024

Authors: Yang Yen Thaw Yt

1st Edition

B0CQK79WD3, 979-8872095392

More Books

Students also viewed these Databases questions

Question

ln represents what mathematical function?

Answered: 1 week ago

Question

3. Identify opportunities to improve this process.

Answered: 1 week ago