Skip to main content

Python wrapper around Combo network partitioning algorithm (C++)

Project description

pyCOMBO

CI

pyCombo is a python wrapper around C++ implementation of the [network] community detection algorithm called "Combo".

Details of the algorithm are described in the paper "General optimization technique for high-quality community detection":

Sobolevsky, S., Campari, R., Belyi, A. and Ratti, C., 2014. General optimization technique for high-quality community detection in complex networks. Physical Review E, 90(1), p.012811.

Installation

You can install the latest release of pycombo directly from PyPI by executing this:

python -m pip install pycombo

If you use Python 3.7, install pyCombo 0.1.07:

python -m pip install pycombo==0.1.07

Quick Start

The basic usage is as follows:

import pycombo
import networkx as nx

partition = pycombo.execute(nx.karate_club_graph())

Package supports NetworkX graphs, Pajek .net files, and adjacency matrices passed as numpy array or list. Combo algorithm uses modularity score as a loss function, but you can use your own metrics as edge weights with treat_as_modularity=True parameter.

Parameters

  • graph : nx.Graph object, or string treated as path to Pajek .net file.
  • weight : Optional[str], defaults to weight. Graph edges property to use as weights. If None, graph assumed to be unweighted. Ignored if graph is passed as string (path to the file), or such property does not exist.
  • max_communities : Optional[int], defaults to None. Maximum number of communities. If <= 0 or None, assume to be infinite.
  • modularity_resolution : float, defaults to 1.0. Modularity resolution parameter.
  • num_split_attempts : int, defaults to 0. Number of split attempts. If 0, autoadjust this number automatically.
  • fixed_split_step_ int, defaults to 0. Step number to apply predefined split. If 0, use only random splits. if >0, sets up the usage of 6 fixed type splits on every fixed_split_step.
  • start_separate : bool, default False. Indicates if Combo should start from assigning each node into its own separate community. This could help to achieve higher modularity, but it makes execution much slower.
  • treat_as_modularity : bool, default False. Indicates if edge weights should be treated as modularity scores. If True, the algorithm solves clique partitioning problem over the given graph, treated as modularity graph (matrix). For example, this allows users to provide their own custom 'modularity' matrix. modularity_resolution is ignored in this case.
  • verbose : int, defaults to 0. Indicates how much progress information Combo should print out. For now Combo has only one level starting at verbose >= 1.
  • intermediate_results_path : Optional str, defaults to None. Path to the file where community assignments will be saved on each iteration. If None or empty, intermediate results will not be saved.
  • return_modularity : bool, defaults to True. Indicates if function should return achieved modularity score.
  • random_seed : int, defaults to None. Random seed to use. None indicates using some internal default value that is based on time and is expected to be different for each call.

Returns

  • partition : Dict{int : int}, community labels for each node.
  • modularity : float. Achieved modularity value. Only returned if return_modularity=True.

More examples can be found in example folder.

Development

This repo uses https://github.com/Alexander-Belyi/Combo as a git submodule. So for local development, clone with --recurse-submodules flag, as:

git clone --recurse-submodules https://github.com/Casyfill/pyCombo

Or, if you've already cloned it without --recurse-submodules, run:

git submodule update --init --recursive

Package is built and managed via poetry.

  • To use specific python version run poetry env use 3.12.
  • To install dev version, run poetry install.
  • To build distributions run poetry build.
  • To run tests execute poetry run pytest.

Information

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

pycombo-0.1.8.tar.gz (33.3 kB view details)

Uploaded Source

Built Distributions

pycombo-0.1.8-cp312-cp312-win_amd64.whl (104.8 kB view details)

Uploaded CPython 3.12 Windows x86-64

pycombo-0.1.8-cp312-cp312-manylinux_2_35_x86_64.whl (121.3 kB view details)

Uploaded CPython 3.12 manylinux: glibc 2.35+ x86-64

pycombo-0.1.8-cp312-cp312-macosx_14_0_arm64.whl (207.9 kB view details)

Uploaded CPython 3.12 macOS 14.0+ ARM64

pycombo-0.1.8-cp311-cp311-win_amd64.whl (104.4 kB view details)

Uploaded CPython 3.11 Windows x86-64

pycombo-0.1.8-cp311-cp311-manylinux_2_35_x86_64.whl (122.0 kB view details)

Uploaded CPython 3.11 manylinux: glibc 2.35+ x86-64

