一、综述
1.minimum-spanning-tree problem
2.Kruskal's algorithm
In Kruskal's algorithm, the set A is a forest. The safe edge added to A is always a least-weight edge in the graph that connects two distinct components.
3.Prim's algorithm
In Prim's algorithm, the set A forms a single tree. The safe edge added to A is always a least-weight edge connecting the tree to a vertex not in the tree.
二、程序
1.Kruskal算法
#include <iostream>
#include <algorithm>
#include "UnionFindSet.h"
using namespace std;
#define N 14
#define M 9
//边
struct Edge
{
int start;