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

📄 adj.h

📁 数据结构中图的设计。这是图的邻接矩阵的存储结构。
💻 H
字号:
typedef char VerT;
typedef int DistT;
const int MaxVertices=100;
struct Edge
{
	int dest;
	DistT weight;
	Edge* next;
	Edge(){}
	Edge(int d,DistT w ):dest(d),weight(w),next(NULL){}
};
struct item
{
	VerT data;
	Edge* adj;
};
class AdjTWGraph
{
private:
	item Vertices[MaxVertices];
	int numVertices;
	int numOfEdges;
public:
	AdjTWGraph();
	~AdjTWGraph();
	int GraphEmpty()const
	{
		return numVertices==0;
	}
	int NumOfVertices()
	{
		return numVertices;
	}
	int NumOfEdges()
	{
		return numOfEdges;
	}
	VerT GetValue(const int i);
	int GetWeight(const int v1,const int v2);
	void InsertVertex(const VerT&vertex);
	void InsertEdge(const int v1,const int v2,int weight);
	void DeleteVertex(const int v);
	void DeleteEdge(const int v1,const int v2);
	int GetFirstNeighbor(const int v);
	int GetNextNeighbor(const int v1,const int v2);
	void DepthFirstSearch(const int v,int visited[],void visit(VerT item));
	void DepthFirstSearch(void visit(VerT item));
	void BroadFirstSearch(const int v,int visited[],void visit(VerT item));
	void BroadFirstSearch(void visit(VerT item));
};

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -