-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathmain.cpp
More file actions
94 lines (80 loc) · 2.49 KB
/
Copy pathmain.cpp
File metadata and controls
94 lines (80 loc) · 2.49 KB
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
#include <iostream>
#include "anoedgeglobal.hpp"
#include "anoedgelocal.hpp"
#include "anograph.hpp"
#include "anographk.hpp"
#include "utils.hpp"
void run_anoedge_global(int argc, char** argv) {
if (argc != 6) {
cout << "Expected five arguments but got " + to_string(argc) << endl;
return;
}
string algorithm = argv[1];
string dataset_name = argv[2];
int rows = stoi(argv[3]);
int buckets = stoi(argv[4]);
double decay_factor = stof(argv[5]);
AnoedgeGlobal anoedge_global(algorithm, dataset_name, rows, buckets, decay_factor);
anoedge_global.run();
}
void run_anoedge_local(int argc, char** argv) {
if (argc != 6) {
cout << "Expected five arguments but got " + to_string(argc) << endl;
return;
}
string algorithm = argv[1];
string dataset_name = argv[2];
int rows = stoi(argv[3]);
int buckets = stoi(argv[4]);
double decay_factor = stof(argv[5]);
AnoedgeLocal anoedge_local(algorithm, dataset_name, rows, buckets, decay_factor);
anoedge_local.run();
}
void run_anograph(int argc, char** argv) {
if (argc != 7) {
cout << "Expected seven arguments but got " + to_string(argc) << endl;
return;
}
string algorithm = argv[1];
string dataset_name = argv[2];
int time_window = stoi(argv[3]);
int edge_threshold = stoi(argv[4]);
int rows = stoi(argv[5]);
int buckets = stoi(argv[6]);
Anograph anograph(algorithm, dataset_name, time_window, edge_threshold, rows, buckets);
anograph.run();
}
void run_anographk(int argc, char** argv) {
if (argc != 8) {
cout << "Expected eight arguments but got " + to_string(argc) << endl;
return;
}
string algorithm = argv[1];
string dataset_name = argv[2];
int time_window = stoi(argv[3]);
int edge_threshold = stoi(argv[4]);
int rows = stoi(argv[5]);
int buckets = stoi(argv[6]);
int K = stoi(argv[7]);
AnographK anographk(algorithm, dataset_name, time_window, edge_threshold, rows, buckets, K);
anographk.run();
}
int main(int argc, char** argv) {
if (argc < 2) {
cout << "Expected at least two arguments but got " + to_string(argc) << endl;
return 0;
}
string algorithm = argv[1];
if (algorithm == "anoedge_g") {
run_anoedge_global(argc, argv);
} else if (algorithm == "anoedge_l") {
run_anoedge_local(argc, argv);
} else if (algorithm == "anograph") {
run_anograph(argc, argv);
} else if (algorithm == "anograph_k") {
run_anographk(argc, argv);
} else {
cout << "Algorithm " << algorithm << " doesn't match with any of the available algorithms (anoedge_g, anoedge_l, anograph, anograph_k)" << endl;
}
return 0;
}