用prim算法和Kruskal算法求最小生成树,不要原代码要过程.
来源:学生作业帮 编辑:大师作文网作业帮 分类:数学作业 时间:2024/11/06 15:38:58
用prim算法和Kruskal算法求最小生成树,不要原代码要过程.
V: {1,2,3,4,5,6,7}
E: {a:(1,2):50, b:(1,3):60,
c:(2,4):65, d:(2,5):40,
e:(3,4):52, f:(3,7):45,
g:(4,5):50, h:(4,6):30, i:(4,7):42,
j:(5,6):70}kruskal0: V={{1},{2},{3},{4},{5},{6},{7}}, E={},
pick 1st from {h,d,i,f,a,g,e,b,c,j}
1: V={{1},{2},{3},{4,6},{5},{7}}, E={h},
pick 1st from {d,i,f,a,g,e,b,c,j}
2: V={{1},{2,5},{3},{4,6},{7}}, E={h,d},
pick 1st from {i,f,a,g,e,b,c,j}
3: V={{1},{2,5},{3},{4,6,7}}, E={h,d,i},
pick 1st from {f,a,g,e,b,c,j}
4: V={{1},{2,5},{3,4,6,7}}, E={h,d,i,f},
pick 1st from {a,g,b,c,j}
5: V={{1,2,5},{3,4,6,7}}, E={h,d,i,f,a},
pick 1st from {g,b,c,j}
6: V={{1,2,5,3,4,6,7}}, E={h,d,i,f,a,g}, pick 1st from {}
#: final V={1,2,5,3,4,6,7}, E={h,d,i,f,a,g}primVstart = 1
0: V={1}, E={}, pick 1st from {a,b}
1: V={1,2}, E={a}, pick 1st from {d,b,c}
2: V={1,2,5}, E={a,d}, pick 1st from {g,b,c,j}
3: V={1,2,5,4}, E={a,d,g}, pick 1st from {h,i,e,b}
4: V={1,2,5,4,6}, E={a,d,g,h}, pick 1st from {i,e,b}
5: V={1,2,5,4,6,7}, E={a,d,g,h,i}, pick 1st from {e,b}
6: V={1,2,5,4,6,7,3}, E={a,d,g,h,i,e}.
E: {a:(1,2):50, b:(1,3):60,
c:(2,4):65, d:(2,5):40,
e:(3,4):52, f:(3,7):45,
g:(4,5):50, h:(4,6):30, i:(4,7):42,
j:(5,6):70}kruskal0: V={{1},{2},{3},{4},{5},{6},{7}}, E={},
pick 1st from {h,d,i,f,a,g,e,b,c,j}
1: V={{1},{2},{3},{4,6},{5},{7}}, E={h},
pick 1st from {d,i,f,a,g,e,b,c,j}
2: V={{1},{2,5},{3},{4,6},{7}}, E={h,d},
pick 1st from {i,f,a,g,e,b,c,j}
3: V={{1},{2,5},{3},{4,6,7}}, E={h,d,i},
pick 1st from {f,a,g,e,b,c,j}
4: V={{1},{2,5},{3,4,6,7}}, E={h,d,i,f},
pick 1st from {a,g,b,c,j}
5: V={{1,2,5},{3,4,6,7}}, E={h,d,i,f,a},
pick 1st from {g,b,c,j}
6: V={{1,2,5,3,4,6,7}}, E={h,d,i,f,a,g}, pick 1st from {}
#: final V={1,2,5,3,4,6,7}, E={h,d,i,f,a,g}primVstart = 1
0: V={1}, E={}, pick 1st from {a,b}
1: V={1,2}, E={a}, pick 1st from {d,b,c}
2: V={1,2,5}, E={a,d}, pick 1st from {g,b,c,j}
3: V={1,2,5,4}, E={a,d,g}, pick 1st from {h,i,e,b}
4: V={1,2,5,4,6}, E={a,d,g,h}, pick 1st from {i,e,b}
5: V={1,2,5,4,6,7}, E={a,d,g,h,i}, pick 1st from {e,b}
6: V={1,2,5,4,6,7,3}, E={a,d,g,h,i,e}.
Kruskal算法和Prim算法构造它的一棵最小代价生成树的过程
如图所示为一个无向带权图,请分别按照Prim算法和Kruskal算法求最小生成树
急求KRUSKAL算法求最小生成树过程演示
数据结构课程设计用Kruskal 算法求最小生成树
用普里姆(Prim)或克鲁斯卡尔(Kruskal)算法画出下列无向网的最小生成树
求最小生成树 利用Kruskal算法求图G的一棵最小生成树T,用c语言
利用Prim(普里姆)算法 构造最小生成树 程序
如何证明用 Kruskal's 算法生成的树是最小生成树
数据结构与算法:请使用Kruskal算法求出下图的最小生成树
对于以下无向带权图.利用Prim算法,从V1出发,得到最小生成树的过程中,
求一个源代码要求显示图的邻接矩阵图的邻接表,深度广度优先遍历最小生成树PRIM算法KRUSCAL算法图的连通分
最小生成树 普里姆算法和克鲁斯卡尔算法