-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
50 lines (38 loc) · 1.07 KB
/
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
44
45
46
47
48
49
50
#include <iostream>
#include "maxBigraphSolver.h"
#include "graphLoader.h"
#include "graph.h"
#include "edge.h"
using namespace std;
void DeleteGraphs(Graph * loadedGraph, Graph * resultGraph);
int main(int args, char * argv[])
{
cout << "Start of application. Number of arguments: " << args << endl;
if (args < 2) return 1;
GraphLoader loader;
MaxBigraphSolver solver;
/* LOAD GRAPH FROM FILE */
Graph * graph = loader.LoadGraph(argv[1]);
cout << "Loaded Graph: NumberOfEdges = " << graph->m_NumberOfEdgesOriginal << endl;
graph->Print();
/* GET MAX BIPARTHITE GRAPH */
Graph * result = solver.FindMaxBigraph(*graph);
cout << "RESULT Graph: NumberOfEdges = " << result->m_NumberOfEdgesCurrent << endl;
result->Print();
/* DELETE SECTION */
DeleteGraphs(graph, result);
return 0;
}
void DeleteGraphs(Graph * loadedGraph, Graph * resultGraph)
{
if (resultGraph != loadedGraph)
{
delete resultGraph;
}
for (unsigned i = 0; i < loadedGraph->m_NumberOfEdgesOriginal; i++)
{
delete loadedGraph->m_Edges[i];
}
delete[] loadedGraph->m_Edges;
delete loadedGraph;
}