//本文件是图的邻接矩阵的头文件,使用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 DeleteEdge(const T& vertex1,const T&am
Adjacency Matrix of Graph(图的邻接矩阵)
最新推荐文章于 2025-09-12 20:44:53 发布
本文档提供了一个使用C++模板类实现的图的邻接矩阵头文件,包括构造函数、获取顶点数量、边权重、邻接节点等功能。同时,支持插入、删除顶点和边的操作。
开发板推荐:天空星STM32F407VET6开发板
超高性价比 STM32主控 | 超高主频 | 一板兼容百芯 | 比赛神器 | 沉金彩色丝印
开发板推荐:天空星STM32F407VET6开发板
超高性价比 STM32主控 | 超高主频 | 一板兼容百芯 | 比赛神器 | 沉金彩色丝印


1万+

被折叠的 条评论
为什么被折叠?



