資源簡介
cfb306d3b29f6ff0efea7782df211587.c
代碼片段和文件信息
/*
輸入格式
6
a
b
c
d
e
f
0?1?2
0?2?31
0?3?22
0?4?13
0?5?8
1?2?29
2?4?20
4?5?26
3?5?15
1?3?17
*/
#include
#include“malloc.h“
#include
#define?MaxVerNum?100000
typedef?char?VertexType;
typedef?int?EdgeType;
typedef?struct{
VertexType?vexs[MaxVerNum];
EdgeType?edge[MaxVerNum][MaxVerNum];
int?ne;
}MGraph;
struct?edgeType{
int?uv;
int?w;
}t*edge;
void?CreateMGraph(MGraph?*g)
{
int?ijkw;
scanf(“%d“&g->n);
for(i=0;in;i++)
{
getchar();
scanf(“%c“&(g->vexs[i]));
}
scanf(“%d“&g->e);
for(i=0;in;i++)
for(j=0;jn;j++)
g->edge[i][j]=0;
for(k=0;ke;k++)
{
scanf(“%d%d%d“&i&j&w);
g->edge[i][j]=w;
g->edge[j][i]=w;
}
}
void?kruskal(MGraph?*g)
{
int?ijks1s2numve
- 上一篇:JM0256.docx
- 下一篇:h5文件與weights文件轉換工具.zip
評論
共有 條評論