- 118
- 0
- 约3.37千字
- 约 9页
- 2016-10-20 发布于湖北
- 举报
实验目的掌握。
克鲁斯卡尔算法
#includestdio.h
#includestdlib.h
#define M 20
#define MAX 20
typedef struct
{
int begin;
int end;
int weight;
}edge;
typedef struct
{
int adj;
int weight;
}AdjMatrix[MAX][MAX];
typedef struct
{
AdjMatrix arc;
int vexnum, arcnum;
}MGraph;
void CreatGraph(MGraph *);
void sort(edge* ,MGraph *);
void MiniSpanTree(MGraph *);
int Find(int *, int );
void Swapn(edge *, int, int);
void CreatGraph(MGraph *G)
{
int i, j,n, m;
printf(请输入边数和顶点数:);
scanf(%d %d,G-arcnum,G-vexnum);
for (i = 1; i = G-vexnum; i++)
{
for ( j = 1; j = G-vexnum; j++)
{
G-arc[i
原创力文档

文档评论(0)