Skip to main content

Pruning tool to identify small subsets of network partitions that are significant from the perspective of stochastic block model inference.

Project description

ModularityPruning

ModularityPruning is a pruning tool to identify small subsets of network partitions that are significant from the perspective of stochastic block model inference. This method works for single-layer and multi-layer networks, as well as for restricting focus to a fixed number of communities when desired.

See the documentation for more information.

Installation

This project is on PyPI and can be installed with

pip install modularitypruning
# OR
pip3 install modularitypruning

Alternatively, you can install it from this repository directly:

git clone https://github.com/ragibson/ModularityPruning
cd ModularityPruning
python3 setup.py install

Basic Usage

This package interfaces directly with python-igraph. A simple example of its usage is

import igraph as ig
from modularitypruning import prune_to_stable_partitions
from modularitypruning.louvain_utilities import repeated_louvain_from_gammas
import numpy as np

# get Karate Club graph in igraph
G = ig.Graph.Famous("Zachary")

# run louvain 1000 times on this graph from gamma=0 to gamma=2
partitions = repeated_louvain_from_gammas(G, np.linspace(0, 2, 1000))

# prune to the stable partitions from gamma=0 to gamma=2
stable_partitions = prune_to_stable_partitions(G, partitions, 0, 2)
print(stable_partitions)

This prints

[(0, 0, 0, 0, 1, 1, 1, 0, 2, 2, 1, 0, 0, 0, 2, 2, 1, 0, 2, 0, 2, 0, 2, 3, 3, 3, 2, 3, 3, 2, 2, 3, 2, 2)]

which is the stable 4-community split of the Karate Club network.

More Information

The TODO README and performance README may also be of interest.

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

modularitypruning-1.1.0.tar.gz (15.4 kB view details)

Uploaded Source

Built Distribution

modularitypruning-1.1.0-py3.6.egg (43.9 kB view details)

Uploaded Source

File details

Details for the file modularitypruning-1.1.0.tar.gz.

File metadata

  • Download URL: modularitypruning-1.1.0.tar.gz
  • Upload date:
  • Size: 15.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/47.3.0 requests-toolbelt/0.8.0 tqdm/4.46.1 CPython/3.6.9

File hashes

Hashes for modularitypruning-1.1.0.tar.gz
Algorithm Hash digest
SHA256 6fd3a5b4cb3ad89cbf48a22ffac4e2dee5c0e6d0e0d2f7e702cc46013bfc231d
MD5 bea05eac225142885abc8f884f2ebb58
BLAKE2b-256 a680ce3d515830e0c291a938eb9e72d0950013c0c89909655115835e84b02855

See more details on using hashes here.

File details

Details for the file modularitypruning-1.1.0-py3.6.egg.

File metadata

  • Download URL: modularitypruning-1.1.0-py3.6.egg
  • Upload date:
  • Size: 43.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/47.3.0 requests-toolbelt/0.8.0 tqdm/4.46.1 CPython/3.6.9

File hashes

Hashes for modularitypruning-1.1.0-py3.6.egg
Algorithm Hash digest
SHA256 b94785f189fcc68fa93d5eb1b621f5ec046241ec864fff8a0352894a379e105d
MD5 4ad852d8add39cb552321eaa2ea5873c
BLAKE2b-256 1d85af2ae826be41e2b05d7d05c30d0df93e2ce31ac0a079040f00b4b88ed2eb

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