/*
数据结构——无向图(邻接表表示法)
*/
#include<iostream>
#define maxsize 100
using namespace std;
typedef char vextype;
typedef struct arcnode{
//定义边的结构体
int location;
arcnode* next;
}ArcNode,*Arc;
typedef struct {
//定义顶点数组的结构体
vextype data; //data 存储顶点字符
ArcNode* firstarc; //ArcNode 类型指针 指向的结构体
}Graph[maxsize], Gnode;
int location(Graph G, char vex,int vexnum) {
//找出目标顶点的下标地址
int i = 0;
for (; i < vexnum;i++) {
if (G[i].data == vex) {
return i;
}
}
}
void printGraph(Graph G,
数据结构——无向图(邻接表表示)
最新推荐文章于 2023-09-08 06:15:00 发布