日常说明:首先博主也是菜鸟一枚,有错误欢迎大家指正。另外本博客所有的代码博主编写后均调试
通过。重要提醒!!!!博主使用的是VS2017,如果有低版本的小伙伴
最好新建空项目将此代码复制上去。
更多算法请关注我的算法专栏https://blog.youkuaiyun.com/column/details/20417.html
运行截图:
MinSpanTree.h
#pragma once
#pragma once
#include<iomanip>
#include<iostream>
using namespace std;
#define max_v_num 100
#define INFINITY 10000
#define max 100
typedef int Boolean;
Boolean visited[max];
template <class T>
class Mgraph
{
public:
Mgraph(int vexs_num, int edge_num);
int Prim(Mgraph<T>prim_tree,int start);
int weight(int i,