pycombo-0.1.8-cp311-cp311-macosx_14_0_arm64.whl (209.9 kB view details)

Uploaded CPython 3.11 macOS 14.0+ ARM64

pycombo-0.1.8-cp310-cp310-win_amd64.whl (103.2 kB view details)

Uploaded CPython 3.10 Windows x86-64

pycombo-0.1.8-cp310-cp310-manylinux_2_35_x86_64.whl (120.4 kB view details)

Uploaded CPython 3.10 manylinux: glibc 2.35+ x86-64

pycombo-0.1.8-cp310-cp310-macosx_14_0_arm64.whl (207.0 kB view details)

Uploaded CPython 3.10 macOS 14.0+ ARM64

pycombo-0.1.8-cp39-cp39-win_amd64.whl (103.1 kB view details)

Uploaded CPython 3.9 Windows x86-64

pycombo-0.1.8-cp39-cp39-manylinux_2_35_x86_64.whl (120.4 kB view details)

Uploaded CPython 3.9 manylinux: glibc 2.35+ x86-64

pycombo-0.1.8-cp39-cp39-macosx_14_0_arm64.whl (207.2 kB view details)

Uploaded CPython 3.9 macOS 14.0+ ARM64

pycombo-0.1.8-cp38-cp38-win_amd64.whl (103.2 kB view details)

Uploaded CPython 3.8 Windows x86-64

pycombo-0.1.8-cp38-cp38-manylinux_2_35_x86_64.whl (120.3 kB view details)

Uploaded CPython 3.8 manylinux: glibc 2.35+ x86-64

pycombo-0.1.8-cp38-cp38-macosx_14_0_arm64.whl (206.7 kB view details)

Uploaded CPython 3.8 macOS 14.0+ ARM64

File details

Details for the file pycombo-0.1.8.tar.gz.

File metadata

  • Download URL: pycombo-0.1.8.tar.gz
  • Upload date:
  • Size: 33.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.6 Linux/6.8.0-1014-azure

File hashes

Hashes for pycombo-0.1.8.tar.gz
Algorithm Hash digest
SHA256 5eb88ee4f67e695c175b5d0f477f40657316ef19637e6a60113444b024c80acd
MD5 fb196ac4d2fd127a47bc9a1fd0ca6bbf
BLAKE2b-256 fad4a73fa743e3b7457d41e276e53afcf2537a07c5ef1e1bfcd0bada477b6122

See more details on using hashes here.

File details

Details for the file pycombo-0.1.8-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: pycombo-0.1.8-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 104.8 kB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.6 Linux/6.8.0-1014-azure

File hashes

Hashes for pycombo-0.1.8-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 5e097aaa8805033345ec672aebd998e310e498731d6d3ebaec658aae168c1b22
MD5 9646813e03c0821f22fa34c434edcb4e
BLAKE2b-256 083f5dab6a9954e9441b0aabfdad8013c7100ce4badf1d871bde505e6080a197

See more details on using hashes here.

File details

Details for the file pycombo-0.1.8-cp312-cp312-manylinux_2_35_x86_64.whl.

File metadata

File hashes

Hashes for pycombo-0.1.8-cp312-cp312-manylinux_2_35_x86_64.whl
Algorithm Hash digest
SHA256 1911d54f6fc2f18263e2b563a1f8140415048d14525d0e700a5551939746ec43
MD5 0815e860333ef1bfc34bcb1351279aec
BLAKE2b-256 984253bd7e016195fcb64322b078a9ad12614a7e9f316f1c7c6ed0214dfb2050

See more details on using hashes here.

File details

Details for the file pycombo-0.1.8-cp312-cp312-macosx_14_0_arm64.whl.

File metadata

  • Download URL: pycombo-0.1.8-cp312-cp312-macosx_14_0_arm64.whl
  • Upload date:
  • Size: 207.9 kB
  • Tags: CPython 3.12, macOS 14.0+ ARM64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.6 Linux/6.8.0-1014-azure

File hashes

Hashes for pycombo-0.1.8-cp312-cp312-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 60437acff618f99c8134d90f5a60ef571c67e9de9a8a4b99bce5310311b868d6
MD5 66e5d1b782e3c550ce21c2aff9653dd6
BLAKE2b-256 1c8a467c473b7ffab3baf4b51070317d4fba426fe4fe4769f4669f76584655f4

See more details on using hashes here.

File details

Details for the file pycombo-0.1.8-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: pycombo-0.1.8-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 104.4 kB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.6 Linux/6.8.0-1014-azure

File hashes

Hashes for pycombo-0.1.8-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 6a184134c753aa5cec101f1e86de6c00fcd093f08be63a5d7819963a9976cc09
MD5 53ab5e50e865ecc7f1f55cf862e7a4f8
BLAKE2b-256 952d70f2429c0da1cb41ed088bac99149c443e6f82e0cfbdf1aa9c97afb5cf3a

See more details on using hashes here.

File details

Details for the file pycombo-0.1.8-cp311-cp311-manylinux_2_35_x86_64.whl.

File metadata

File hashes

Hashes for pycombo-0.1.8-cp311-cp311-manylinux_2_35_x86_64.whl
Algorithm Hash digest
SHA256 04e70caa2325995f454b820f8f5a5d54843c70ab7d558fdc04556434fff68e99
MD5 40b721f0350d777c1ce5da4849c6c96a
BLAKE2b-256 5562707ee8bf85c07ff880a3d8389845d90f930cd4574a44050011f86032fe28

See more details on using hashes here.

File details

Details for the file pycombo-0.1.8-cp311-cp311-macosx_14_0_arm64.whl.

File metadata

  • Download URL: pycombo-0.1.8-cp311-cp311-macosx_14_0_arm64.whl
  • Upload date:
  • Size: 209.9 kB
  • Tags: CPython 3.11, macOS 14.0+ ARM64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.6 Linux/6.8.0-1014-azure

File hashes

Hashes for pycombo-0.1.8-cp311-cp311-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 612203eaf02c847d6670f25a83b1d61ffb0c386b70b4eda9336daf513cf3b778
MD5 15a055c55596b85a9060ddf3716261b5
BLAKE2b-256 7427edd4861350a4a7a17249a779bd314d4582923a0666d2453d6c3677d64136

See more details on using hashes here.

File details

Details for the file pycombo-0.1.8-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: pycombo-0.1.8-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 103.2 kB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.6 Linux/6.8.0-1014-azure

File hashes

Hashes for pycombo-0.1.8-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 eb92f4a9f2ceeacd253a906ec9a7628e34dd8f7620c103b42167108f91fd012a
MD5 9e33491f3c5eec148d99414ba78f140a
BLAKE2b-256 5736891af251312219fa967070207269f6ab7926126e2ed8aad4e367b7d97261

See more details on using hashes here.

File details

Details for the file pycombo-0.1.8-cp310-cp310-manylinux_2_35_x86_64.whl.

File metadata

File hashes

Hashes for pycombo-0.1.8-cp310-cp310-manylinux_2_35_x86_64.whl
Algorithm Hash digest
SHA256 526a5e54c8965a4d9ae911e67b4cb00d3ae64ff3ce2fa2120286e63c30d93094
MD5 8f9adccf856759fc1f1198149ec7dbdd
BLAKE2b-256 8f27f5655a9581cc3f4780fd70cc2cf143586ada5b442a3f2c76552e974c774e

See more details on using hashes here.

File details

Details for the file pycombo-0.1.8-cp310-cp310-macosx_14_0_arm64.whl.

File metadata

  • Download URL: pycombo-0.1.8-cp310-cp310-macosx_14_0_arm64.whl
  • Upload date:
  • Size: 207.0 kB
  • Tags: CPython 3.10, macOS 14.0+ ARM64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.6 Linux/6.8.0-1014-azure

File hashes

Hashes for pycombo-0.1.8-cp310-cp310-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 f6461badc3b58319ffd47fbe82cf14bd4822548b3db342651002f3037a3b1d36
MD5 6cbe79a3b80fec6b14013c30cd65abe5
BLAKE2b-256 92cb29ddc57ec97482378d49e492656169b3dd2ed5bb49b462b052f46d7dc596

See more details on using hashes here.

File details

Details for the file pycombo-0.1.8-cp39-cp39-win_amd64.whl.

File metadata

  • Download URL: pycombo-0.1.8-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 103.1 kB
  • Tags: CPython 3.9, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.6 Linux/6.8.0-1014-azure

File hashes

Hashes for pycombo-0.1.8-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 b632d80ceea178a0eedae3715c9e5fe71c2a9114c5a953410e8cd73968f3334f
MD5 032851032f1a6b3849f8c7555f678c38
BLAKE2b-256 1bd94d957f45f4b08d95105d2d5ec95487b886acbdf76b6b58174ee85ea19af4

See more details on using hashes here.

File details

Details for the file pycombo-0.1.8-cp39-cp39-manylinux_2_35_x86_64.whl.

File metadata

  • Download URL: pycombo-0.1.8-cp39-cp39-manylinux_2_35_x86_64.whl
  • Upload date:
  • Size: 120.4 kB
  • Tags: CPython 3.9, manylinux: glibc 2.35+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.6 Linux/6.8.0-1014-azure

File hashes

Hashes for pycombo-0.1.8-cp39-cp39-manylinux_2_35_x86_64.whl
Algorithm Hash digest
SHA256 7f6507489681548675d4ec1561a4d66718f11dc7959e4993c4a7bce7d8ae353f
MD5 ed9b723d7286bf6957ead01f71c8280f
BLAKE2b-256 3d8bda44e4d8924da16cb6d46fd0e1363cef56b17912795c4bc2b6f9c55ef5c3

See more details on using hashes here.

File details

Details for the file pycombo-0.1.8-cp39-cp39-macosx_14_0_arm64.whl.

File metadata

  • Download URL: pycombo-0.1.8-cp39-cp39-macosx_14_0_arm64.whl
  • Upload date:
  • Size: 207.2 kB
  • Tags: CPython 3.9, macOS 14.0+ ARM64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.6 Linux/6.8.0-1014-azure

File hashes

Hashes for pycombo-0.1.8-cp39-cp39-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 9ac86f503901b5580d216bd46ee6bb902b978f1a592bc3d29d7a8bb7a7a8a78f
MD5 459813b00210c29d12e77f579feb4e3e
BLAKE2b-256 4d8b57d51986f44517f1ca1e4addd4d6b38e6a3b7f5140127d96ad47eb73df29

See more details on using hashes here.

File details

Details for the file pycombo-0.1.8-cp38-cp38-win_amd64.whl.

File metadata

  • Download URL: pycombo-0.1.8-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 103.2 kB
  • Tags: CPython 3.8, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.6 Linux/6.8.0-1014-azure

File hashes

Hashes for pycombo-0.1.8-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 71813681347ac941e6b9fe6e7c71557fb7fc735c46ec2fedef88118742355b0c
MD5 e42782e28b69f7190dca19765b509753
BLAKE2b-256 a545424e25a11d9d9db57e985189f9b505a94b4ab439f9b2fe3253aa6c9826ad

See more details on using hashes here.

File details

Details for the file pycombo-0.1.8-cp38-cp38-manylinux_2_35_x86_64.whl.

File metadata

  • Download URL: pycombo-0.1.8-cp38-cp38-manylinux_2_35_x86_64.whl
  • Upload date:
  • Size: 120.3 kB
  • Tags: CPython 3.8, manylinux: glibc 2.35+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.6 Linux/6.8.0-1014-azure

File hashes

Hashes for pycombo-0.1.8-cp38-cp38-manylinux_2_35_x86_64.whl
Algorithm Hash digest
SHA256 dc7bf80d9a120d86b55e8b506f475c3b386c0ee406f4df11efd9ca14b43ec8b1
MD5 8aa9df13dcac02ec431bf4ba763e918a
BLAKE2b-256 f07bcbc4dbb90a8bf6f5d5f42e584e2b26bc3c6962b22c1dd664d060d3fb7025

See more details on using hashes here.

File details

Details for the file pycombo-0.1.8-cp38-cp38-macosx_14_0_arm64.whl.

File metadata

  • Download URL: pycombo-0.1.8-cp38-cp38-macosx_14_0_arm64.whl
  • Upload date:
  • Size: 206.7 kB
  • Tags: CPython 3.8, macOS 14.0+ ARM64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.6 Linux/6.8.0-1014-azure

File hashes

Hashes for pycombo-0.1.8-cp38-cp38-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 5f171beddf37c9f0f2be736ce51008293bf6f1d08e7ca57fab7be0c1edde3bd5
MD5 99275de22024bae51279c451ae0c2c3f
BLAKE2b-256 b6f1f79eb858d42f870d045caf1c6879f555265a7cc37a94b838f2fc96e8f34a

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