ngraph.coarsen
Advanced tools
Comparing version 1.0.1 to 1.0.2
@@ -22,2 +22,3 @@ var createGraph = require('ngraph.graph'); | ||
makeSureNodeAdded(fromCommunity, srcLink.fromId); | ||
makeSureNodeAdded(fromCommunity, srcLink.toId); | ||
} else { | ||
@@ -24,0 +25,0 @@ makeSureNodeAdded(fromCommunity, srcLink.fromId); |
{ | ||
"name": "ngraph.coarsen", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "Given a community structure creates a coarse graph", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -28,2 +28,21 @@ var coarsen = require('../'); | ||
test('it adds all nodes inside a community', function(t) { | ||
var srcGraph = createGraph(); | ||
srcGraph.addLink(1, 2); | ||
var fakeCommunity = { | ||
getClass: function getClass() { | ||
return 1; // everyone belongs to the same community | ||
} | ||
} | ||
var newGraph = coarsen(srcGraph, fakeCommunity); | ||
var community = newGraph.getNode(1); | ||
t.equals(community.data.size, 2, 'Both nodes are added'); | ||
t.ok(community.data.has(1), '1 is there'); | ||
t.ok(community.data.has(2), '2 is there'); | ||
t.end(); | ||
}); | ||
test('it accumulates weights', function(t) { | ||
@@ -30,0 +49,0 @@ var srcGraph = createGraph(); |
6563
102