Use Kruskal's algorithm to find a minimal spanning tree for the following graph and calculate the cost associated. In addition to the spanning tree, find the final rooted tree in the algorithm. When you merge two trees in the algorithm, make the root with the lower number the root of the new tree.
Algorithm 10.3.2: Kruskal's Algorithm 1. Sort the edges of G in ascending order according to weight. That is, is ją w(ej) <w(ej). 2. = 1. Initialize each vertex in V to be the root of its own rooted tree. 2. Go down the list of edges until either a spanning tree is completed or the edge list has been exhausted. For each edge e = = {v1, v2}, we can determine whether e can be added to the spanning set without forming a cycle by determining whether the root of vi's tree is equal to the root of vz's tree. If the two roots are equal, then ignore e. If the roots are different, then we can add e to the spanning set. In addition, we merge the trees that vi and v2 belong to. This is accomplished by either making vi's root the parent of v2's root or vice versa.
Use Kruskal's algorithm to find a minimal spanning tree for the following graph and calculate the cost associated. In ad
-
answerhappygod
- Site Admin
- Posts: 899604
- Joined: Mon Aug 02, 2021 8:13 am
Use Kruskal's algorithm to find a minimal spanning tree for the following graph and calculate the cost associated. In ad
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!