#include #define MAXLEAF 100 #define INF 100000 #define EDGENUMBER MAXLEAF*MAXLEAF/2 typedef int EdgeType; typedef int VertexType; typedef struct{ EdgeType val[MAXLEAF][MAXLEAF]; VertexType ves[MAXLEAF]; int v; int e; }MGraph; typedef struct{ int vex1,vex2; int w; }kedge; void creat_MGraph(MGraph *M){ int i,j,k; int w; printf(\"请输入图的顶点个数及边数:\\n\"); scanf(\"%d%d\ printf(\"请依次填充顶点信息:\\n\"); for(i=0;i printf(\"请依次输入图的边两个顶点顶点的权值:(格式:a b c)\\n\"); for(k=0;k VertexType kruskal(MGraph M){ int tag[MAXLEAF]; kedge Ke[EDGENUMBER]; int i,j; VertexType length=0; int n=0; for(i=0;i } int len; creat_MGraph(&M); printf(\"最小生成树:\\n\"); len=kruskal(M); printf(\"最小成本:%d\return 0; 因篇幅问题不能全部显示,请点此查看更多更全内容