Final answer:
The question requires finding the minimum cost spanning tree for a given weighted graph using Kruskal's and Prim's algorithm. Both algorithms have specific steps involving the selection of edges based on the lowest weights, ensuring no cycles are formed. The minimum cost is the sum of the weights of the edges in the MST.
Step-by-step explanation:
The given matrix represents the adjacency matrix of a weighted graph where the elements represent the weights of the edges connecting the vertices. To find the minimum cost spanning tree (MST) using both Kruskal's algorithm and Prim's algorithm, we start with the algorithm for finding the MST that involves selecting edges based on their weights while avoiding the formation of cycles.Kruskal's Algorithm:Steps for Kruskal's algorithm include:Sort all the edges in non-decreasing order of their weight.Pick the smallest edge. Check if it forms a cycle with the spanning tree formed so far. If a cycle is not formed, include this edge. Otherwise, discard it.Repeat step 2 until there are (V-1) edges in the spanning tree, where V is the number of vertices.
Follow these steps, incrementally adding edges based on their weights to form the MST, making sure not to include an edge that would create a loop.Prim's Algorithm:Steps for Prim's algorithm include:Start with any vertex as a single-vertex tree.At each step, add the minimum weight edge that connects a vertex in the tree with a vertex outside the tree to the tree.Repeat step 2 until the tree spans all the vertices.With both algorithms, we continue this process until we cover all vertices.The minimum cost is the sum of the weights of the edges included in the MST. This cost is the same regardless of whether Kruskal's or Prim's algorithm is used, as both algorithms find an MST of the graph.