Adjacency Matrix of Graph(图的邻接矩阵)

本文档提供了一个使用C++模板类实现的图的邻接矩阵头文件,包括构造函数、获取顶点数量、边权重、邻接节点等功能。同时,支持插入、删除顶点和边的操作。
摘要由CSDN通过智能技术生成
//本文件是图的邻接矩阵的头文件,使用C++模板类封装(This file is the header file of adjacency matrix of graph,and packed by C++ template class)
#ifndef MGRAPH_H
#define MGRAPH_H
#include <iostream>
#include "SeqList.h"	//“SeqList.h”为我的博客里的一片文章,同在“证明我学过数据结构的痕迹”分类里
using namespace std;

#define MAXINT 1<<32-1
const int MaxGraphSize=1;

template <class T>
class MGraph
{
	public:
    		//Constructor
		MGraph(void);
		
		//Data access functions
		int NumberOfVertices(void) const;
		int GetWeight(const T& vertex1,const T& vertex2);
		int GetFirstNeighbor(const int v);
		int GetNextNeighbor(const int v1,const int v2);
		SeqList<T> 	GetVertex(int v);								
		SeqList<T>& GetNeighbors(const T& vertex);	
		
		//The update funtion of graph
		void InsertVertex(const T& vertex);
		void InsertEdge(const T& vertex1,const T& vertex2,int weight);
		void DeleteVertex(const T& vertex);
		void 
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值