-
Notifications
You must be signed in to change notification settings - Fork 0
/
pagerank.cpp
36 lines (28 loc) · 961 Bytes
/
pagerank.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
#include <ctime>
#include "graph.h"
int main(int argc, char** argv){
double alpha = 0.85;
double convergence = 0.000001;
int max_it = 100;
int it_num = 0;
std::clock_t begin;
std::clock_t end;
double elapsed_sec;
Graph* gptr = new Graph();
gptr->createGraphFromFile("./data/rmat2.txt");
begin = clock();
gptr->clustering();
end = clock();
elapsed_sec = double(end - begin)/CLOCKS_PER_SEC;
std::cout << "Clustering time: " << elapsed_sec << std::endl;
begin = clock();
it_num = gptr->calPagerank(alpha, max_it, convergence);
end = clock();
elapsed_sec = double(end - begin)/CLOCKS_PER_SEC;
std::cout << "Pagerank rum time: " << elapsed_sec << std::endl;
std::cout << "iteration number: " << it_num << std::endl;
std::cout << "# of vertex pair with identical input: " << gptr->pair << std::endl;
//gptr->printPR();
//gptr->dumpDot("./graph.dot");
return 0;
}