Prim grows a tree from a start node instead of scanning the full edge list. On this distinct-weight graph, it reaches the same unique MST that Kruskal found.

highlighted = computed this step

Grow from A

Prim adds 5 edges starting from A. Motivation: Prim keeps one connected visited set and grows it by the cheapest exact crossing edge.

Prim additions=5\text{Prim additions}=5
Prim and Kruskal agree123456789ABCDEF

Same total

The Prim tree total is 19. Why: the recomputed edge set is identical to Kruskal's MST edge set, even though the decision order is different.

w(TPrim)=19w(T_{\text{Prim}})=19
Prim and Kruskal agree123456789ABCDEF

Unique tree

Interpretation: distinct weights make the MST unique in this instance, so two different greedy procedures land on the same certified tree.

distinct weightssame MST here\text{distinct weights}\Rightarrow \text{same MST here}
Prim and Kruskal agree123456789ABCDEF

Diagram note

Certificate note: the graph marks the recomputed tree edge role; Prim order and Kruskal order are different procedures with the same final tree here. Pixel positions are rounded for layout; every number shown is exact.

same tree, same total\text{same tree, same total}
Prim and Kruskal agree123456789ABCDEF