-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtests.h
66 lines (49 loc) · 1.88 KB
/
tests.h
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
/*
* tests.h
*
* Created on: Dec 24, 2017
* Author: XMGOwner
*/
#ifndef TESTS_H_
#define TESTS_H_
#include "community2.h"
/** Run modularity according to the Louvain algorithm */
void modularity_louvain() {
community2 c;
//INPUT (node, Prob, synthetic, add_community, number, min,max , denseProb)
//node : number of vertices
//Prob : init probability for 1000 nodes (0.2)
//synthetic : true = sample graph, false = random graph
//add_community : true = add probable communities, false = not
//number : number of communities to add
// min,max : min and max node per communities
//denseProb : probability for adding probable communities ( 0.8 )
c.generate_graph(1000, 0.2 , false,false,2, 100, 200, 0.8);
//c.show_graph();
cout << "START MODULARITY_LOUVAIN" << endl;
auto start1 = std::chrono::high_resolution_clock::now();
c.modularity_louvain();
//cout << "SHOW LIST PROBABLE COMMUNITIES" << endl;
//c.list_communities();
//cout << "SHOW CALCULATE COMMUNITIES" << endl;
//c.show_communities();
auto finish1 = std::chrono::high_resolution_clock::now();
std::chrono::duration<double> elapsed1 = finish1 - start1;
std::cout << "Execution time: " << elapsed1.count() << " s\n";
cout << " FINISHED! " << endl;
}
/** Run modularity following the Newman algorithm */
void modularity_newman() {
auto start = std::chrono::high_resolution_clock::now();
community2 c;
c.generate_graph(500, 0.2 , false,false,2, 17, 30, 0.8);
cout << "GENERATE GRAPH SUCCESS !" << endl;
c.modularity_newman();
//c.show_communities();
cout << " modularity_newman SUCCESS" << endl;
auto finish = std::chrono::high_resolution_clock::now();
std::chrono::duration<double> elapsed = finish - start;
std::cout << "Execution time: " << elapsed.count() << " s\n";
cout << " FINISHED! " << endl;
}
#endif /* TESTS_H_ */