运行结果正确
用邻接表来表示图要创造的结构体太多了,我感觉其实有更简单的结构体来表示图。
#include<stdio.h>
#include <stdlib.h>
#include <string.h>
#include<malloc.h>
//创建邻接表
//这个边的数据结构是用来给我们输入使用的
typedef struct se_node *se_point;
struct se_node{
int v1,v2;
int weight;
} ;
//创建邻接表的边
typedef struct e_node *e_point;
struct e_node{
int indx;
int weight;
e_point next;
};
//创建邻接表的顶点
typedef struct v_node *v_point;
struct v_node{
e_point first_edge;
int date;
};
//创建邻接表的图
typedef struct g_node *g_point;
struct g_node{
int v_num;
int e_num;
struct v_node list[100];