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

ngraph.louvain

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ngraph.louvain

Given a graph instance detects communities using the Louvain Method

  • 1.1.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
21
decreased by-62.5%
Maintainers
1
Weekly downloads
 
Created
Source

ngraph.louvain

Given a graph instance detects clusters using the Louvain Method. Demo

usage

// Let's say you have an ngraph instance:
var graph = createAGraph();

// To detect clusters:
var detectClusters = require('ngraph.louvain');
var clusters = detectClusters(graph);

// now you can iterate over each node and get it's community (aka class):
graph.forEachNode(function(node) {
  console.log(node.id, clusters.getClass(node.id));
});

Note: Louvain method is hierarchical. I.e. you should be able to get coarser graphs based on detected communities. By default ngraph.louvain does not implement hierarchies, yet you can easily achieve it by following:

var coarsen = require('ngraph.coarsen');

var detectClusters = require('ngraph.louvain');
var clusters = detectClusters(graph);

while(clusters.canCoarse()) {
  graph = coarsen(graph, clusters);
  clusters = detectClusters(graph);
  // this will give you next level in the hierarchy
}

install

npm install ngraph.louvain

see also

license

MIT

Keywords

FAQs

Package last updated on 29 Aug 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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