The minimum spanning tree of the graph

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.