1. There are two algorithms for finding the minimum spanning tree of graphs
1) Primm algorithm (from vertex)
650) this.width=650; "src=" http://img.blog.csdn.net/20150719160453379 "alt=" write a picture describing "title="/>
The first step:
Starting at vertex 0, find the vertex with the least weight between 0 and 2, then make the vertex 1 and 2 a set of 1;
Step Two:
In Set 1, find the vertex with the lowest weight of each vertex, minus the weight of 6 to get:
650) this.width=650; "src=" http://img.blog.csdn.net/20150719161629263 "alt=" here write a picture describing "title=" "/>
Step Three:
650) this.width=650; "src=" http://img.blog.csdn.net/20150719161759982 "alt=" here write a picture describing "title=" "/>
Fourth Step:
650) this.width=650; "src=" http://img.blog.csdn.net/20150719161905378 "alt=" here write a picture describing "title=" "/>
Fifth Step:
650) this.width=650; "src=" http://img.blog.csdn.net/20150719161950677 "alt=" here write a picture describing "title=" "/>
2) Kruskal algorithm (start from the side, select the edge with the small weight)
650) this.width=650; "src=" http://img.blog.csdn.net/20150719162303372 "alt=" here write a picture describing "title=" "/>
The first step:
Select an edge with the lowest weight
650) this.width=650; "src=" http://img.blog.csdn.net/20150719162416373 "alt=" here write a picture describing "title=" "/>
Step Two:
650) this.width=650; "src=" http://img.blog.csdn.net/20150719162611955 "alt=" here write a picture describing "title=" "/>
Step Three:
650) this.width=650; "src=" http://img.blog.csdn.net/20150719162701636 "alt=" here write a picture describing "title=" "/>
Fourth Step:
650) this.width=650; "src=" http://img.blog.csdn.net/20150719162742251 "alt=" here write a picture describing "title=" "/>
Fifth Step:
650) this.width=650; "src=" http://img.blog.csdn.net/20150719162904904 "alt=" here write a picture describing "title=" "/>
2. Notes
The tree is not formed ring, the figure is some;
This article is from the "Sanghaidan blog column" blog, please be sure to keep this source http://10602803.blog.51cto.com/10592803/1683048
The minimum spanning tree of the graph