(1) The figure has 6 vertex v1-v6, each edge of the Benquan value is on the graph, in the prim algorithm, I randomly select a vertex as the starting point, of course, we generally choose V1 as the starting point, OK, now we set the U set for the currently found in the smallest spanning tree vertex, TE set as the found edge, Now the status is as follows:
U={V1}; te={};
(2) Now find a vertex in the U set, the other vertex in the V-u collection of the minimum weight, such as, the Red Line intersection of the lines to find the minimum value.
In the figure we can see that the weight of the edge v1-v3 is at least 1, then the V3 is added to the U set, (v1,v3) joins the TE, the state is as follows:
U={V1,V3}; te={(V1,v3)};
(3) Continue to look for, now the status is U={v1,v3}; te={(V1,v3)}; finds the minimum value on the edge that intersects the red line.
We can find the minimum weight of (V3,V6) = 4, then we add the V6 to the U set and add the smallest edge to the Te collection, then the join state is as follows:
U={V1,V3,V6}; te={(V1,v3), (V3,V6)}; So loop until all vertices are found.
(4) Like we showed all the search process:
Minimum spanning Tree prim