-
Notifications
You must be signed in to change notification settings - Fork 0
/
blogel_pagerank_vorPart.h
61 lines (56 loc) · 1.6 KB
/
blogel_pagerank_vorPart.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
#include "blogel/Voronoi.h"
#include <iostream>
#include <sstream>
#include "blogel/BGlobal.h"
using namespace std;
class MyWorker : public BPartWorker {
public:
char buf[1024];
//C version
virtual BPartVertex* toVertex(char* line)
{
char* pch;
pch = strtok(line, " ");
BPartVertex* v = new BPartVertex;
v->id = atoi(pch);
pch = strtok(NULL, " ");
int num = atoi(pch);
//v->value().color=-1;//default is -1
while (num--) {
pch = strtok(NULL, " ");
v->value().neighbors.push_back(atoi(pch));
}
return v;
}
// const int blockSize = 24;
virtual void toline(BPartVertex* v, BufferedWriter& writer) //key: "vertexID blockID slaveID"
{ //val: list of "vid block slave "
sprintf(buf, "%d %d %d\t", v->id, v->value().color, _my_rank);
writer.write(buf);
vector<triplet>& vec = v->value().nbsInfo;
for (int i = 0; i < vec.size(); i++) {
sprintf(buf, "%d %d %d ", vec[i].vid, vec[i].bid, vec[i].wid);
writer.write(buf);
}
writer.write("\n");
}
};
void blogel_pagerank_vorPart(string in_path, string out_path)
{
WorkerParams param;
param.input_path = in_path;
param.output_path = out_path;
param.force_write = true;
param.native_dispatcher = false;
bool to_undirected = true;
//livej friend
//webuk
set_sampRate(0.001);
set_maxHop(30);
set_maxVCSize(500000);
set_factor(1.6);
set_stopRatio(1.0);
set_maxRate(0.2);
MyWorker worker;
worker.run(param, to_undirected);
}