graph.h
来自「数据结构作业图的一些集合 上面有优先遍历 和用链表和堆栈来实现的算法」· C头文件 代码 · 共 46 行
H
46 行
#include"Link.h"
#include"Queue.h"
const int MaxGraphSize=25;
class Graph
{
private:
Link VertexLink;
Queue aqueue;
int GraphSize; //最大可存储量
int CurSize; //当前节点数
int EdgeSize;
int Edge[MaxGraphSize][MaxGraphSize];
int visited[MaxGraphSize];
int GetVertexPos(const char & aName);
bool FindVertex(const char & aName);
void GetVertex(const int & item);
public:
//生成与构造
Graph(const int Size=MaxGraphSize);
~Graph();
//度
void GetDegree(); //无向图使用
void InDegree(); //有向图使用
void OutDegree();
//判断图的满、空
bool GraphEmpty();
bool GraphFull();
//返回指定边的权值
int GetWeight(const char & aName,const char & anotherName);
//邻接顶点的寻找
int GetFirstNeighbor(const int & item);
int GetNextNeighbor(const int & item,const int & temp);
//修改图的方法
void InsertVertex(const char & aName);
void InsertEdge(const char & aName,const char & anotherName,int weight);
void DeleteVertex(const char & aName);
void DeleteEdge(const char & aName,const char & anotherName);
//遍历函数
void DepthFirstSearch(const int & item,int visited[] );
void DepthFirstSearch();
void BreadthFirstSearch();
// void TopoOrder();
//应用
// int MinimumPath(const char & startv,const char & endv);
};
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?