Skip to main content

A package for fast community detection in graphs using the Louvain method with Numba optimization.

Project description

Louvain-Numba

Louvain-Numba is a Python library for community detection in graphs using the Louvain method with Numba optimization. This library leverages Numba to accelerate the community detection process, making it suitable for large-scale graphs.

Features

  • Efficient community detection using the Louvain method
  • Optimized with Numba for high performance
  • Supports various graph input types (NetworkX, NumPy arrays, SciPy sparse matrices)
  • Generates hierarchical community structures

Installation

You can install Louvain-Numba via pip:

pip install louvain-numba

Or using Poetry:

poetry add louvain-numba

Usage

Basic Usage

import networkx as nx
import louvain_numba as lvn

# Create a random graph
G = nx.random_partition_graph([100, 100, 100], 0.1, 0.01)

# Find the best partition
partition = lvn.best_partition(G)
print("Best partition:", partition)

# Calculate modularity
modularity = lvn.modularity(partition, G)
print("Modularity:", modularity)

Full Hierarchy

import networkx as nx
import louvain_numba as lvn

# Create a random graph
G = nx.random_partition_graph([100, 100, 100], 0.1, 0.01)

# Generate full hierarchy of partitions
for level, (partition, modularity) in enumerate(lvn.find_partitions(G, return_modularity=True)):
    print(f"Level {level}:")
    print("Partition:", partition)
    print("Modularity:", modularity)

Contributing

Contributions are welcome! If you have any suggestions, bug reports, or feature requests, please open an issue or submit a pull request on GitHub. License

This project is licensed under the MIT License. See the LICENSE file for details.

Acknowledgements

This library was inspired by the cylouvain package and leverages Numba for performance optimization.

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

louvain_numba-0.0.0.tar.gz (6.0 kB view details)

Uploaded Source

Built Distribution

louvain_numba-0.0.0-py3-none-any.whl (7.8 kB view details)

Uploaded Python 3

File details

Details for the file louvain_numba-0.0.0.tar.gz.

File metadata

  • Download URL: louvain_numba-0.0.0.tar.gz
  • Upload date:
  • Size: 6.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.10.8 Windows/10

File hashes

Hashes for louvain_numba-0.0.0.tar.gz
Algorithm Hash digest
SHA256 bab840cc191004c8efe7a99950a4aeca78debbad888e6d77193158cdd7ac1c8d
MD5 feb07798f03ba50127a1270c382050fd
BLAKE2b-256 d2de4b12805fb49acf800a0c247f791d97b87b21cde6e407f3de6f767b6786f1

See more details on using hashes here.

File details

Details for the file louvain_numba-0.0.0-py3-none-any.whl.

File metadata

  • Download URL: louvain_numba-0.0.0-py3-none-any.whl
  • Upload date:
  • Size: 7.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.10.8 Windows/10

File hashes

Hashes for louvain_numba-0.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d9b094d77399e35ea6d89fc88b004ff30c4d4715d5449eaf6a65e8944d406a85
MD5 e531ef7925a3cb94614a689927806f41
BLAKE2b-256 96301d1410d575639d1284011d02e4652ea9c1a14039cdac695c74fdf7548303

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