1
0
mirror of https://github.com/Didnelpsun/CS408.git synced 2026-11-05 06:37:40 +08:00

图更新

This commit is contained in:
Didnelpsun
2021-04-29 23:40:42 +08:00
parent f9b9485245
commit f59d102b0f
4 changed files with 241 additions and 17 deletions

View File

@@ -143,11 +143,11 @@
<ClCompile Include="main.c" />
<ClCompile Include="sequence_tree.h" />
<ClCompile Include="sequence_stack.h" />
<ClCompile Include="sequence_tree.cpp" />
<ClCompile Include="thread_tree.h" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="double_link_list.h" />
<ClInclude Include="graph.h" />
<ClInclude Include="link_list.h" />
<ClInclude Include="link_queue.h" />
<ClInclude Include="link_stack.h" />

27
Code/graph.h Normal file
View File

@@ -0,0 +1,27 @@
#include <stdio.h>
#include <stdlib.h>
#include "head.h"
// 邻接矩阵图
typedef struct {
// 顶点表
element_type vex[MAXSIZE];
// 邻接矩阵,边表
int edge[MAXSIZE][MAXSIZE];
// 图当前的顶点数和边数/弧数
int vex_num, arc_num;
} AdjacencyMatrixGraph;
// 邻接表结点
typedef struct AdjacencyListNode {
// 顶点信息
element_type vex;
// 第一条边
AdjacencyListNode* first;
} AdjacencyListNode, AdjacencyList[MAXSIZE];
// 邻接表
typedef struct {
AdjacencyList data;
int vex_num, arc_num;
} AdjacencyListGraph;

View File

@@ -1,4 +1,5 @@
// 初始化最大长度
#define MAXSIZE 25
#define DEFAULTELEM 0
#define INFINITY 32767
typedef char element_type;