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

📄 main.cpp

📁 清华大学计算机系数据结构课程教材《数据结构 用面向对象方法和C++描述》(殷人昆主编)的类库(书中程序的源代码)
💻 CPP
字号:
#include"MinSpanTree.h"
int main()
{
	cout<<"输入图:"<<endl;
	Graphlnk<char,int> g;
	g.input();
	cout<<endl;
	cout<<"生成最小生成树:"<<endl;
	MinSpanTree<char,int> tree;
	Kruskal(g,tree);
	cout<<"最小生成树为:"<<endl;
	tree.output();
		cout<<"测试完毕"<<endl;

	while(1)//为了在类库说明文档中便于观察,加入这一句
		cout<<"";
	return 0;
}

/*
输入示例:

输入图:
Please input the number of vertexs :5

Please input the value of each vertex :
Vertex 0 : a
Vertex 1 : b
Vertex 2 : c
Vertex 3 : d
Vertex 4 : e

Please input the number of edges :4

Please input these edges :  (i , j,  weight of Eij)
Edge 0 : 1 2 12

Edge 1 : 2 3 5

Edge 2 : 3 4 24

Edge 3 : 4 5 4
Input error!
Edge 3 : 0 1 3


生成最小生成树:
最小生成树为:
Edge 1 : head = 1 ; tail = 0 ; key = 3
Edge 2 : head = 3 ; tail = 2 ; key = 5
Edge 3 : head = 2 ; tail = 1 ; key = 12
Edge 4 : head = 4 ; tail = 3 ; key = 24
请按任意键继续. . .
*/

⌨️ 快捷键说明

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