Skip to main content

Run modularity density-based clustering

Project description

Build Status Python badge

Community detection by fine-tuned optimization of modularity and modularity density

Dependencies

Python >= 3.5.0
NetworkX >= 2.2s
NumPy >= 1.15.1
SciPy >= 1.1.0

Installation

pip install modularitydensity

Quick Start

import networkx as nx
import numpy as np
from modularitydensity.metrics import modularity_density
from modularitydensity.fine_tuned_modularity_density import fine_tuned_clustering_qds

G = nx.karate_club_graph() #sample dataset
adj = nx.to_scipy_sparse_matrix(G) #convert to sparse matrix

community_array = fine_tuned_clustering_qds(G)
print(community_array)
>> [2 2 2 2 4 4 4 2 3 3 4 2 2 2 3 3 4 2 3 2 3 2 3 3 1 1 3 3 3 3 3 1 3 3]

computed_metric = modularity_density(adj, community_array, np.unique(community_array))
print(computed_metric)
>> 0.2312650016945721    

Description

This package comprises two community detection algorithms which perform fine-tuned optimization of modularity and modularity density, respectively, of a community network structure. The fine-tuned algorithm iteratively carries out splitting and merging stages, alternatively, until neither splitting nor merging of the community structure improves the desired metric.

Also included are extensions of the fine_tuned optimizations of both modules. These extended versions account for any constraint on the maximum community size, while optimizing the desired metric.

Source code can be found at: https://github.com/ckmanalytix/modularity-density/

References

[1] CHEN M, KUZMIN K, SZYMANSKI BK. Community detection via maximization of modularity and its variants. IEEE Transactions on Computational Social Systems. 1(1), 46–65, 2014

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

modularitydensity-0.0.6.tar.gz (127.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

modularitydensity-0.0.6-py2.py3-none-any.whl (28.8 kB view details)

Uploaded Python 2Python 3

File details

Details for the file modularitydensity-0.0.6.tar.gz.

File metadata

  • Download URL: modularitydensity-0.0.6.tar.gz
  • Upload date:
  • Size: 127.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.8.0 tqdm/4.31.1 CPython/3.7.2

File hashes

Hashes for modularitydensity-0.0.6.tar.gz
Algorithm Hash digest
SHA256 51faa5a5eb93aaa477a0245b5053e71a8a416bece9ec59819b6fb421d968d247
MD5 0aeb14d0483f00ba581dafdeee68b372
BLAKE2b-256 b523f449004d86521ae472b5bd2cffbeedb001ce2b1c8d347c018450e9af0a9d

See more details on using hashes here.

File details

Details for the file modularitydensity-0.0.6-py2.py3-none-any.whl.

File metadata

  • Download URL: modularitydensity-0.0.6-py2.py3-none-any.whl
  • Upload date:
  • Size: 28.8 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.8.0 tqdm/4.31.1 CPython/3.7.2

File hashes

Hashes for modularitydensity-0.0.6-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 ba575dc4302ac65cb3619c2ca0755deebe1b63b801a0d5e0e7176d0cf615d239
MD5 9f5aac6a991c29f0180e9d6517480c9a
BLAKE2b-256 95e7abbc982cb9979e6486f9437f67cad4771e187a922401b31fecd40751887a

See more details on using hashes here.

Supported by

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