Graph Attributes and Structure Matching (GASM): graph matching on CPU and GPU.
Project description
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file gasm_or-0.1.0.tar.gz.
File metadata
- Download URL: gasm_or-0.1.0.tar.gz
- Upload date:
- Size: 33.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0dd3dced0f89488666401ec39a05e2a8903191936cdf2bac64698572e910140f
|
|
| MD5 |
6c2332450f39b504ada75c3dec6e9c97
|
|
| BLAKE2b-256 |
04a96c169f1719ac0c6caf387c593ae5660450c6125896e8bb379c8507ea6fae
|
Provenance
The following attestation bundles were made for gasm_or-0.1.0.tar.gz:
Publisher:
publish.yml on CandelierLab/GASM-or
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
gasm_or-0.1.0.tar.gz -
Subject digest:
0dd3dced0f89488666401ec39a05e2a8903191936cdf2bac64698572e910140f - Sigstore transparency entry: 1981029775
- Sigstore integration time:
-
Permalink:
CandelierLab/GASM-or@7f287876d7607ff12ac29ff716170d0a1f1a934b -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/CandelierLab
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@7f287876d7607ff12ac29ff716170d0a1f1a934b -
Trigger Event:
release
-
Statement type:
File details
Details for the file gasm_or-0.1.0-py3-none-any.whl.
File metadata
- Download URL: gasm_or-0.1.0-py3-none-any.whl
- Upload date:
- Size: 37.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2fa5b46e976768d482d0107d74b573d5d4a6cdcf3e6d694b754c8bfc03173fe7
|
|
| MD5 |
437037d0ce6c8e48b5a84589ae83762c
|
|
| BLAKE2b-256 |
a315df8d79909b4401c68cb496622cdf6f0ab7d9f0dc01979afb6029632345cb
|
Provenance
The following attestation bundles were made for gasm_or-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on CandelierLab/GASM-or
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
gasm_or-0.1.0-py3-none-any.whl -
Subject digest:
2fa5b46e976768d482d0107d74b573d5d4a6cdcf3e6d694b754c8bfc03173fe7 - Sigstore transparency entry: 1981029877
- Sigstore integration time:
-
Permalink:
CandelierLab/GASM-or@7f287876d7607ff12ac29ff716170d0a1f1a934b -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/CandelierLab
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@7f287876d7607ff12ac29ff716170d0a1f1a934b -
Trigger Event:
release
-
Statement type: