Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gasm_or-0.2.0.tar.gz (34.6 kB view details)

Uploaded Source

Built Distribution

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

gasm_or-0.2.0-py3-none-any.whl (38.3 kB view details)

Uploaded Python 3

File details

Details for the file gasm_or-0.2.0.tar.gz.

File metadata

  • Download URL: gasm_or-0.2.0.tar.gz
  • Upload date:
  • Size: 34.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for gasm_or-0.2.0.tar.gz
Algorithm Hash digest
SHA256 283274f7fff18b18cc483129ad8e19e15ae2313f866dc92a8a571949fe35da2e
MD5 be3edba12dfc2673cb54deb1cf78a627
BLAKE2b-256 eebc8605a3ab974a06f180186a6b3c75a7ce83b636a5474f4b7d77f6dc1bfa32

See more details on using hashes here.

Provenance

The following attestation bundles were made for gasm_or-0.2.0.tar.gz:

Publisher: publish.yml on CandelierLab/GASM-or

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

File details

Details for the file gasm_or-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: gasm_or-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 38.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for gasm_or-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b197cfdb8f5767e006aec755be35e038a09ac4ff92501e55120c524bc2aec800
MD5 70f42ff8c17f6a46565ccf484e92a021
BLAKE2b-256 65e17db8135329fd9096628a71a1f1d354bce2dc01fccb99065decba87d2840d

See more details on using hashes here.

Provenance

The following attestation bundles were made for gasm_or-0.2.0-py3-none-any.whl:

Publisher: publish.yml on CandelierLab/GASM-or

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