7. As shown in the following figures, Prim's algorithm is usually used to find the minimum spanning tree, in which the i

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

7. As shown in the following figures, Prim's algorithm is usually used to find the minimum spanning tree, in which the i

Post by answerhappygod »

7 As Shown In The Following Figures Prim S Algorithm Is Usually Used To Find The Minimum Spanning Tree In Which The I 1
7 As Shown In The Following Figures Prim S Algorithm Is Usually Used To Find The Minimum Spanning Tree In Which The I 1 (53.25 KiB) Viewed 35 times
7. As shown in the following figures, Prim's algorithm is usually used to find the minimum spanning tree, in which the intermediate set of edges X always forms a subtree, and S is chosen to be the set of this tree's vertices. On each iteration, the subtree defined by X grows by one edge, namely the lightest edge between a vertex in S and a vertex outside S. Draw a table to show the changes of cost and prev values, and construct the final Minimum Spanning Tree. (15) 8 4 A F 2 2 2 D 1 2 10 G B 16 E H 2 procedure prim (G,w) Input: A connected undirected graph G=(V.E) with edge weights we Output: A minimum spanning tree defined by the array prev for all we V cost(N) = x prev(s)-nil Pick any initial node a cost(m)-0 H-makequeue (V) (priority queue, using cost-values as keys) while H is not empty: e=deletemin(H) for each (r.) E. if cost(s) > wr, 2); cost(s) = (v.) prev(s) decreasekey(H.:)
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply