📄 dijkstra.h
字号:
/* DIJKSTRA_H start */
#ifndef DIJKSTRA_H
#define DIJKSTRA_H
#include <iostream.h>
#include <fstream.h>
/* Begin of class CGraph */
class CGraph {
public:
CGraph(unsigned size, unsigned v);//构造函数
~CGraph();//析构函数
bool Dijkstra();//计算最短路经
friend ostream& operator<<(ostream &stream, const CGraph &Graph);//重载<<
friend ifstream& operator>>(ifstream &fstream, CGraph &Graph);//重载>>
private:
int **m_Graph;//存储顶点信息
int *m_Dist;//存储源顶点到各个顶点的距离
unsigned *m_Prev;//存储源顶点到i的最短路经中,i的前一个顶点
bool *m_S;//存储已加入集合S的顶点
unsigned m_Size;//图的顶点数
unsigned m_SrcVector;//源顶点
};
/* End of class CGraph */
#endif
/* DIJKSTRA_H end */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -