-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
54 lines (47 loc) · 1.3 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
#include <iostream>
#include <vector>
#include <list>
#include <unordered_set>
#include "IGraph.h"
#include "CListGraph.h"
#include "CMatrixGraph.h"
#include "CSetGraph.h"
#include "CArcGraph.h"
int main() {
int vertex = 0;
int edges = 0;
std::cin >> vertex;
std::cin >> edges;
int from, to = 0;
CArcGraph test(vertex);
for (int i = 0; i < edges; i++) {
std::cin >> from >> to;
test.AddEdge(from, to);
}
CMatrixGraph test2(&test);
std::vector<int> testArr;
std::cout << "getNext: ";
std::cin >> from;
test.GetNextVertices(from, testArr);
for (unsigned int i = 0; i < testArr.size(); i++)
std::cout << testArr[i] << " ";
testArr.clear();
std::cout << "getPrev: ";
std::cin >> to;
test.GetPrevVertices(to, testArr);
for (unsigned int i = 0; i < testArr.size(); i++)
std::cout << testArr[i] << " ";
testArr.clear();
std::cout << "getNext: ";
std::cin >> from;
test2.GetNextVertices(from, testArr);
for (unsigned int i = 0; i < testArr.size(); i++)
std::cout << testArr[i] << " ";
testArr.clear();
std::cout << "getPrev: ";
std::cin >> to;
test2.GetPrevVertices(to, testArr);
for (int i = 0; i < testArr.size(); i++)
std::cout << testArr[i] << " ";
return 0;
}