-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
124 lines (121 loc) · 3.92 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
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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
#include <iostream>
#include "ActorsClass.h"
#include "Prototypes.h"
#include "TitlesClass.h"
using namespace std;
int main(int argc, char **argv)
{
unsigned Choice;
NAME_TYPE ActorId, ActorIdBis;
cout << "Please choose an option:\n"
"--------------------------------------------------------------\n"
"0 - Single node - All centralities\n"
"1 - Single node - Degree centrality\n"
"2 - Single node - Closeness centrality\n"
"3 - Single node - Lin centrality\n"
"4 - Single node - Harmonic centrality\n"
"5 - Single node - Betweeness centrality (approximation by sampling)\n"
"--------------------------------------------------------------\n"
"9 - Distance between two actors\n"
"--------------------------------------------------------------\n"
"10 - Get maxima - All centralities\n"
"11 - Get maxima - Degree centrality\n"
"12 - Get maxima - Closeness centrality (approximation by hybrid estimator, forced into largest connected component)\n"
"13 - Get maxima - Lin centrality (approximation by hybrid estimator, forced into largest connected component)\n"
"14 - Get maxima - Harmonic centrality (approximation by hybrid estimator, forced into largest connected component)\n"
"15 - Get maxima - Betweeness centrality (approximation by sampling)\n"
"--------------------------------------------------------------\n"
"20 - Number of actors\n"
"--------------------------------------------------------------\n"
"Choice: ";
cin >> Choice;
if( Choice != 0 &&
Choice != 1 &&
Choice != 2 &&
Choice != 3 &&
Choice != 4 &&
Choice != 5 &&
Choice != 9 &&
Choice != 10 &&
Choice != 11 &&
Choice != 12 &&
Choice != 13 &&
Choice != 14 &&
Choice != 15 &&
Choice != 20 )
{
cerr << "Invalid choice. Terminating." << endl;
return 1;
}
if(Choice < 10)
{
cout << "Insert actor id (the number after nm): ";
cin >> ActorId;
}
if(Choice == 9)
{
cout << "Insert other actor id (the number after nm): ";
cin >> ActorIdBis;
}
cout << "Building actors graph..." << flush;
ActorsClass ActorsObject(ACTORS, TITLES, TITLES_ACTORS);
cout << "done." << endl << flush;
switch(Choice)
{
case 0:
cout << "Degree: " << ActorsObject.Degree(ActorId) << endl;
cout << "Closeness: " << ActorsObject.Closeness(ActorId) << endl;
cout << "Lin: " << ActorsObject.Lin(ActorId) << endl;
cout << "Harmonic: " << ActorsObject.Harmonic(ActorId) << endl;
cout << "Betweeness: "
<< ActorsObject.ApproximatedBetweenessBySampling(ActorId) << endl;
break;
case 1:
cout << "Degree: " << ActorsObject.Degree(ActorId) << endl;
break;
case 2:
cout << "Closeness: " << ActorsObject.Closeness(ActorId) << endl;
break;
case 3:
cout << "Lin: " << ActorsObject.Lin(ActorId) << endl;
break;
case 4:
cout << "Harmonic: " << ActorsObject.Harmonic(ActorId) << endl;
break;
case 5:
cout << "Betweeness: "
<< ActorsObject.ApproximatedBetweenessBySampling(ActorId) << endl;
break;
case 9:
cout << ActorsObject.Distance(ActorId,ActorIdBis) << endl;
break;
case 10:
Degree(ActorsObject);
Closeness(ActorsObject);
Lin(ActorsObject);
Harmonic(ActorsObject);
Betweeness(ActorsObject);
break;
case 11:
Degree(ActorsObject);
break;
case 12:
Closeness(ActorsObject);
break;
case 13:
Lin(ActorsObject);
break;
case 14:
Harmonic(ActorsObject);
break;
case 15:
Betweeness(ActorsObject);
break;
case 20:
cout << ActorsObject.RealActors.size() << endl;
break;
default:
cerr << "Hey, how did you get there?!" << endl;
}
return 0;
}