1
0
Fork 0

GraphViewer: All tests pass

This commit is contained in:
Michael Hackstein 2013-05-21 10:34:00 +02:00
parent 88d8c31029
commit 30b60f7715
3 changed files with 7 additions and 5 deletions

View File

@ -148,7 +148,7 @@ function NodeReducer(nodes, edges) {
_.each(nodes, function (n) {
var id = n._id,
c1, c2;
if (id == sID || id == lID) {
if (id === sID || id === lID) {
return null;
}
c1 = getDQValue(dQ, id, sID);
@ -277,6 +277,7 @@ function NodeReducer(nodes, edges) {
res = [],
dist = {},
dist2 = {},
detectSteps = true,
sortByDistance = function (a, b) {
var d1 = dist[_.min(a,minDist(dist))],
d2 = dist[_.min(b,minDist(dist))],
@ -290,7 +291,9 @@ function NodeReducer(nodes, edges) {
throw "Load some nodes first.";
}
populateValues(dQ, a, heap);
while (communityDetectionStep(dQ, a, heap, coms)) {}
while (detectSteps) {
detectSteps = communityDetectionStep(dQ, a, heap, coms);
}
res = _.pluck(_.values(coms), "com");
if (focus !== undefined) {
dist = floatDist(focus._id);

View File

@ -921,8 +921,7 @@
expect(nodes.length).toEqual(3);
existEdge("community_1", c3);
existEdge("community_1", c4);
expect(edges.length).toEqual(2);
expect(edges.length).toEqual(2);
expect(called).toBeTruthy();
});

View File

@ -149,7 +149,7 @@
edges.push(helper.createSimpleEdge(nodes, 5, 7));
var com = reducer.getCommunity(6);
expect(com).toContainNodes([0, 1, 2]);
expect(com).toContainNodes([0, 1, 2, 3]);
});
});