minspantree.h

来自「校园导游图」· C头文件 代码 · 共 33 行

H
33
字号
/*#pragma once
#include "Graph.h"
#include "Sqlist.h"

extern const int MaxNumVertices;
extern CSqlist VerticesList;

class MSTEdgeNode
{			//最小生成树边结点的类声明
public:
	friend class MinSpanTree;
	int tail, head;				//两顶点位置
     int cost;					//边上的权值
};

class MinSpanTree {				//最小生成树的类定义
public:
   MinSpanTree ( int sz = MaxNumVertices-1 ) : MaxSize (sz), n (0)
   { edgeValue = new MSTEdgeNode[MaxSize]; }
   void Inser(MSTEdgeNode & item);
private:
   MSTEdgeNode *edgeValue;			//用边值数组表示树
   int MaxSize, n;				//数组的最大元素个数和当前个数
};
void MinSpanTree::Inser(MSTEdgeNode & item)//向生成树边值数组内存放
{
	   edgeValue[n].tail = item.tail;  
	   edgeValue[n].head = item.head;  
	   edgeValue[n].cost = item.cost;
	   //cost=cost+dist;	   
	   n++;
}
*/

⌨️ 快捷键说明

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