{"id":19289792,"url":"https://github.com/ragibson/modularitypruning","last_synced_at":"2025-04-22T05:31:50.544Z","repository":{"id":41928597,"uuid":"238790287","full_name":"ragibson/ModularityPruning","owner":"ragibson","description":"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.","archived":false,"fork":false,"pushed_at":"2024-10-29T03:11:38.000Z","size":2810,"stargazers_count":16,"open_issues_count":3,"forks_count":2,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-10-29T03:18:17.128Z","etag":null,"topics":["community-detection","graph-theory","modularity","multilayer-networks","network-graph","network-science","pruning","stochastic-block-model"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ragibson.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-02-06T21:40:20.000Z","updated_at":"2024-10-29T03:04:43.000Z","dependencies_parsed_at":"2023-11-16T04:26:12.894Z","dependency_job_id":"d1ec6ca6-84d8-41c4-9bd3-c421ffc47ea5","html_url":"https://github.com/ragibson/ModularityPruning","commit_stats":{"total_commits":180,"total_committers":2,"mean_commits":90.0,"dds":0.4722222222222222,"last_synced_commit":"954952feb5a9845b81a0788f65928d5de2008215"},"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ragibson%2FModularityPruning","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ragibson%2FModularityPruning/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ragibson%2FModularityPruning/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ragibson%2FModularityPruning/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ragibson","download_url":"https://codeload.github.com/ragibson/ModularityPruning/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223888463,"owners_count":17220096,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["community-detection","graph-theory","modularity","multilayer-networks","network-graph","network-science","pruning","stochastic-block-model"],"created_at":"2024-11-09T22:17:11.577Z","updated_at":"2024-11-09T22:17:12.008Z","avatar_url":"https://github.com/ragibson.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ModularityPruning\n\n![ModularityPruning visualization](docs/example_figures/article_figure_method_visual.png)\n\nModularityPruning is a pruning tool to identify small subsets of network\npartitions that are significant from the perspective of stochastic block model\ninference. This method works for single-layer and multi-layer networks, as well\nas for restricting focus to a fixed number of communities when desired.\n\nSee the [documentation](https://modularitypruning.readthedocs.io/en/latest/)\nor the journal article at https://doi.org/10.1038/s41598-022-20142-6 for more\ninformation.\n\nSignificantly more details can be found in the article's\n[Supplementary Information](\nhttps://static-content.springer.com/esm/art%3A10.1038%2Fs41598-022-20142-6/MediaObjects/41598_2022_20142_MOESM1_ESM.pdf\n).\n\n## Installation\n\nThis project is on [PyPI](https://pypi.org/project/modularitypruning/) and can\nbe installed with\n\n    pip install modularitypruning\n    # OR\n    pip3 install modularitypruning\n\nAlternatively, you can install it from this repository directly:\n\n    git clone https://github.com/ragibson/ModularityPruning\n    cd ModularityPruning\n    python3 setup.py install\n\n\u003ca name = \"Basic Usage\"\u003e\u003c/a\u003e\n\n## Basic Usage\n\nThis package interfaces directly with python-igraph. A simple example of its\nusage is\n\n```python\nimport igraph as ig\nfrom modularitypruning import prune_to_stable_partitions\nfrom modularitypruning.leiden_utilities import repeated_leiden_from_gammas\nimport numpy as np\n\n# get Karate Club graph in igraph\nG = ig.Graph.Famous(\"Zachary\")\n\n# run leiden 1000 times on this graph from gamma=0 to gamma=2\npartitions = repeated_leiden_from_gammas(G, np.linspace(0, 2, 1000))\n\n# prune to the stable partitions from gamma=0 to gamma=2\nstable_partitions = prune_to_stable_partitions(G, partitions, 0, 2)\nprint(stable_partitions)\n``` \n\nThis prints\n\n    [(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)]\n\nwhich is the stable 4-community split of the Karate Club network.\n\n## More Information\n\nThe [issues (which contains some potential future work)](https://github.com/ragibson/ModularityPruning/issues)\nand [figure generation runtimes README](figure_generation_runtimes.md) may also\nbe of interest.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fragibson%2Fmodularitypruning","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fragibson%2Fmodularitypruning","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fragibson%2Fmodularitypruning/lists"}