⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 graph.h

📁 数据结构作业图的一些集合 上面有优先遍历 和用链表和堆栈来实现的算法
💻 H
字号:
#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 + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -