#ifdef _MSC_VER
#pragma warning(disable:4786)
#endif// _MSC_VER
#include
#include
#include
#include
using namespace std;
#include "d_graph.h"
©int main()
{
ifstream graphIn;
graph g, minSpan;
int weight;
string fileName;
cout << "Graph input 文件: ";
cin >> fileName;
graphIn.open(fileName.c_str());
if (!graphIn)
{
cerr << "Cannot open ';" << fileName << "';" << endl;
exit(1);
}
graphIn >> g;
weight = minSpanTree(g, minSpan);
cout << "MST has weight "<< weight << endl << endl;
cout << " --- MST Graph ---" << endl;
cout << minSpan << endl;
return 0;
} |