Smart local moving (SLM) community detection in Python/C++
Project description
Smart local moving (SLM) community detection in Python/C++, modeled on the Java version on https://github.com/mneedham/slm.
Development: https://github.com/iosonofabio/slmpy
Author: Fabio Zanini
License: MIT
Requirements: pybind11>=2.2, numpy, pkgconfig (see requirements.txt)
from slmpy import ModularityOptimzer
edges = [
[0, 1],
[0, 2],
[0, 3],
[1, 2],
[1, 3],
[2, 3],
[3, 4],
[4, 5],
[4, 6],
[5, 6],
[7, 8],
]
mo = ModularityOptimzer(edges)
mo.fixed_nodes = [0, 4] # This fixes nodes 0 and 4 to be in different communities
communities = mo(algorithm='smart_local_moving')
# Check answer
assert((communities == [0, 0, 0, 0, 1, 1, 1]).all())
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
slmpy-0.3.1.tar.gz
(11.8 kB
view hashes)