forked from gaolk/graph-database-benchmark
-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathpg_graph500.js
executable file
·44 lines (32 loc) · 1.21 KB
/
pg_graph500.js
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
const pregel = require("@arangodb/pregel")
var graph_module = require("@arangodb/general-graph")
var fs = require("fs");
if (graph_module._exists("graph500")){
graph_module._drop("graph500")
}
var graph = graph_module._create("graph500");
graph._addVertexCollection("vertex");
var rel = graph_module._relation("edge", ["vertex"], ["vertex"]);
graph._extendEdgeDefinitions(rel);
var totalTime = 0;
var total = 0;
for (var i=0; i<3; i++) {
var handle = pregel.start("pagerank", "graph500", {maxGSS: 10, resultField:"pagerank"});
total++;
print("computing pagerank: Test # " + total);
while (!["done", "canceled"].includes(pregel.status(handle).state)) {
print("waiting to complete... Test # " + total);
require("internal").wait(0.5);
}
var status = pregel.status(handle);
print(status);
if (status.state == "done") {
totalTime += status.totalRuntime;
fs.writeFileSync("pagerankResults_graph500_" + i, "Test#" + i + ", " + status.totalRuntime+" s");
}
}
print("SUMMARY PageRank for graph500:");
print("Total time, s: " + totalTime);
print("Total number of tests: " + total);
print("Avg time, s: ", totalTime/total);
fs.writeFileSync("pagerankResults_graph500", "Avg time, s: " + totalTime/total);