Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
L
Lab016
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
问题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
银宸时代
DS Lab Group
实验项目模板
Lab016
提交
94c68002
提交
94c68002
5月 21, 2019
创建
作者:
宋海霞
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
modify
上级
abb026f2
显示空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
26 行增加
和
26 行删除
+26
-26
Graph.h
Graph.h
+15
-15
Queue.h
Queue.h
+11
-11
没有找到文件。
Graph.h
浏览文件 @
94c68002
...
@@ -3,46 +3,46 @@
...
@@ -3,46 +3,46 @@
//
//
//
在此处包含 C 标准库头文件
//
Include the C standard library header file here
//
//
#include <stdio.h>
#include <stdio.h>
//
//
//
在此处包含其他头文件
//
Other header files are included here
//
//
#include "Queue.h"
#include "Queue.h"
//
//
//
在此处定义数据结构
//
Define the data structure here
//
//
#define MAX_VERTEX_NUM 50 //
顶点最大数量
#define MAX_VERTEX_NUM 50 //
Maximum number of vertices
//
边(弧)
//
Edge (arc)
typedef
struct
ArcNode
{
typedef
struct
ArcNode
{
int
vertex
;
//
顶点域。即顶点在顶点数组中的下标。
int
vertex
;
//
Vertex field. That is, the index of the vertex in the vertex array.
struct
ArcNode
*
next
;
//
链域。指向下一条边(弧)。
struct
ArcNode
*
next
;
//
Chain domain. Point to the next Edge (arc).
}
ArcNode
;
}
ArcNode
;
//
顶点
//
vertex
typedef
struct
VexNode
{
typedef
struct
VexNode
{
const
char
*
name
;
//
使用一个字符串作为顶点保存的值。也可以认为是顶点的名字。
const
char
*
name
;
//
Use a string as the vertex's stored value. You can also think of it as the vertex's name.
struct
ArcNode
*
firstarc
;
//
指向第一条边(弧)。
struct
ArcNode
*
firstarc
;
//
Pointing to the first side (arc).
}
VexNode
;
}
VexNode
;
//
图。使用邻接表存储
//
Graph. Use adjacency list storage
typedef
struct
Graph
{
typedef
struct
Graph
{
VexNode
vexlist
[
MAX_VERTEX_NUM
];
//
顶点表
VexNode
vexlist
[
MAX_VERTEX_NUM
];
//
Vertex table
int
length
;
//
顶点数量
int
length
;
//
Vertex number
}
Graph
;
}
Graph
;
//
//
//
在此处声明函数
//
Declare the function here
//
//
void
BreadthFirstSearch
(
Graph
*
pGraph
);
void
BreadthFirstSearch
(
Graph
*
pGraph
);
...
@@ -51,7 +51,7 @@ void DeleteGraph(Graph* pGraph);
...
@@ -51,7 +51,7 @@ void DeleteGraph(Graph* pGraph);
//
//
//
在此处声明全局变量
//
Declare global variables here
//
//
extern
int
visited
[
MAX_VERTEX_NUM
];
extern
int
visited
[
MAX_VERTEX_NUM
];
extern
Queue
queue
;
extern
Queue
queue
;
...
...
Queue.h
浏览文件 @
94c68002
...
@@ -3,34 +3,34 @@
...
@@ -3,34 +3,34 @@
//
//
//
在此处包含 C 标准库头文件
//
Include the C standard library header file here
//
//
//
//
//
在此处包含其他头文件
//
Other header files are included here
//
//
//
//
//
在此处定义数据结构
//
Define the data structure here
//
//
#define MAX_QUEUE_LENGTH 64 //
队列最大长度
#define MAX_QUEUE_LENGTH 64 //
Maximum queue length
//
环形队列
//
circle queue
typedef
struct
Queue
{
typedef
struct
Queue
{
int
buffer
[
MAX_QUEUE_LENGTH
];
//
队列缓冲区
int
buffer
[
MAX_QUEUE_LENGTH
];
//
queue buffer
int
begin
;
//
开始位置
int
begin
;
//
starting position
int
end
;
//
结束位置
int
end
;
//
end position
int
length
;
//
队列长度
int
length
;
//
queue size
}
Queue
;
}
Queue
;
//
//
//
在此处声明函数
//
Declare the function here
//
//
void
InitQueue
(
Queue
*
pQ
);
void
InitQueue
(
Queue
*
pQ
);
...
@@ -40,7 +40,7 @@ int QueueEmpty(Queue* pQ);
...
@@ -40,7 +40,7 @@ int QueueEmpty(Queue* pQ);
//
//
//
在此处声明全局变量
//
Declare global variables here
//
//
...
...
编写
预览
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论