-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
43 lines (35 loc) · 869 Bytes
/
main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#include "mainwindow.h"
#include <QApplication>
#include <QFile>
//#include "graph.h"
#include <QtDebug>
// Boruvka's algorithm to find Minimum Spanning
// Tree of a given connected, undirected and
// weighted graph
#include <stdio.h>
#include <iostream>
#include <fstream>
using namespace std;
Graph* createGraph(int V, int E)
{
Graph* graph = new Graph;
graph->V = V;
graph->E = E;
graph->edge = new Edge[E];
return graph;
}
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
ifstream f("testGraph.txt");
int n, e;
f>>n>>e;
Graph* graph = createGraph(n, e);
for(int i = 0; i<e; i++){
f>>graph->edge[i].src>>graph->edge[i].dest>>graph->edge[i].weight;
qDebug()<<graph->edge[i].src<<" - "<<graph->edge[i].dest<<" added";
}
MainWindow w(graph);
w.show();
return a.exec();
}