GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - ragibson/ModularityPruning: Pruning tool to identify small subsets of network partitions that are significant from the perspective of stochastic block model inference. Works for single-layer, multi-layer, directed, and weighted networks, and restricts focus to a fixed number of communities when desired.

BranchesTags
Open more actions menu

Latest commit

 

History

275 Commits
275 Commits

Folders and files

NameName
Last commit message
Last commit date
.github/workflows
.github/workflows
 
 
docs
docs
 
 
experiments
experiments
 
 
siam_ns20
siam_ns20
 
 
tests
tests
 
 
utilities
utilities
 
 
.flake8
.flake8
 
 
.gitignore
.gitignore
 
 
.readthedocs.yml
.readthedocs.yml
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
figure_generation_runtimes.md
figure_generation_runtimes.md
 
 
mypy.ini
mypy.ini
 
 
pyproject.toml
pyproject.toml
 
 

Repository files navigation

ModularityPruning

ModularityPruning visualization

ModularityPruning is a pruning tool to identify small subsets of network partitions that are significant from the perspective of stochastic block model inference. It:

  • Works for single-layer and multi-layer networks
  • Supports both directed and undirected networks
  • Supports weighted networks via the weight edge attribute
  • Restricts focus to a fixed number of communities when desired
  • Contains a faster and more robust implementation of the CHAMP (Convex Hull of Admissible Modularity Partitions) algorithm (see CHAMP_2D and CHAMP_3D)

See the documentation or the journal article at https://doi.org/10.1038/s41598-022-20142-6 for more information.

Significantly more details can be found in the article's Supplementary Information.

Note: support for weighted and directed networks is an extension beyond the original publication.

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
pip install .

For modularitypruning development, it is best to use a strict editable install so that pytest and mypy can pick up changes immediately.

pip install --editable . --config-settings editable_mode=strict

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.leiden_utilities import repeated_leiden_from_gammas
import numpy as np

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

# run leiden 1000 times on this graph from gamma=0 to gamma=2
partitions = repeated_leiden_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 issues and figure generation runtimes README may also be of interest.

About

Pruning tool to identify small subsets of network partitions that are significant from the perspective of stochastic block model inference. Works for single-layer, multi-layer, directed, and weighted networks, and restricts focus to a fixed number of communities when desired.

Topics

community-detectiongraph-theorymodularitymultilayer-networksnetwork-graphnetwork-sciencepruningstochastic-block-model

Resources

Readme
MIT license
Activity

Stars

18 stars

Watchers

2 watching

Forks

2 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.