关于离散数学的问题关于求最小生成
#include
#define MAX_VERTEX_NUM 10
#define INFINITY 1000
typedef struct Edge
{
int weight;
}Edge, EdgeMatrix[MAX_VERTEX_NUM][MAX_VERTEX_NUM];
typedef struct MGraph
{
EdgeMatrix edges;
int vexnum;
int edgenum;
}MGraph;
typedef struct VexGroup
{
int vertex;
int group;
}VexGroup;
typedef ...全部
#include
#define MAX_VERTEX_NUM 10
#define INFINITY 1000
typedef struct Edge
{
int weight;
}Edge, EdgeMatrix[MAX_VERTEX_NUM][MAX_VERTEX_NUM];
typedef struct MGraph
{
EdgeMatrix edges;
int vexnum;
int edgenum;
}MGraph;
typedef struct VexGroup
{
int vertex;
int group;
}VexGroup;
typedef struct EdgeMuster
{
int tail;
int head;
int weight;
bool used;
}EdgeMuster;
void InitializeMG(MGraph &G)
{
G。
edgenum = G。vexnum = 0;
for(int i = 0; i \t\t%d\n", E[k]。tail, E[k]。head, E[k]。
weight);
}
}
void main()
{
MGraph G;
InitializeMG(G);
CreateGraph(G);
MiniSpanTree_Kruskal(G);
}
。收起