Skip to main content

pygmtools provides graph matching solvers in Python API and supports numpy and pytorch backends. pygmtools also provides dataset API for standard graph matching benchmarks.

Project description

pygmtools: Python Graph Matching Tools

PyPi version PyPI pyversions Downloads Documentation Status codecov discord channel QQ group GitHub stars


News pygmtools is published in JMLR! Please cite our paper if our tools are useful in your research!


pygmtools (Python Graph Matching Tools) provides graph matching solvers in Python and is easily accessible via:

$ pip install pygmtools

Official documentation: https://pygmtools.readthedocs.io

Source code: https://github.com/Thinklab-SJTU/pygmtools

Graph matching is a fundamental yet challenging problem in pattern recognition, data mining, and others. Graph matching aims to find node-to-node correspondence among multiple graphs, by solving an NP-hard combinatorial optimization problem.

Doing graph matching in Python used to be difficult, and this library wants to make researchers' lives easier. To highlight, pygmtools has the following features:

  • Support various solvers, including traditional combinatorial solvers (including linear, quadratic, and multi-graph) and novel deep learning-based solvers;
  • Support various backends, including numpy which is universally accessible, and some state-of-the-art deep learning architectures with GPU support: pytorch, paddle, jittor, tensorflow, mindspore;
  • Deep learning friendly, the operations are designed to best preserve the gradient during computation and batched operations support for the best performance.

Installation

You can install the stable release on PyPI:

$ pip install pygmtools

or get the latest version by running:

$ pip install -U https://github.com/Thinklab-SJTU/pygmtools/archive/master.zip # with --user for user install (no root)

Now the pygmtools is available with the numpy backend.

The following packages are required, and shall be automatically installed by pip:

Python >= 3.8
requests >= 2.25.1
scipy >= 1.4.1
Pillow >= 7.2.0
numpy >= 1.18.5
easydict >= 1.7
appdirs >= 1.4.4
tqdm >= 4.64.1
networkx >= 2.8.8
aiohttp
async-timeout

Available Graph Matching Solvers

This library offers user-friendly API for the following solvers:

Available Backends

This library is designed to support multiple backends with the same set of API. Please follow the official instructions to install your backend.

The following backends are available:

  • Numpy (default backend, CPU only)
numpy logo
  • PyTorch (GPU friendly, deep learning friendly)
pytorch logo
  • Jittor (GPU friendly, JIT support, deep learning friendly)
jittor logo paddle logo
  • Tensorflow (GPU friendly, deep learning friendly)
tensorflow logo
  • MindSpore (GPU friendly, deep learning friendly)
mindspore logo

For more details, please read the documentation.

Pretrained Models

The library includes several neural network solvers. The pretrained models shall be automatically downloaded upon needed from the hosted model repository. If you are experiencing issues with automatic download, please download the pretrained models manually and put them at ~/.cache/pygmtools (for Linux).

Available at: [huggingface] [google drive] [baidu drive]

The Deep Graph Matching Benchmark

pygmtools is also featured with a standard data interface of several graph matching benchmarks. Please read the corresponding documentation for details.

We also maintain a repository containing non-trivial implementation of deep graph matching models, please check out ThinkMatch if you are interested!

Chat with the Community

If you have any questions, or if you are experiencing any issues, feel free to raise an issue on GitHub.

We also offer the following chat rooms if you are more comfortable with them:

  • Discord (for English speakers):

    discord

  • QQ Group (for Chinese speakers)/QQ群(中文用户): 696401889

    ThinkMatch/pygmtools交流群

Contributing

Any contributions/ideas/suggestions from the community is welcomed! Before starting your contribution, please read the Contributing Guide.

Developers and Maintainers

pygmtools is developed and maintained by members from ThinkLab at Shanghai Jiao Tong University.

Citing Pygmtools

pygmtools is published on Journal of Machine Learning Research (JMLR). If you find our toolkit helpful in your research, please cite:

Runzhong Wang, Ziao Guo, Wenzheng Pan, Jiale Ma, Yikai Zhang, Nan Yang, Qi Liu, Longxuan Wei, Hanxue Zhang, Chang Liu, Zetian Jiang, Xiaokang Yang, and Junchi Yan.
Pygmtools: A Python Graph Matching Toolkit.
Journal of Machine Learning Research, 25(33):1−7, 2024.

