Registry / ai-ml / graspologic-native

graspologic-native

JSON →
library1.3.1pypypi✓ verified 82d ago

Graspologic-native is a Python native companion module providing high-performance C++ implementations for core algorithms used by the `graspologic` library, such as graph matching, partitioning, and clustering. It offers accelerated computation for graph-theoretic operations. The current version is 1.2.5, and its release cadence generally aligns with major updates to the `graspologic` library.

pip install graspologic-native
INSTALL
IMPORT
SIG · GRASPOLOGIC-NATIVE
G
graspologic-native
ai-mlpythonv1.3.1
Install
4.5s avg
Import
Disk
226MB
Pass rate
5/ 10
Env Coverage5 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.3.1 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
glibc
py 3.10
1/2 runs
✓ 4.4s
py 3.11
1/2 runs
✓ 4.35s
py 3.12
1/2 runs
✓ 4.5s
py 3.13
1/2 runs
✓ 4.35s
py 3.9
1/2 runs
✓ 4.95s
226MB installed
● package 226MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

leiden
from graspologic_native import leiden
from graspologic_native.partition import leiden
leiden_csr
from graspologic_native import leiden_csr
HierarchicalCluster
from graspologic_native import HierarchicalCluster

This quickstart demonstrates how to directly use the `leiden` community detection algorithm from `graspologic_native.partition`. It creates a simple adjacency matrix and applies the algorithm to find community assignments for the nodes. Note that `graspologic-native` functions often expect NumPy arrays as input.

import numpy as np from graspologic_native.partition import leiden # Create a sample adjacency matrix (e.g., for a small graph) # Must be a square NumPy array, typically int or float type. adj_matrix = np.array([ [0, 1, 1, 0, 0], [1, 0, 1, 0, 0], [1, 1, 0, 0, 0], [0, 0, 0, 0, 1], [0, 0, 0, 1, 0] ], dtype=np.int32) # Call the leiden community detection algorithm # Parameters: adjacency matrix, resolution, random_seed, n_iterations # Returns: communities (numpy array of community assignments) communities = leiden(adj_matrix, 1.0, 42, 10) print(f"Adjacency Matrix:\n{adj_matrix}") print(f"Detected Communities: {communities}") # Expected output might be something like: # Detected Communities: [0 0 0 1 1]
Debug
Known issues
gotchaMost end-users should interact with the higher-level `graspologic` library instead of directly using `graspologic-native`. This library is primarily a C++ backend for performance-critical operations, and its direct API is less stable and less documented for general consumption.
fix
Prefer `import graspologic` and use its provided functions unless you have specific performance tuning or low-level integration needs.
affects: All versions
breakingAs a compiled C++ extension, `graspologic-native` has specific Python version compatibility. Using it outside the supported Python range (currently >=3.8, <3.14) will lead to installation failures or `ImportError` due to ABI incompatibility.
fix
Ensure your Python environment matches the `requires_python` range specified on PyPI (e.g., Python 3.8-3.13 for version 1.2.5). Consider using a virtual environment.
affects: All versions
gotchaBinary wheels might not be available for all operating systems, architectures, or Python versions. If a pre-compiled wheel isn't found, `pip` will attempt to compile from source, requiring a C++ compiler (like MSVC on Windows, GCC/Clang on Linux/macOS) and development headers.
fix
Check PyPI for available wheels (`https://pypi.org/project/graspologic-native/#files`). If no wheel is available for your environment, ensure you have a C++ compiler installed and configured, along with Python development headers (e.g., `python3-dev` on Debian/Ubuntu).
affects: All versions
Upgrade
Version history
1.3.1latest on PyPI · released Jun 14, 2026
Audit
Dependencies
graspologicoptionalThis library is primarily a low-level backend for graspologic; direct usage is less common.
numpyrequiredFunctions within graspologic-native typically expect and return NumPy arrays for graph data structures.
scipyoptionalOften used alongside NumPy for sparse matrix operations and other scientific computing tasks related to graphs.
Agent activity
11 hits · last 30 days
node
10
OpenAI (training)
1
Resources