-
Notifications
You must be signed in to change notification settings - Fork 0
/
Harmonic.cpp
35 lines (33 loc) · 889 Bytes
/
Harmonic.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
#include <cmath>
#include <iostream>
#include <vector>
#include "Constants.h"
#include "Prototypes.h"
#include "ActorsClass.h"
void Harmonic(ActorsClass &ActorsObject)
{
HARMONIC_TYPE Harmonic,
MaxHarmonic = 0;
vector<NAME_TYPE> Actors;
HARMONIC_TYPE *HarmonicArray;
ActorsObject.ApproximatedHarmonicByHybridEstimator(HarmonicArray);
for(const NAME_TYPE &i: ActorsObject.RealActors)
{
Harmonic = HarmonicArray[i];
if(Harmonic > MaxHarmonic)
{
Actors.resize(0);
Actors.push_back(i);
MaxHarmonic = Harmonic;
}
else if(Harmonic == MaxHarmonic) Actors.push_back(i);
}
delete[] HarmonicArray;
cout << "Harmonic:" << endl;
for(const NAME_TYPE &i: Actors)
{
cout << "Actor id: " << i
<< "\tActor name: " << GetActorName(ACTORS, i)
<< "\tHarmonic centrality: " << MaxHarmonic << endl;
}
}