Skip to main content

Python Wrapper for OSLOM

Project description

Python binding for OSLOM graph clustering algorithm

Summary

Pyolsom is a python binding for OSLOM (Order Statistics Local Optimization Method) graph clustering algorithm.

It works with directed/undirected weighted and unweighted graph. The algorithm performs usually good but slow, so it is better to be applied to medium graph size.

The orginal C++ code is really hard to be refactored. I tried the best to make it work with python.

Known issues

  • The lib is not thread safe. So use mutliprocess when parallel is required.
  • Only works on Linux

Requirements

  • C++ 17
  • Python >= 3.10
  • scikit-learn>=0.24
  • pybind11>=2.6
  • networkx>=2.5

The versions are what I worked on. Lower versions may work also.

Install

Use setup.py

git clone https://bochen0909@github.com/bochen0909/pyoslom.git
cd pyoslom 
pip install -r requirements.txt
python setup.py install

Use Poetry

git clone https://bochen0909@github.com/bochen0909/pyoslom.git
cd pyoslom 
poetry install --no-root
poetry build
poetry install

or use pip

pip install pyoslom

How to use

Example:

import networkx as nx
from pyoslom import OSLOM

G = nx.read_pajek("example.pajek") # networkx graph or adjacency matrix
alg = OSLOM(random_state=123)
results = alg.fit_transform(G)

def print_clus(clus):
    for k, v in clus.items():
        if k != 'clusters':
            print(str(k) + "=" + str(v))
    for k, l in clus['clusters'].items():
        print("Level:" + str(k) + ", #clu=" + str(len(l)))

print_clus(results)

For more complete examples please see the notebook example.ipynb.

example_clu0.png example_clu1.png

License

The original c++ code is published at OSLOM following a research publication. However there is no license attached with it. The python wrapping work is licensed under the GPLv2.

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

pyoslom-0.1.6.tar.gz (86.5 kB view details)

Uploaded Source

Built Distributions

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

pyoslom-0.1.6-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.1 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

pyoslom-0.1.6-cp312-cp312-macosx_14_0_arm64.whl (473.2 kB view details)

Uploaded CPython 3.12macOS 14.0+ ARM64

pyoslom-0.1.6-cp312-cp312-macosx_13_0_x86_64.whl (510.4 kB view details)

Uploaded CPython 3.12macOS 13.0+ x86-64

pyoslom-0.1.6-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.1 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

pyoslom-0.1.6-cp311-cp311-macosx_14_0_arm64.whl (475.6 kB view details)

Uploaded CPython 3.11macOS 14.0+ ARM64

pyoslom-0.1.6-cp311-cp311-macosx_13_0_x86_64.whl (513.0 kB view details)

Uploaded CPython 3.11macOS 13.0+ x86-64

pyoslom-0.1.6-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.1 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

pyoslom-0.1.6-cp310-cp310-macosx_14_0_arm64.whl (472.8 kB view details)

Uploaded CPython 3.10macOS 14.0+ ARM64

pyoslom-0.1.6-cp310-cp310-macosx_13_0_x86_64.whl (509.8 kB view details)

Uploaded CPython 3.10macOS 13.0+ x86-64

File details

Details for the file pyoslom-0.1.6.tar.gz.

File metadata

  • Download URL: pyoslom-0.1.6.tar.gz
  • Upload date:
  • Size: 86.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for pyoslom-0.1.6.tar.gz
Algorithm Hash digest
SHA256 0eea4197a5f4399cf5fff52b94f4373450c9426ad5d0d4fc8b99e16f002d72cd
MD5 72c9282fa510fc7419ac0eb40d9948b2
BLAKE2b-256 c0b42e3013d5037784ef4b2c66128d4ecb7265d0a9a4a34f9c6e4c3e5aec9490

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyoslom-0.1.6.tar.gz:

Publisher: github-deploy.yml on bochen0909/pyoslom

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyoslom-0.1.6-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyoslom-0.1.6-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 e37eb77a9f234b463e575c4d7bb4642f95ec833737fac313dca9aef047d139e0
MD5 acdf8408028c43b17c02dc794c033e7f
BLAKE2b-256 1b4da576c92535b8c8b73fb337a204b6d452c4951d4579a91eec7cea3de68ae6

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyoslom-0.1.6-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: github-deploy.yml on bochen0909/pyoslom

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyoslom-0.1.6-cp312-cp312-macosx_14_0_arm64.whl.

File metadata

File hashes

