-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmatrix-graph.cpp
75 lines (58 loc) · 1.82 KB
/
matrix-graph.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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#include <iostream>
#include "Headers/AdjacencyMatrixGraph.h"
using namespace std;
template <typename T>
using AMG = AdjacencyMatrixGraph<T>;
int main()
{
AMG<char> graph;
cout << "Test 1 passed.\n";
graph.debug();
cout << "---------------------------------------\n";
graph.insertVertex('A');
graph.insertVertex('B');
graph.insertVertex('C');
graph.insertVertex('D');
graph.insertVertex('E');
// graph.insertVertex('F');
// graph.insertVertex('G');
// graph.insertVertex('H');
// graph.insertVertex('I');
// graph.insertVertex('J');
// graph.insertVertex('K');
// graph.insertVertex('L');
// graph.insertVertex('M');
// graph.insertVertex('N');
// graph.insertVertex('O');
// graph.insertVertex('P');
// graph.insertVertex('Q');
// graph.insertVertex('R');
// graph.insertVertex('S');
// graph.insertVertex('T');
// graph.insertVertex('U');
// graph.insertVertex('V');
// graph.insertVertex('W');
// graph.insertVertex('X');
// graph.insertVertex('Y');
// graph.insertVertex('Z');
// graph.insertVertex('Z');
graph.debug();
cout << "---------------------------------------\n";
graph.insertEdge('A', 'B');
graph.insertEdge('A', 'A');
graph.insertEdge('C', 'D');
graph.debug();
cout << "---------------------------------------\n";
graph.deleteEdge('C', 'D');
graph.deleteEdge('C', 'D');
graph.deleteEdge('C', 'Q');
graph.debug();
cout << "---------------------------------------\n";
cout << "A degree: " << graph.findDegree('A') << "\n";
cout << "Q degree: " << graph.findDegree('Q') << "\n";
cout << "---------------------------------------\n";
graph.deleteVertex('A');
graph.debug();
cout << "---------------------------------------\n";
return (0);
}