GASM Official Repository
A python repository implementing an optimized version of the Graph Attribute and Structure Matching (GASM) algorithm on both CPU and GPU.
Check out the documentation !
Installation
pip install --upgrade pip
pip install GASM-or
Optional extras:
pip install "GASM-or[gpu]" # OpenCL GPU back-end (pyopencl)
pip install "GASM-or[benchmark]" # matplotlib, for the benchmark scripts
pip install "GASM-or[doc]" # sphinx + furo, to build the documentation
Quick start
import gasm
import networkx as nx
G1 = nx.gnp_random_graph(30, 0.1, seed=0)
G2 = nx.relabel_nodes(G1, {i: (i + 5) % 30 for i in G1.nodes()})
M = gasm.match(G1, G2) # GPU by default, CPU fallback
print(M.matchups) # list of (a, b) matched pairs
print(M.score) # global matching score
Force the CPU back-end, add attributes, or evaluate the result:
M = gasm.match(G1, G2, platform="CPU")
attrs = [
gasm.Attribute("weight", on="edge", kind="measurable", rho=0.1),
gasm.Attribute("label", on="vertex", kind="categorical"),
]
M = gasm.match(G1, G2, attributes=attrs)
ground_truth = {i: (i + 5) % 30 for i in G1.nodes()}
M.accuracy(ground_truth) # fraction of correct pairs
M.structural_quality(G1, G2) # structural quality qS
Features
- Faithful implementation of GASM for undirected and directed graphs.
- GPU (OpenCL) and CPU back-ends, with automatic CPU fallback.
- Vertex and edge attributes, categorical or measurable, with per-attribute uncertainty.
- Structure-only or attributes-only matching.
- Automatic complement procedure for dense graphs.
- Refined adaptive convergence criterion (with the article's fixed-iteration behaviour available on demand).
- Pluggable linear assignment solvers (Jonker-Volgenant, auction).
Dependencies
Requires numpy, scipy and networkx. The GPU back-end additionally requires pyopencl and an OpenCL runtime.
Benchmarks
The benchmark/ scripts import the local package and offer quick and full modes:
python benchmark/accuracy_quality.py --mode quick
python benchmark/speed.py --mode full --platforms CPU GPU
License
This project is licensed under the GNU General Public License v3.0 (GPL-3.0). See the LICENSE file for the full text.
Authors and acknowledgment
Crafted with ❤️ by Raphaël Candelier.
Metadata
Release files for GASM-or 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| gasm_or-0.2.0.tar.gz | 34.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| gasm_or-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 72.9 kB
Release files / gasm_or-0.2.0.tar.gz
| Download URL | gasm_or-0.2.0.tar.gz |
|---|---|
| Size | 34.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
283274f7fff18b18cc483129ad8e19e15ae2313f866dc92a8a571949fe35da2e
|
|
BLAKE2b-256 checksum How to use checksums |
eebc8605a3ab974a06f180186a6b3c75a7ce83b636a5474f4b7d77f6dc1bfa32
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 27, 2026.
Transparency logRelease files / gasm_or-0.2.0-py3-none-any.whl
| Download URL | gasm_or-0.2.0-py3-none-any.whl |
|---|---|
| Size | 38.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b197cfdb8f5767e006aec755be35e038a09ac4ff92501e55120c524bc2aec800
|
|
BLAKE2b-256 checksum How to use checksums |
65e17db8135329fd9096628a71a1f1d354bce2dc01fccb99065decba87d2840d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 27, 2026.
Transparency log