邻接表的c++
#define maxSize 5
#define INFINITY 10000 //代表无穷
typedef char Vertex;//节点类型
typedef int edge;//边上权值类型
//边节点
class edgeNode
{
public:
edgeNode();
~edgeNode();
int adjvex;
edge weight;
edgeNode *next;
private:
};
edgeNode::edgeNode()
{
adjvex = -1;
weight = -1;
next = NULL;
}
edgeNode::~edgeNode()
{
}
//顶点节点
class vertexNode
{
public:
vertexNode();
~vertexNode();
int subscript;//下标
Vertex data;
edgeNode *firstEdge;
private:
};
vertexNode::vertexNode()
{
data = '0';
firstEdge = NULL;
}
vertexNode::~vertexNode()
{
}
class graphList
{
public:
graphList(int numVertxnode, int numEdgenode);
~graphList();
void addEdge(int v1, int v2, int weight);//添加节点
void display();
void Dijkstra(int choose);
void Dijkstra_2();
vertexNode vertxnode[maxSize];//头节点顺序表
int numVertxnode, numEdgenode;//节点数目、边数
private:
};
graphList::graphList(int numVertxnode,