Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ngraph.coarsen

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ngraph.coarsen - npm Package Compare versions

Comparing version 1.2.0 to 1.3.0

lib/getSubgraphs.js

5

index.js
var createGraph = require('ngraph.graph');
module.exports = coarsen;
module.exports.getSubgraphs = require('./lib/getSubgraphs.js');

@@ -54,3 +55,3 @@ function coarsen(srcGraph, community) {

if (isolateNodes.size > 0) {
// Each node in the isolated noes has no links. So they all belong to the
// Each node in the isolated nodes has no links. So they all belong to the
// same community. We take arbitrary node from this class and assign them

@@ -61,2 +62,4 @@ // all to the same community:

graph.srcGraph = srcGraph;
return graph;

@@ -63,0 +66,0 @@

{
"name": "ngraph.coarsen",
"version": "1.2.0",
"version": "1.3.0",
"description": "Given a community structure creates a coarse graph",

@@ -24,3 +24,6 @@ "main": "index.js",

"tap": "^5.7.1"
},
"dependencies": {
"ngraph.subgraph": "^1.0.0"
}
}

@@ -136,1 +136,39 @@ var coarsen = require('../');

});
test('it adds srcGraph to response', function(t) {
var srcGraph = createGraph();
srcGraph.addLink(1, 2);
srcGraph.addNode(3);
srcGraph.addNode(4);
var fakeCommunity = {
getClass: function getClass(nodeId) {
return (nodeId < 3) ? 3 : 2;
}
}
var newGraph = coarsen(srcGraph, fakeCommunity);
t.equals(newGraph.srcGraph, srcGraph, 'srcGraph is here.');
t.end();
});
test('it can get all subgraphs', function(t) {
var srcGraph = createGraph();
srcGraph.addLink(1, 2);
srcGraph.addNode(3);
srcGraph.addNode(4);
var fakeCommunity = {
getClass: function getClass(nodeId) {
return (nodeId < 3) ? 3 : 2;
}
}
var coarseGraph = coarsen(srcGraph, fakeCommunity);
var allGraphs = coarsen.getSubgraphs(coarseGraph);
t.equals(allGraphs.length, 2, 'Two communities - two graphs');
t.end();
});
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc