Skip to content

Commit

Permalink
cleaned up
Browse files Browse the repository at this point in the history
  • Loading branch information
romanatarango committed Jun 24, 2022
1 parent 41da4bb commit f615afa
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 26 deletions.
14 changes: 7 additions & 7 deletions js/common/modules/@arangodb/graph/graphs-generation.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,18 +162,18 @@ const graphGenerator = function (verticesEdgesGenerator) {
// - "linear": the edges constitute a linear order <:
// there is an edge from v to w if and only if index of v < index of w.
// Note that the number of edges grows quadratically in size!
const makeClique = function (size, vColl, name_prefix, kind = "bidirected") {
let vertices = makeVertices(size, name_prefix);
const makeClique = function (size, kind = "bidirected") {
let vertices = makeVertices(size);
let edges = [];
for (let v = 0; v < size; ++v) {
for (let w = v + 1; w < size; ++w) {
switch (kind) {
case "bidirected":
edges.push(makeEdge(v, w, vColl, name_prefix));
edges.push(makeEdge(w, v, vColl, name_prefix));
edges.push(makeEdge(v, w));
edges.push(makeEdge(w, v));
break;
case "linear":
edges.push(makeEdge(v, w, vColl, name_prefix));
edges.push(makeEdge(v, w));
break;
}
}
Expand All @@ -182,8 +182,8 @@ const graphGenerator = function (verticesEdgesGenerator) {
};

// a wrapper to unify the call of createDirectedCycle, createAlternatingCycle, createFullBinaryTree
const makeBidirectedClique = function (size, vColl, name_prefix) {
return makeClique(size, vColl, name_prefix, "bidirected");
const makeBidirectedClique = function (size) {
return makeClique(size, "bidirected");
};

return {
Expand Down
7 changes: 1 addition & 6 deletions js/common/modules/@arangodb/graph/pregel-test-helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ function makeWCCTestSuite(isSmart, smartAttribute, numberOfShards) {
testWCCDisjointComponents(componentGenerators);
},

testWCC20AlternatingCycles() {
testWCC20AlternatingCycles: function () {
let componentSizes = [];
// cycles of length smaller than 2 cannot be produced
for (let i = 2; i < 22; ++i) {
Expand Down Expand Up @@ -265,7 +265,6 @@ function makeWCCTestSuite(isSmart, smartAttribute, numberOfShards) {
assertEqual(status.state, "done", "Pregel Job did never succeed.");

// Now test the result.
// We expect four components
const query = `
FOR v IN ${vColl}
COLLECT component = v.result WITH COUNT INTO size
Expand All @@ -292,7 +291,6 @@ function makeWCCTestSuite(isSmart, smartAttribute, numberOfShards) {
assertEqual(status.state, "done", "Pregel Job did never succeed.");

// Now test the result.
// We expect four components
const query = `
FOR v IN ${vColl}
COLLECT component = v.result WITH COUNT INTO size
Expand Down Expand Up @@ -320,7 +318,6 @@ function makeWCCTestSuite(isSmart, smartAttribute, numberOfShards) {
assertEqual(status.state, "done", "Pregel Job did never succeed.");

// Now test the result.
// We expect 1 component
const query = `
FOR v IN ${vColl}
COLLECT component = v.result WITH COUNT INTO size
Expand All @@ -347,7 +344,6 @@ function makeWCCTestSuite(isSmart, smartAttribute, numberOfShards) {
assertEqual(status.state, "done", "Pregel Job did never succeed.");

// Now test the result.
// We expect 1 component
const query = `
FOR v IN ${vColl}
COLLECT component = v.result WITH COUNT INTO size
Expand Down Expand Up @@ -380,7 +376,6 @@ function makeWCCTestSuite(isSmart, smartAttribute, numberOfShards) {
assertEqual(status.state, "done", "Pregel Job did never succeed.");

// Now test the result.
// We expect four components
const query = `
FOR v IN ${vColl}
COLLECT component = v.result WITH COUNT INTO size
Expand Down
13 changes: 0 additions & 13 deletions tests/js/common/shell/shell-pregel-components.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,19 +37,6 @@ var console = require("console");
let pregel = require("@arangodb/pregel");
let pregelTestHelpers = require("@arangodb/graph/pregel-test-helpers");

// TODO make this more flexible: input maxWaitTimeSecs and sleepIntervalSecs
const pregelRunSmallInstance = function (algName, graphName, parameters) {
const pid = pregel.start("wcc", graphName, parameters);
const maxWaitTimeSecs = 120;
const sleepIntervalSecs = 0.2;
let wakeupsLeft = maxWaitTimeSecs / sleepIntervalSecs;
while (pregel.status(pid).state !== "done" && wakeupsLeft > 0) {
wakeupsLeft--;
internal.sleep(0.2);
}
return pregel.status(pid);
};

const graphName = "UnitTest_pregel";
const vColl = "UnitTest_pregel_v", eColl = "UnitTest_pregel_e";

Expand Down

0 comments on commit f615afa

Please sign in to comment.