Skip to main content

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.

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


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.3.tar.gz (12.2 kB view details)

Uploaded Source

File details

Details for the file slmpy-0.3.3.tar.gz.

File metadata

  • Download URL: slmpy-0.3.3.tar.gz
  • Upload date:
  • Size: 12.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.1

File hashes

Hashes for slmpy-0.3.3.tar.gz
Algorithm Hash digest
SHA256 3d3368636fe1132f3677faef668c9f7a5ba0a2eae13385bd7501577cbcd4bfba
MD5 da2f5605cc544f5b11396ae0c5317ddf
BLAKE2b-256 4aaf2f8d395df8297ad8209c5cb139d7abf45081b5583c2a972f8c6b38b51e17

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page