In Bibtex format:

@article{wang2024pygm,
  author  = {Runzhong Wang and Ziao Guo and Wenzheng Pan and Jiale Ma and Yikai Zhang and Nan Yang and Qi Liu and Longxuan Wei and Hanxue Zhang and Chang Liu and Zetian Jiang and Xiaokang Yang and Junchi Yan},
  title   = {Pygmtools: A Python Graph Matching Toolkit},
  journal = {Journal of Machine Learning Research},
  year    = {2024},
  volume  = {25},
  number  = {33},
  pages   = {1-7},
  url     = {https://jmlr.org/papers/v25/23-0572.html},
}

References

[1] Sinkhorn, Richard, and Paul Knopp. "Concerning nonnegative matrices and doubly stochastic matrices." Pacific Journal of Mathematics 21.2 (1967): 343-348.

[2] Munkres, James. "Algorithms for the assignment and transportation problems." Journal of the Society for Industrial and Applied Mathematics 5.1 (1957): 32-38.

[3] Leordeanu, Marius, and Martial Hebert. "A spectral technique for correspondence problems using pairwise constraints." International Conference on Computer Vision (2005).

[4] Cho, Minsu, Jungmin Lee, and Kyoung Mu Lee. "Reweighted random walks for graph matching." European conference on Computer Vision (2010).

[5] Leordeanu, Marius, Martial Hebert, and Rahul Sukthankar. "An integer projected fixed point method for graph matching and map inference." Advances in Neural Information Processing Systems 22 (2009).

[6] Yan, Junchi, et al. "Multi-graph matching via affinity optimization with graduated consistency regularization." IEEE Transactions on Pattern Analysis and Machine Intelligence 38.6 (2015): 1228-1242.

[7] Jiang, Zetian, Tianzhe Wang, and Junchi Yan. "Unifying offline and online multi-graph matching via finding shortest paths on supergraph." IEEE Transactions on Pattern Analysis and Machine Intelligence 43.10 (2020): 3648-3663.

[8] Solé-Ribalta, Albert, and Francesc Serratosa. "Graduated assignment algorithm for multiple graph matching based on a common labeling." International Journal of Pattern Recognition and Artificial Intelligence 27.01 (2013): 1350001.

[9] Wang, Runzhong, Junchi Yan, and Xiaokang Yang. "Unsupervised Learning of Graph Matching with Mixture of Modes via Discrepancy Minimization." IEEE Transactions on Pattern Analysis and Machine Intelligence 45.8 (2023): 10500-10518.

[10] Wang, Runzhong, Junchi Yan, and Xiaokang Yang. "Combinatorial learning of robust deep graph matching: an embedding based approach." IEEE Transactions on Pattern Analysis and Machine Intelligence 45.6 (2023): 6984-7000.

[11] Yu, Tianshu, et al. "Learning deep graph matching with channel-independent embedding and hungarian attention." International Conference on Learning Representations. 2019.

[12] Wang, Runzhong, Junchi Yan, and Xiaokang Yang. "Neural graph matching network: Learning lawler’s quadratic assignment problem with extension to hypergraph and multiple-graph matching." IEEE Transactions on Pattern Analysis and Machine Intelligence 44.9 (2022): 5261-5279.

[13] Wang, Runzhong, Junchi Yan, and Xiaokang Yang. "Combinatorial Learning of Graph Edit Distance via Dynamic Embedding." IEEE/CVF Conference on Computer Vision and Pattern Recognition (2021): 5241-5250.

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

pygmtools-0.6.0.tar.gz (174.9 kB view details)

Uploaded Source

Built Distributions

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

pygmtools-0.6.0-cp313-cp313-win_amd64.whl (310.8 kB view details)

Uploaded CPython 3.13Windows x86-64

pygmtools-0.6.0-cp313-cp313-manylinux2014_x86_64.whl (781.8 kB view details)

Uploaded CPython 3.13

pygmtools-0.6.0-cp313-cp313-macosx_10_13_universal2.whl (368.0 kB view details)

Uploaded CPython 3.13macOS 10.13+ universal2 (ARM64, x86-64)

pygmtools-0.6.0-cp312-cp312-win_amd64.whl (312.3 kB view details)

Uploaded CPython 3.12Windows x86-64

pygmtools-0.6.0-cp312-cp312-manylinux2014_x86_64.whl (796.4 kB view details)

Uploaded CPython 3.12

pygmtools-0.6.0-cp312-cp312-macosx_10_13_universal2.whl (370.9 kB view details)

Uploaded CPython 3.12macOS 10.13+ universal2 (ARM64, x86-64)

pygmtools-0.6.0-cp311-cp311-win_amd64.whl (310.9 kB view details)

Uploaded CPython 3.11Windows x86-64

pygmtools-0.6.0-cp311-cp311-manylinux2014_x86_64.whl (775.9 kB view details)

Uploaded CPython 3.11

pygmtools-0.6.0-cp311-cp311-macosx_10_9_universal2.whl (370.6 kB view details)

Uploaded CPython 3.11macOS 10.9+ universal2 (ARM64, x86-64)

pygmtools-0.6.0-cp310-cp310-win_amd64.whl (311.7 kB view details)

Uploaded CPython 3.10Windows x86-64

pygmtools-0.6.0-cp310-cp310-manylinux2014_x86_64.whl (763.8 kB view details)

Uploaded CPython 3.10

pygmtools-0.6.0-cp310-cp310-macosx_10_9_universal2.whl (372.0 kB view details)

Uploaded CPython 3.10macOS 10.9+ universal2 (ARM64, x86-64)

pygmtools-0.6.0-cp39-cp39-win_amd64.whl (312.0 kB view details)

Uploaded CPython 3.9Windows x86-64

pygmtools-0.6.0-cp39-cp39-manylinux2014_x86_64.whl (762.9 kB view details)

Uploaded CPython 3.9

pygmtools-0.6.0-cp39-cp39-macosx_10_9_universal2.whl (372.6 kB view details)

Uploaded CPython 3.9macOS 10.9+ universal2 (ARM64, x86-64)

pygmtools-0.6.0-cp38-cp38-win_amd64.whl (310.8 kB view details)

Uploaded CPython 3.8Windows x86-64

pygmtools-0.6.0-cp38-cp38-manylinux2014_x86_64.whl (766.9 kB view details)

Uploaded CPython 3.8

pygmtools-0.6.0-cp38-cp38-macosx_11_0_universal2.whl (372.4 kB view details)

Uploaded CPython 3.8macOS 11.0+ universal2 (ARM64, x86-64)

File details

Details for the file pygmtools-0.6.0.tar.gz.

File metadata

  • Download URL: pygmtools-0.6.0.tar.gz
  • Upload date:
  • Size: 174.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for pygmtools-0.6.0.tar.gz
Algorithm Hash digest
SHA256 eac05393b8cf0cd19b61b9fa0bb0c494f25d0add709f60f891d1ab01bdd3a382
MD5 60b0693a09a97b3c1385e561d19873bc
BLAKE2b-256 157b0154e8c459c7043d3e05e1746e9b8e65e0c026872829b7114a3366deed6b

See more details on using hashes here.

File details

Details for the file pygmtools-0.6.0-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: pygmtools-0.6.0-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 310.8 kB
  • Tags: CPython 3.13, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.12

File hashes

Hashes for pygmtools-0.6.0-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 023202899b32c74e885fd3efeb9ec3cce3529fa254a9a503a16932ab5ac72ca1
MD5 cc15a8b1c9aad0d5e515d1cff34cf0b8
BLAKE2b-256 7049f5e61f779b535fe2ec174137bb42aa14ca21b5c04352b16610047c0f5b1c

See more details on using hashes here.

File details

Details for the file pygmtools-0.6.0-cp313-cp313-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pygmtools-0.6.0-cp313-cp313-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 dce4ecccf5d8939dfe5ea9499893d117340e1ebd5ca63da7f86048bcac058878
MD5 346a32daff09e1843facdc538743bc74
BLAKE2b-256 0da904ba22104570f928706a3b601426a556106ebe8a3c3dd59b33c817170b4b

See more details on using hashes here.

File details

Details for the file pygmtools-0.6.0-cp313-cp313-macosx_10_13_universal2.whl.

File metadata

File hashes

Hashes for pygmtools-0.6.0-cp313-cp313-macosx_10_13_universal2.whl
Algorithm Hash digest
SHA256 3d1c62211636e01f651ac4b89d34503b2730f45204c36f84ff4d86f9eb437003
MD5 bcf862028e784d85f63a5d330e6169b8
BLAKE2b-256 fcd7a50090759a741fe23fbdfc2509d4b11b1223f4a35479bec540f5658baadd

See more details on using hashes here.

File details

Details for the file pygmtools-0.6.0-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: pygmtools-0.6.0-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 312.3 kB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for pygmtools-0.6.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 96d4b0b845debb9f6ce4d908949ee5be4097fdfae889c4da970483cead1f1ba0
MD5 40fdbc272b5f627931d17db604b85f2f
BLAKE2b-256 79be904b2dac2114304074c28a794097ba37b722919693bcb9fb4b5f8554f295

See more details on using hashes here.

File details

Details for the file pygmtools-0.6.0-cp312-cp312-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pygmtools-0.6.0-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 448be617d47048cc829e1812e4d1fd2f601404c9ddceb902729e60cd03b3b927
MD5 6a7e179c6dec0b7e6cf4bf7d41055523
BLAKE2b-256 39dd071aadc531756e397f50480a6dfc9ab4933534725c123dac3f0665038652

See more details on using hashes here.

File details

Details for the file pygmtools-0.6.0-cp312-cp312-macosx_10_13_universal2.whl.

File metadata

File hashes

Hashes for pygmtools-0.6.0-cp312-cp312-macosx_10_13_universal2.whl
Algorithm Hash digest
SHA256 9f2294deb1ac892c97f8047fefef6ff040116e2fa3898ab37c2c65158050a45c
MD5 cbd5959630e3ff7d392636dcef4e9b2c
BLAKE2b-256 a13831158e41f6ea4f78faa7e016c7956b00001812c6eb931e45b7729ff4438d

See more details on using hashes here.

File details

Details for the file pygmtools-0.6.0-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: pygmtools-0.6.0-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 310.9 kB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for pygmtools-0.6.0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 0af26244588980c9204f3408d91745d3ada211879ab315bde0a9282af0f5433e
MD5 0d29a30878046b7c65b1956bffa4c5c4
BLAKE2b-256 a61fc27d17c5e76052ac46b086e07abbf5273593e6449f079b86d1e163280437

See more details on using hashes here.

File details

Details for the file pygmtools-0.6.0-cp311-cp311-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pygmtools-0.6.0-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 2f44f1b2e6ddfd37b75f8206d27b0247b20e36813da636a03451511c110fb321
MD5 fe875ea949be400e3dd4fd590cf298dd
BLAKE2b-256 be092536a13c64d1d3ed3fc486167184e2e782dc797032acfa617d2a744d00d6

See more details on using hashes here.

File details

Details for the file pygmtools-0.6.0-cp311-cp311-macosx_10_9_universal2.whl.

File metadata

File hashes

Hashes for pygmtools-0.6.0-cp311-cp311-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 df53033a96bcc34bf4f950eff960ea4f196b9beca78063a0e460db2c276610cc
MD5 16bc3392063467eff0164c2d2e533b74
BLAKE2b-256 a7881dca1af9457c6156cf45bfa0aa733daefe94294afc19e5e9d3827d47cbff

See more details on using hashes here.

File details

Details for the file pygmtools-0.6.0-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: pygmtools-0.6.0-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 311.7 kB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.11

File hashes

Hashes for pygmtools-0.6.0-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 47571e81b87d5eaa4135cdea1538145efeca17b29030f1fc3797fb310360b7f5
MD5 5236a5f501a1eaf166db8f757590c5d3
BLAKE2b-256 6817b800411e6c71f887438a875e77901e277c7748eaeb44a07f044059dffbc7

See more details on using hashes here.

File details

Details for the file pygmtools-0.6.0-cp310-cp310-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pygmtools-0.6.0-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 e9d67b2ddd1d1dfca44d095e69a814851a619b85d2e19ebd3496b948f1810142
MD5 8561cfe0df39247d647c4f399c810bc0
BLAKE2b-256 f7d8c90ed5cac0482f904202c43f01ffc562295e312f885dda7e33cf6b12ba6b

See more details on using hashes here.

File details

Details for the file pygmtools-0.6.0-cp310-cp310-macosx_10_9_universal2.whl.

File metadata

File hashes

Hashes for pygmtools-0.6.0-cp310-cp310-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 668338bb3e6ae8f1489c3c888bd2c0856c6db0f408ea7b7e1c13308cc5ed3572
MD5 5694d91c45e6c31c79c4c208f5feb29d
BLAKE2b-256 0db82567c86128c4e9f2d4f5fa7312712997d37454c19fd85bef2c0efc3c9f35

See more details on using hashes here.

File details

Details for the file pygmtools-0.6.0-cp39-cp39-win_amd64.whl.

File metadata

  • Download URL: pygmtools-0.6.0-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 312.0 kB
  • Tags: CPython 3.9, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.13

File hashes

Hashes for pygmtools-0.6.0-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 b448d3dc31e78ec7b4b234109bb0a574b5e52419c13eb9995f4306cddb0406c4
MD5 d6630c61776145da6ce03b5018015ea1
BLAKE2b-256 b33b62eea461cd8dbd61238673b420adf05496f8ffe8b0dbb1f84757e9752ed8

See more details on using hashes here.

File details

Details for the file pygmtools-0.6.0-cp39-cp39-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pygmtools-0.6.0-cp39-cp39-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 eeb387c000e4fda9fe728868cb552aa1fa44fa250ee7825a337f9bfe576a7aeb
MD5 a8b82f60cd090d106311d91c81033fb0
BLAKE2b-256 cb72069238d430e01b95ad2ebe468bbf034205858ff8bf53f47fea97c3478aa2

See more details on using hashes here.

File details

Details for the file pygmtools-0.6.0-cp39-cp39-macosx_10_9_universal2.whl.

File metadata

File hashes

Hashes for pygmtools-0.6.0-cp39-cp39-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 6e17752517b8c08a52d8265f2c1d4988c322c7d4e633fae1544b625daef7042e
MD5 fe4f1a3adcb559efc707d569a390c7eb
BLAKE2b-256 4186221357046566e31f61d8c38c4673ec8ac362208abfd9fc1a416513ac70c5

See more details on using hashes here.

File details

Details for the file pygmtools-0.6.0-cp38-cp38-win_amd64.whl.

File metadata

  • Download URL: pygmtools-0.6.0-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 310.8 kB
  • Tags: CPython 3.8, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.8.10

File hashes

Hashes for pygmtools-0.6.0-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 ee68dc3e60479899aa5ecae5c6802e37860f2f410d0461a27c72a3a4409dd7ce
MD5 48bb23b037b774196970e72f99c411b7
BLAKE2b-256 168d17ab6c4d256f6f6f4e83511bdc946c1a2e6ab30be7be5373ffee686cf1c8

See more details on using hashes here.

File details

Details for the file pygmtools-0.6.0-cp38-cp38-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pygmtools-0.6.0-cp38-cp38-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 f428f21ce75ca986f455308b67c8054f31e3cba8833778993114de4bb91eb329
MD5 3e78f31b9e4ee472a66d63f318e7f8f0
BLAKE2b-256 16db0860fb415117a313641237b3b66bc186e76eff5f14d5234e63f98ebfcf1c

See more details on using hashes here.

File details

Details for the file pygmtools-0.6.0-cp38-cp38-macosx_11_0_universal2.whl.

File metadata

File hashes

Hashes for pygmtools-0.6.0-cp38-cp38-macosx_11_0_universal2.whl
Algorithm Hash digest
SHA256 5c42c297974a3dd17b074a0e0db1302dda5538413331c6280a038bba90e0b21c
MD5 132013cde88cd3ebfaf8b0f067c0f3dc
BLAKE2b-256 f14b27abac9b4e7dfc1751130da890a5b48011f0b9904ca1e098c3ce2b843bac

See more details on using hashes here.

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