In Prim's algorithm for finding a minimum spanning tree (MST), what is the main criterion for selecting the next edge to add to the growing MST?
Think about how Prim's algorithm grows the tree step by step.
Prim's algorithm always adds the smallest edge that connects the current MST to a new vertex outside it, ensuring the tree grows with minimum total weight.
Which of the following statements about the starting point of Prim's algorithm is true?
Consider if the choice of starting vertex affects the final MST.
Prim's algorithm can start from any vertex; the MST found will have the same total weight regardless of the starting point in a connected graph.
Given the following weighted graph edges and starting vertex A, what is the correct order of edges added by Prim's algorithm?
A-B: 2 A-C: 3 B-C: 1 B-D: 4 C-D: 5
Remember Prim's algorithm always picks the smallest edge connecting the MST to a new vertex.
Starting at A, the edges chosen in order are A-B (2), B-C (1), B-D (4), and A-C (3) is not chosen because C is already connected.
Which of the following statements correctly compares Prim's and Kruskal's algorithms for finding a minimum spanning tree?
Think about how each algorithm selects edges and builds the MST.
Prim's algorithm grows the MST from a starting vertex by adding the smallest edge connecting to new vertices. Kruskal's algorithm sorts all edges by weight and adds them if they don't form a cycle, regardless of connectivity.
Consider a connected undirected graph with some negative edge weights. What will be the effect of these negative weights on the minimum spanning tree found by Prim's algorithm?
Think about how Prim's algorithm chooses edges based on weight, regardless of sign.
Prim's algorithm works with any edge weights, including negative ones, because it always picks the smallest edge connecting the MST to a new vertex. Negative edges can be included if they help minimize total weight.