-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
58 lines (41 loc) · 1.46 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
51
52
53
54
55
56
57
58
//
// Created by owen on 21/02/2022.
//
#include <iostream>
#include <vector>
#include "Graph.h"
#include "Graphs.h"
#include "Utils.h"
using namespace std;
void printGraph(const Graph& g) {
cout << g << endl;
cout << "Total weight: ";
cout << g.getWeight();
cout << endl << endl;
cout << "Recursive depth first: ";
g.recursiveDepthFirstSearch();
cout << endl << "Iterative depth first: ";
g.iterativeDepthFirstSearch();
cout << endl << "Iterative breadth first: ";
g.iterativeBreadthFirstSearch();
cout << endl << "Iterative depth first (with priority first search): ";
g.iterativePriorityFirstSearch(-1);
cout << endl << "Iterative breadth first (with priority first search): ";
g.iterativePriorityFirstSearch(1);
cout << endl << endl << "Prim: " << endl;
int primWeight = g.prim(true);
cout << "Prim total weight: " << primWeight << endl;
cout << endl << "Dijkstra: " << endl;
int dijkstraWeight = g.dijkstra('A', true);
cout << "Dijkstra total weight: " << dijkstraWeight << endl;
// cout << endl << "Dijkstra max: " << endl;
// dijkstraWeight = g.dijkstraMax('A', true);
// cout << "Dijkstra max total weight: " << dijkstraWeight << endl;
cout << endl << "Raw matrix (https://graphonline.ru/en/create_graph_by_matrix): " << endl << g.rawMatrixString();
cout << endl << endl;
}
int main() {
Graph g = Graph("../graphs/graph1.txt");
printGraph(g);
return 0;
}