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

Development status

Numpy PyTorch Jittor PaddlePaddle Tensorflow MindSpore
Linear Solvers
Classic Solvers
Multi-Graph Solvers 📆 📆
Neural Solvers 📆 📆
Examples Gallery 📆 📆

✔: Supported; 📆: Planned for future versions (contributions welcomed!).

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 Google Drive. If you are experiencing issues accessing Google Drive, please download the pretrained models manually and put them at ~/.cache/pygmtools (for Linux).

Available at: [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.5.5.tar.gz (164.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.5.5-cp313-cp313-win_amd64.whl (297.7 kB view details)

Uploaded CPython 3.13Windows x86-64

pygmtools-0.5.5-cp313-cp313-manylinux2014_x86_64.whl (768.8 kB view details)

Uploaded CPython 3.13

pygmtools-0.5.5-cp313-cp313-macosx_10_13_universal2.whl (358.1 kB view details)

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

pygmtools-0.5.5-cp312-cp312-win_amd64.whl (299.1 kB view details)

Uploaded CPython 3.12Windows x86-64

pygmtools-0.5.5-cp312-cp312-manylinux2014_x86_64.whl (776.6 kB view details)

Uploaded CPython 3.12

pygmtools-0.5.5-cp312-cp312-macosx_10_13_universal2.whl (361.7 kB view details)

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

pygmtools-0.5.5-cp311-cp311-win_amd64.whl (298.1 kB view details)

Uploaded CPython 3.11Windows x86-64

pygmtools-0.5.5-cp311-cp311-manylinux2014_x86_64.whl (764.1 kB view details)

Uploaded CPython 3.11

pygmtools-0.5.5-cp311-cp311-macosx_10_9_universal2.whl (361.3 kB view details)

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

pygmtools-0.5.5-cp310-cp310-win_amd64.whl (298.3 kB view details)

Uploaded CPython 3.10Windows x86-64

pygmtools-0.5.5-cp310-cp310-manylinux2014_x86_64.whl (750.2 kB view details)

Uploaded CPython 3.10

pygmtools-0.5.5-cp310-cp310-macosx_10_9_universal2.whl (360.2 kB view details)

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

pygmtools-0.5.5-cp39-cp39-win_amd64.whl (298.7 kB view details)

Uploaded CPython 3.9Windows x86-64

pygmtools-0.5.5-cp39-cp39-manylinux2014_x86_64.whl (748.5 kB view details)

Uploaded CPython 3.9

pygmtools-0.5.5-cp39-cp39-macosx_10_9_universal2.whl (360.4 kB view details)

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

pygmtools-0.5.5-cp38-cp38-win_amd64.whl (297.2 kB view details)

Uploaded CPython 3.8Windows x86-64

pygmtools-0.5.5-cp38-cp38-manylinux2014_x86_64.whl (752.4 kB view details)

Uploaded CPython 3.8

pygmtools-0.5.5-cp38-cp38-macosx_11_0_universal2.whl (360.0 kB view details)

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

File details

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

File metadata

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

File hashes

Hashes for pygmtools-0.5.5.tar.gz
Algorithm Hash digest
SHA256 9dba7c44c0ff1c229323170b018168b0e0df5485b662a8c72dd90a3880ed4f26
MD5 9173ee2736406a051d78304d05d8ecbe
BLAKE2b-256 adf4ad605a9eb0fa055cd046387cc1da61d9e0155c4df081427606b57009e70c

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for pygmtools-0.5.5-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 1fea270a3ce128e42ac80c5b98582e184507622e95b456df9c92a2e63599d2a5
MD5 ad4595016cbe10e241360bdd4e2e28a6
BLAKE2b-256 3fbea9e606fb0419777363b2a33d57ed162b6e4281fa77b79be5e2e82d53c19d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pygmtools-0.5.5-cp313-cp313-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 353e5ec2eb80fa06f6ff0c5e2c20aec805ba618beeb7f5ca3958f597764bc1ce
MD5 dc20a19e8217bad1bc3db3a222ba6f13
BLAKE2b-256 fcaea9dbba601ae55dd1ae4a6ecfc5f469fb7e623122f24f9ddfd00ad67e5576

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pygmtools-0.5.5-cp313-cp313-macosx_10_13_universal2.whl
Algorithm Hash digest
SHA256 841b40776b37221e601d8b6bfea9c8840b414a07e34fef35d31b742da0104813
MD5 da079c24829d1a5d1ceefd897d49d4bf
BLAKE2b-256 afc29e6156248e39ef86ae38810801b93d0cfeaeb1e4fda387e3e50e5ddf1957

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pygmtools-0.5.5-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 299.1 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.5.5-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 212f00d1f288d8b908ead50374800b277863b5bd570a96c31797153cf9201b97
MD5 56d37b32c942aca190bc4bc8c1ee6665
BLAKE2b-256 ae3ee46895880af44e1914b50219df23aa0a6028c03b0d61d8f3861a2d82ddfb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pygmtools-0.5.5-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 1a197f012741e6400a944e80cb03cf8f8fc8a0787ebbe3a8d3f5219b6b17db1a
MD5 2e38b364dfdef596c7ce8c8a5199a67d
BLAKE2b-256 6cf48dc26d10c58c9bf548052c4b2057bc2a47927008933ea3612a84447bb6c9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pygmtools-0.5.5-cp312-cp312-macosx_10_13_universal2.whl
Algorithm Hash digest
SHA256 baec009137d8096a6beffb106277b62eb52f36be217741aa72ba8d4389355390
MD5 c98b45e5cee8bfcd20a326d2aedae8a9
BLAKE2b-256 3a4a108ceb385b3b5bdec015dbc78896de56e88e511804954edbab9050b610d6

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pygmtools-0.5.5-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 298.1 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.5.5-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 bf19d221c73581b4cf37f06baca844dbef3ff6c0b02f8fcdb2b8729072620873
MD5 3fc02e96cdb9226168bf7d526a46f7f8
BLAKE2b-256 af97ae3baa00cb1007ecb3c8ccb4d6a8adb3409c2c3204474b0fac23604589f5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pygmtools-0.5.5-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 23467dac7f05bf66ccf37cd6ae760ccb43ae564305c96f8363d647fd933a0032
MD5 54465b8bdd9aa099add166d580112b6c
BLAKE2b-256 9e26d4be11ccc5b36d29d42138013d1205b939a92bece18240c8e4608c7df78b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pygmtools-0.5.5-cp311-cp311-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 a467ba5ee08e5ba9cd76f243d57d88cfcea819682c01047c27116bae9f674744
MD5 a43706080b73954d15c5d10ee23d07bb
BLAKE2b-256 d5c6c6ff18e3777b2c9f9fdcd25efb009b7b52292fb21bba900bb9e1d014cd9d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pygmtools-0.5.5-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 298.3 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.5.5-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 366562d94bff1665e6dc953e48dad1fb966a90bff0580ebfef8827b7419d8544
MD5 0883c836e3730205b0094fcb834644b1
BLAKE2b-256 6ff19d957787e3e17681d5e0e12c865e7ba683b3d30002462cd9254ee391503b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pygmtools-0.5.5-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 c4b8b00a7a0309581d6b238ae46b82e1b8e9d67485c9304efdebac6b9b248ff9
MD5 ce1a0bc868de1eb746ad3d6b19101a79
BLAKE2b-256 754ac592fc636c06dac585b2695b98a921a633f906327355dac3df2cbf93f89c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pygmtools-0.5.5-cp310-cp310-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 526a8b2ef120e760d8c1b1583bf71a29342eb040425df4a7e7659e4181196e2d
MD5 2cc3013938649ad01e7f6f592453dab3
BLAKE2b-256 d4e9af62905254f7f11f4b46eea78bd7943b966e3e07de61de74d1b430bc4398

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pygmtools-0.5.5-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 298.7 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.5.5-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 0c9aed068a6e80481240d86376504d69e4b44e1e7c26c4ed949f33e5eb2e5833
MD5 59c2ddfe0522098adae99d8bf67c6cf2
BLAKE2b-256 a99faf0f94920f11463595929120ddf927e248b5c48c3c26629d5fb22b9f80d4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pygmtools-0.5.5-cp39-cp39-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 1086dfe6fdf744dc100a6338b79813ad58819e13e030245733e205364423695f
MD5 157797d22794eef237eb9a5c58798c7c
BLAKE2b-256 d1908725d963e1fec6a148909b3e0a261e9745a62a86ba542667aed9900f5b32

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pygmtools-0.5.5-cp39-cp39-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 a26bf098c68cfe6e832ad76354fafbaa1dbf37377f9dd8bff5e9f2a79a83d282
MD5 cca736ac45c7440f04cf3e789af0ffb8
BLAKE2b-256 374e8478c65cd733e41ef3e64db32eb3261958564aa58e80a21175ffaca7a37b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pygmtools-0.5.5-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 297.2 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.5.5-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 34661e6e96ea5d62ede8ac7ca9612f12ed84a54234a56d51bbf48e230377c380
MD5 a556d5222971bcfbcf615d844d847b54
BLAKE2b-256 ea43bd0e530650f49b273adf563bcf9987915d1b4f707fae18ffe9ef400d18f7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pygmtools-0.5.5-cp38-cp38-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 d3138096b4f4a25c8078c1a8c5c066731432cedbe7a3e9c530f70c428e61b013
MD5 4f4c624f087110bcae01a1d83e6c21cb
BLAKE2b-256 59b6ff74738b1ab0733714d73b31842715320dd9099bcc4c3aa42b7dc8c35cbd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pygmtools-0.5.5-cp38-cp38-macosx_11_0_universal2.whl
Algorithm Hash digest
SHA256 b0dfac16ca8e0e4fb89d6c9adfb79ac8a519c24f38fda28f680a6b4fdfe3300f
MD5 33dfba13b2957036c827bcc5f44bf67e
BLAKE2b-256 5c907485a7bd5618f00eb68831ffda32ca2ce04c5ea37526d61c9784964ee7e0

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