Skip to content

OBSOLETE : see graphology/graphology-communities-louvain & graphology/graphology-metrics

Notifications You must be signed in to change notification settings

luccitan/graphology-communities

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Graphology Communities

WARNING : The content of this repository has been split and transferred to :

Miscellaneous metrics and algorithms around community detection to be used with graphology.

Installation

npm install graphology-communities

Usage

Metrics

Algorithms

Modularity

Compute the modularity, given the graph and a partitioning

import {modularity} from 'graphology-communities';
// Alternatively, to load only the relevant code:
import modularity from 'graphology-communities/modularity';

const Q = modularity(graph, {'1': 0, '2': 0, '3': 1, '4': 1, '5': 1});

Arguments

  • graph Graph: target graph.
  • partitioning Object: object mapping a community index to a object.
  • options ?object: options:
    • attributes ?object: attributes' names:
      • weight ?string [weight]: name of the edges' weight attribute.

Louvain

Execute the Louvain algorithm to detect a good partitioning of the graph in several communities. The original publication of the algorithm can be found there.

import {louvain} from 'graphology-communities';
// Alternatively, to load only the relevant code:
import louvain from 'graphology-communities/louvain';

const partitioning = louvain(graph); // Return a mapping object like {'1': 0, '2': 0, ..., 5: '1'}
// To directly map the result to nodes' attributes
louvain.assign(graph); // By default, assigned to the `community` attribute
lovuain.assign(graph, {attributes: {community: 'foo'}}); // Assigned to the `foo` attribute

Arguments

  • graph Graph: graph to which you want to get the best partitioning.
  • options ?object: options:
    • attributes ?object: attributes' names:
      • weight ?string [weight]: name of the edges' weight attribute.
      • community ?string [community]: name of the node attribute holding community information

About

OBSOLETE : see graphology/graphology-communities-louvain & graphology/graphology-metrics

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published