⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 graphtest.cpp

📁 里面包含各种数据结构方面的知识,如链表,树,图等 含有vc代码
💻 CPP
字号:
#include <iostream.h>
#include <stdlib.h>

typedef char VerT;
typedef char DataType;	
const int MaxVertices = 100;
const int MaxWeight = 9999;
	
#include "AdjMWGraph.h"
#include "Prim.h"
#include "CreatAdjMWGraph.h"

void main(void)
{
	AdjMWGraph g;
	char a[] = {'A','B','C','D','E','F','G'};
	RowColWeight rcw[] = {{0,1,50},{1,0,50},{0,2,60},{2,0,60},{1,3,65},
						{3,1,65},{1,4,40},{4,1,40},{2,3,52},{3,2,52},
						{2,6,45},{6,2,45},{3,4,50},{4,3,50},{3,5,30,},
						{5,3,30},{3,6,42},{6,3,42},{4,5,70},{5,4,70}};
	int n = 7, e = 20;

	CreatGraph(g, a, n, rcw, e);				//创建图8-10

	MinSpanTree closeVertex[7];
	Prim(g, closeVertex);						//调用Prim函数

	cout << "顶点值 = " << closeVertex[0].vertex << endl;
	for(int i = 1; i < n; i++)
		cout << "顶点值 = " << closeVertex[i].vertex 
			<< "  边的权值 = " << closeVertex[i].weight << endl;
}

⌨️ 快捷键说明

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