正在加载图片...
Kruskal algorithm Algorithm 8.3 Kruskal Input: A weighted connected undirected graph G=(V, E)with n vertIces Output: The set of the edges T of a minimum cost spanning tree fo g 1. Sort the edges in E by nondecreasing weigh 2. for each vertex v E V do Makeset((v)) end for 3.T= 4. while T<n-1 5. Let(x,y) be the next edge in E 6. if Find(x)*Find(y)then 7. Add(x, y) to T 8. Union(x, y) end if (mlog 10. end whileKruskal algorithm
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有