Hashes for pyoslom-0.1.6-cp312-cp312-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 d96fed67a1c4b5d3790c0505a9d12db23a8afc3e91a10df2264c4f1f0ed376f5
MD5 83a2304e4851df3139f5ce8682274435
BLAKE2b-256 19d69bf0d0266174b8e3917dcc93be2c00cad7f27f5f98ef283f208f8479de87

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyoslom-0.1.6-cp312-cp312-macosx_14_0_arm64.whl:

Publisher: github-deploy.yml on bochen0909/pyoslom

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyoslom-0.1.6-cp312-cp312-macosx_13_0_x86_64.whl.

File metadata

File hashes

Hashes for pyoslom-0.1.6-cp312-cp312-macosx_13_0_x86_64.whl
Algorithm Hash digest
SHA256 5a53edced3c042cffc867c2d491735864b83d981671ff06adb3de14a30b60868
MD5 c2325b67b396252c2b712e961b26cf33
BLAKE2b-256 8bb1519e5991543d97ee884e1c62614dfc8ada7b9274f99fb4b484383cceec36

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyoslom-0.1.6-cp312-cp312-macosx_13_0_x86_64.whl:

Publisher: github-deploy.yml on bochen0909/pyoslom

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyoslom-0.1.6-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyoslom-0.1.6-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 6bd894be7e37e6c2dbf93946aea79a277fb172394644084e87e6f57f2fa6bd7f
MD5 740f274234a4da912d04fdd26241d475
BLAKE2b-256 e0d5a3389bf162ce57dddd958df4c9fb29d1baf751791dbf19702b6791387470

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyoslom-0.1.6-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: github-deploy.yml on bochen0909/pyoslom

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyoslom-0.1.6-cp311-cp311-macosx_14_0_arm64.whl.

File metadata

File hashes

Hashes for pyoslom-0.1.6-cp311-cp311-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 67024de1ab0d0fb26aaff09fba3f06c55e9e176467888807600053b8f01b0017
MD5 c909b311c2c26d68d560f77245ec7d7a
BLAKE2b-256 5e8a902290d14be6b28b231237a3b1363c75539bade06b9c72d3f7a2571b61dc

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyoslom-0.1.6-cp311-cp311-macosx_14_0_arm64.whl:

Publisher: github-deploy.yml on bochen0909/pyoslom

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyoslom-0.1.6-cp311-cp311-macosx_13_0_x86_64.whl.

File metadata

File hashes

Hashes for pyoslom-0.1.6-cp311-cp311-macosx_13_0_x86_64.whl
Algorithm Hash digest
SHA256 165254b225d56a92a6c462eab80c68c5530efcdf106e74b9cdb5cdd41cead9b1
MD5 dc6553c98c094f4d7232bf37984d14ad
BLAKE2b-256 893550acc620ffbca28305564f84c01cdf9e4c926f529381079a872b75d83397

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyoslom-0.1.6-cp311-cp311-macosx_13_0_x86_64.whl:

Publisher: github-deploy.yml on bochen0909/pyoslom

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyoslom-0.1.6-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyoslom-0.1.6-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 4b04c698e304e7f695316d62f29c01590d19f1ec8fe167430ee4e9936ff75e78
MD5 454c7cb756fc4d026a1d8f06727d1fc9
BLAKE2b-256 c9c8f220bfd7788d815620787bd2601a4fd2a9518274ba7419f56e4be3644994

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyoslom-0.1.6-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: github-deploy.yml on bochen0909/pyoslom

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyoslom-0.1.6-cp310-cp310-macosx_14_0_arm64.whl.

File metadata

File hashes

Hashes for pyoslom-0.1.6-cp310-cp310-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 fe2c2ecf6c720cf2541a2ae7c26b05b71fe666c1b026591e5af023365777d502
MD5 74fc1b5c8fa67aa5fa4b6dc239b3a96f
BLAKE2b-256 110eee1c6d0069f07d1a794056fdecf2401fb085607aedf3b79794e80c29ac0c

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyoslom-0.1.6-cp310-cp310-macosx_14_0_arm64.whl:

Publisher: github-deploy.yml on bochen0909/pyoslom

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyoslom-0.1.6-cp310-cp310-macosx_13_0_x86_64.whl.

File metadata

File hashes

Hashes for pyoslom-0.1.6-cp310-cp310-macosx_13_0_x86_64.whl
Algorithm Hash digest
SHA256 552bad5a86e0030be9bf2e7878936d9d851f774723aaf1dcddad597e37c0918a
MD5 cbad56dfd8ac8460a6e09bb63248aa1d
BLAKE2b-256 6d9fe5943f7dbe21122246eac2286a1dd1b272fbfba6a2c02aa9af72c3b20e82

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyoslom-0.1.6-cp310-cp310-macosx_13_0_x86_64.whl:

Publisher: github-deploy.yml on bochen0909/pyoslom

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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