mirror of https://gitee.com/bigwinds/arangodb
GraphViewer: All tests pass
This commit is contained in:
parent
88d8c31029
commit
30b60f7715
|
@ -148,7 +148,7 @@ function NodeReducer(nodes, edges) {
|
||||||
_.each(nodes, function (n) {
|
_.each(nodes, function (n) {
|
||||||
var id = n._id,
|
var id = n._id,
|
||||||
c1, c2;
|
c1, c2;
|
||||||
if (id == sID || id == lID) {
|
if (id === sID || id === lID) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
c1 = getDQValue(dQ, id, sID);
|
c1 = getDQValue(dQ, id, sID);
|
||||||
|
@ -277,6 +277,7 @@ function NodeReducer(nodes, edges) {
|
||||||
res = [],
|
res = [],
|
||||||
dist = {},
|
dist = {},
|
||||||
dist2 = {},
|
dist2 = {},
|
||||||
|
detectSteps = true,
|
||||||
sortByDistance = function (a, b) {
|
sortByDistance = function (a, b) {
|
||||||
var d1 = dist[_.min(a,minDist(dist))],
|
var d1 = dist[_.min(a,minDist(dist))],
|
||||||
d2 = dist[_.min(b,minDist(dist))],
|
d2 = dist[_.min(b,minDist(dist))],
|
||||||
|
@ -290,7 +291,9 @@ function NodeReducer(nodes, edges) {
|
||||||
throw "Load some nodes first.";
|
throw "Load some nodes first.";
|
||||||
}
|
}
|
||||||
populateValues(dQ, a, heap);
|
populateValues(dQ, a, heap);
|
||||||
while (communityDetectionStep(dQ, a, heap, coms)) {}
|
while (detectSteps) {
|
||||||
|
detectSteps = communityDetectionStep(dQ, a, heap, coms);
|
||||||
|
}
|
||||||
res = _.pluck(_.values(coms), "com");
|
res = _.pluck(_.values(coms), "com");
|
||||||
if (focus !== undefined) {
|
if (focus !== undefined) {
|
||||||
dist = floatDist(focus._id);
|
dist = floatDist(focus._id);
|
||||||
|
|
|
@ -921,8 +921,7 @@
|
||||||
expect(nodes.length).toEqual(3);
|
expect(nodes.length).toEqual(3);
|
||||||
existEdge("community_1", c3);
|
existEdge("community_1", c3);
|
||||||
existEdge("community_1", c4);
|
existEdge("community_1", c4);
|
||||||
expect(edges.length).toEqual(2);
|
expect(edges.length).toEqual(2);
|
||||||
|
|
||||||
expect(called).toBeTruthy();
|
expect(called).toBeTruthy();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -149,7 +149,7 @@
|
||||||
edges.push(helper.createSimpleEdge(nodes, 5, 7));
|
edges.push(helper.createSimpleEdge(nodes, 5, 7));
|
||||||
|
|
||||||
var com = reducer.getCommunity(6);
|
var com = reducer.getCommunity(6);
|
||||||
expect(com).toContainNodes([0, 1, 2]);
|
expect(com).toContainNodes([0, 1, 2, 3]);
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue