{"id":20064794,"url":"https://github.com/thinklab-sjtu/pygmtools","last_synced_at":"2026-04-02T22:40:19.204Z","repository":{"id":41197155,"uuid":"418584043","full_name":"Thinklab-SJTU/pygmtools","owner":"Thinklab-SJTU","description":"A Python Graph Matching Toolkit.","archived":false,"fork":false,"pushed_at":"2024-10-21T16:00:08.000Z","size":134496,"stargazers_count":332,"open_issues_count":2,"forks_count":19,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-05-15T06:49:51.997Z","etag":null,"topics":["combinatorial-optimization","deep-learning","graph-matching","python-library"],"latest_commit_sha":null,"homepage":"https://pygmtools.readthedocs.io/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Thinklab-SJTU.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":"CITATION.cff","codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2021-10-18T16:33:24.000Z","updated_at":"2025-05-12T07:36:29.000Z","dependencies_parsed_at":"2023-02-02T11:16:37.779Z","dependency_job_id":"807067e4-06e5-4c02-9b1d-8292991ad2ff","html_url":"https://github.com/Thinklab-SJTU/pygmtools","commit_stats":null,"previous_names":[],"tags_count":31,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Thinklab-SJTU%2Fpygmtools","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Thinklab-SJTU%2Fpygmtools/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Thinklab-SJTU%2Fpygmtools/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Thinklab-SJTU%2Fpygmtools/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Thinklab-SJTU","download_url":"https://codeload.github.com/Thinklab-SJTU/pygmtools/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254291831,"owners_count":22046408,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["combinatorial-optimization","deep-learning","graph-matching","python-library"],"created_at":"2024-11-13T13:47:48.109Z","updated_at":"2026-04-02T22:40:19.196Z","avatar_url":"https://github.com/Thinklab-SJTU.png","language":"Python","readme":"\u003cimg src=\"https://pygmtools.readthedocs.io/en/latest/_static/images/pygmtools_logo.svg\" alt=\"pygmtools: Python Graph Matching Tools\" width=\"800\"/\u003e\n\n[![PyPi version](https://badgen.net/pypi/v/pygmtools/)](https://pypi.org/pypi/pygmtools/)\n[![PyPI pyversions](https://img.shields.io/badge/dynamic/json?color=blue\u0026label=python\u0026query=info.requires_python\u0026url=https%3A%2F%2Fpypi.org%2Fpypi%2Fpygmtools%2Fjson)](https://pypi.python.org/pypi/pygmtools/)\n[![Downloads](https://static.pepy.tech/badge/pygmtools)](https://pepy.tech/project/pygmtools)\n[![Documentation Status](https://readthedocs.org/projects/pygmtools/badge/?version=latest)](https://pygmtools.readthedocs.io/en/latest/?badge=latest)\n[![codecov](https://codecov.io/gh/Thinklab-SJTU/pygmtools/branch/main/graph/badge.svg?token=Q68XTY0N0C)](https://codecov.io/gh/Thinklab-SJTU/pygmtools)\n[![discord channel](https://img.shields.io/discord/1028701206526304317.svg?\u0026color=blueviolet\u0026label=discord)](https://discord.gg/8m6n7rRz9T)\n[![QQ group](https://img.shields.io/badge/QQ%20group-696401889-blue)](https://qm.qq.com/cgi-bin/qm/qr?k=QolXYJn_M5ilDEM9e2jEjlPnJ02Ktabd\u0026jump_from=webapi\u0026authKey=6zG6D/Js4YF5h5zj778aO5MDKOXBwPFi8gQ4LsXJN8Hn1V8uCVGV81iT4J/FjPGT)\n[![GitHub stars](https://img.shields.io/github/stars/Thinklab-SJTU/pygmtools.svg?style=social\u0026label=Star\u0026maxAge=8640)](https://GitHub.com/Thinklab-SJTU/pygmtools/stargazers/) \n\n-----------------------------------------\n\n![News](https://img.shields.io/badge/news!-03e8fc) \n``pygmtools`` is published in JMLR! Please [cite our paper](#citing-pygmtools)\nif our tools are useful in your research!\n\n-----------------------------------------\n\n``pygmtools`` (Python Graph Matching Tools) provides graph matching solvers in Python and is easily accessible via:\n\n```bash\n$ pip install pygmtools\n```\n\nOfficial documentation: https://pygmtools.readthedocs.io\n\nSource code: https://github.com/Thinklab-SJTU/pygmtools\n\nGraph matching is a fundamental yet challenging problem in pattern recognition, data mining, and others.\nGraph matching aims to find node-to-node correspondence among multiple graphs, by solving an NP-hard combinatorial\noptimization problem.\n\nDoing graph matching in Python used to be difficult, and this library wants to make researchers' lives easier. \nTo highlight, ``pygmtools`` has the following features:\n\n* *Support various solvers*, including traditional combinatorial solvers (including linear, quadratic, and multi-graph) \n  and novel deep learning-based solvers;\n* *Support various backends*, including ``numpy`` which is universally accessible, and some state-of-the-art deep \n  learning architectures with GPU support: \n  ``pytorch``, ``paddle``, ``jittor``, ``tensorflow``, ``mindspore``; \n* *Deep learning friendly*, the operations are designed to best preserve the gradient during computation and batched \n  operations support for the best performance.\n  \n## Installation\n\nYou can install the stable release on PyPI:\n\n```bash\n$ pip install pygmtools\n```\n\nor get the latest version by running:\n\n```bash\n$ pip install -U https://github.com/Thinklab-SJTU/pygmtools/archive/master.zip # with --user for user install (no root)\n```\n\nNow the pygmtools is available with the ``numpy`` backend.\n\nThe following packages are required, and shall be automatically installed by ``pip``:\n\n```\nPython \u003e= 3.8\nrequests \u003e= 2.25.1\nscipy \u003e= 1.4.1\nPillow \u003e= 7.2.0\nnumpy \u003e= 1.18.5\neasydict \u003e= 1.7\nappdirs \u003e= 1.4.4\ntqdm \u003e= 4.64.1\nnetworkx \u003e= 2.8.8\naiohttp\nasync-timeout\n```\n  \n## Available Graph Matching Solvers\nThis library offers user-friendly API for the following solvers:\n\n* [Two-Graph Matching Solvers](https://pygmtools.readthedocs.io/en/latest/api/_autosummary/pygmtools.classic_solvers.html)\n    * Linear assignment solvers including the differentiable soft \n      [Sinkhorn algorithm](https://pygmtools.readthedocs.io/en/latest/api/_autosummary/pygmtools.linear_solvers.sinkhorn.html) [1], \n      and the exact solver [Hungarian](https://pygmtools.readthedocs.io/en/latest/api/_autosummary/pygmtools.linear_solvers.hungarian.html) [2].\n    * Soft and differentiable quadratic assignment solvers, including [spectral graph matching](https://pygmtools.readthedocs.io/en/latest/api/_autosummary/pygmtools.classic_solvers.sm.html) [3] \n      and [random-walk-based graph matching](https://pygmtools.readthedocs.io/en/latest/api/_autosummary/pygmtools.classic_solvers.rrwm.html) [4].\n    * Discrete (non-differentiable) quadratic assignment solver \n      [integer projected fixed point method](https://pygmtools.readthedocs.io/en/latest/api/_autosummary/pygmtools.classic_solvers.ipfp.html) [5]. \n* [Multi-Graph Matching Solvers](https://pygmtools.readthedocs.io/en/latest/api/_autosummary/pygmtools.multi_graph_solvers.html)\n    * [Composition based Affinity Optimization (CAO) solver](https://pygmtools.readthedocs.io/en/latest/api/_autosummary/pygmtools.multi_graph_solvers.cao.html) [6] \n      by optimizing the affinity score, meanwhile gradually infusing the consistency.\n    * Multi-Graph Matching based on \n      [Floyd shortest path algorithm](https://pygmtools.readthedocs.io/en/latest/api/_autosummary/pygmtools.multi_graph_solvers.mgm_floyd.html) [7].\n    * [Graduated-assignment based multi-graph matching solver](https://pygmtools.readthedocs.io/en/latest/api/_autosummary/pygmtools.multi_graph_solvers.gamgm.html) [8][9]\n      by graduated annealing of Sinkhorn’s temperature.\n* [Neural Graph Matching Solvers](https://pygmtools.readthedocs.io/en/latest/api/_autosummary/pygmtools.neural_solvers.html)\n    * Intra-graph and cross-graph embedding based neural graph matching solvers \n      [PCA-GM](https://pygmtools.readthedocs.io/en/latest/api/_autosummary/pygmtools.neural_solvers.pca_gm.html) \n      and [IPCA-GM](https://pygmtools.readthedocs.io/en/latest/api/_autosummary/pygmtools.neural_solvers.ipca_gm.html) [10]\n      for matching individual graphs.\n    * [Channel independent embedding (CIE)](https://pygmtools.readthedocs.io/en/latest/api/_autosummary/pygmtools.neural_solvers.cie.html) [11]\n      based neural graph matching solver for matching individual graphs.\n    * [Neural graph matching solver (NGM)](https://pygmtools.readthedocs.io/en/latest/api/_autosummary/pygmtools.neural_solvers.ngm.html) [12]\n      for the general quadratic assignment formulation.\n    * [Graph edit neural network A-star (GENN-A*)](https://pygmtools.readthedocs.io/en/latest/api/_autosummary/pygmtools.neural_solvers.genn_astar.html) [13] \n      for the graph edit distance problem.\n\n## Available Backends\nThis library is designed to support multiple backends with the same set of API. \nPlease follow the official instructions to install your backend.\n\nThe following backends are available:\n\n* [Numpy](https://numpy.org/) (**default** backend, CPU only)\n\n\u003cimg src=\"https://pygmtools.readthedocs.io/en/latest/_images/numpy_logo.png\" alt=\"numpy logo\" width=\"200\"/\u003e\n\n* [PyTorch](https://pytorch.org/) (GPU friendly, deep learning friendly)\n\n\u003cimg src=\"https://pygmtools.readthedocs.io/en/latest/_images/pytorch_logo.png\" alt=\"pytorch logo\" width=\"200\"/\u003e\n\n* [Jittor](https://github.com/Jittor/Jittor) (GPU friendly, JIT support, deep learning friendly)\n\n\u003cimg src=\"https://pygmtools.readthedocs.io/en/latest/_images/jittor_logo.png\" alt=\"jittor logo\" width=\"200\"/\u003e\n\n* [PaddlePaddle](https://www.paddlepaddle.org.cn/en) (GPU friendly, deep learning friendly)\n\n\u003cimg src=\"https://pygmtools.readthedocs.io/en/latest/_images/paddle_logo.png\" alt=\"paddle logo\" width=\"200\"/\u003e\n\n* [Tensorflow](https://tensorflow.google.cn/) (GPU friendly, deep learning friendly)\n\n\u003cimg src=\"https://pygmtools.readthedocs.io/en/latest/_images/tensorflow_logo.png\" alt=\"tensorflow logo\" width=\"200\"/\u003e\n\n* [MindSpore](https://www.mindspore.cn/) (GPU friendly, deep learning friendly)\n\n\u003cimg src=\"https://pygmtools.readthedocs.io/en/latest/_images/mindspore_logo.png\" alt=\"mindspore logo\" width=\"200\"/\u003e\n\nFor more details, please [read the documentation](https://pygmtools.readthedocs.io/en/latest/guide/get_started.html#install-other-backends).\n\n## Pretrained Models\n\nThe library includes several neural network solvers. The pretrained models shall be automatically downloaded upon \nneeded from the hosted model repository. If you are experiencing issues with automatic download, please download the\npretrained models manually and put them at ``~/.cache/pygmtools`` (for Linux).\n\nAvailable at:\n[[huggingface]](https://huggingface.co/heatingma/pygmtools/tree/main)\n[[google drive]](https://drive.google.com/drive/folders/1O7vkIW8QXBJsNsHUIRiSw91HJ_0FAzu_?usp=sharing)\n[[baidu drive]](https://pan.baidu.com/s/1MvzfM52NJeLWx2JXbbc6HA?pwd=x8bv)\n\n## The Deep Graph Matching Benchmark\n\n``pygmtools`` is also featured with a standard data interface of several graph matching benchmarks. Please read \n[the corresponding documentation](https://pygmtools.readthedocs.io/en/latest/guide/benchmark.html) for details.\n\nWe also maintain a repository containing non-trivial implementation of deep graph matching models, please check out\n[ThinkMatch](https://thinkmatch.readthedocs.io/) if you are interested!\n\n## Chat with the Community\n\nIf you have any questions, or if you are experiencing any issues, feel free to [raise an issue](https://github.com/Thinklab-SJTU/pygmtools/issues/new) on GitHub. \n\nWe also offer the following chat rooms if you are more comfortable with them:\n\n* Discord (for English speakers): \n  \n  [![discord](https://discordapp.com/api/guilds/1028701206526304317/widget.png?style=banner2)](https://discord.gg/8m6n7rRz9T)\n\n* QQ Group (for Chinese speakers)/QQ群(中文用户): 696401889\n  \n  [![ThinkMatch/pygmtools交流群](http://pub.idqqimg.com/wpa/images/group.png)](https://qm.qq.com/cgi-bin/qm/qr?k=NlPuwwvaFaHzEWD8w7jSOTzoqSLIM80V\u0026jump_from=webapi\u0026authKey=chI2htrWDujQed6VtVid3V1NXEoJvwz3MVwruax6x5lQIvLsC8BmpmzBJOCzhtQd)\n\n## Contributing\nAny contributions/ideas/suggestions from the community is welcomed! Before starting your contribution, please read the\n[Contributing Guide](https://github.com/Thinklab-SJTU/pygmtools/blob/main/CONTRIBUTING.md).\n\n## Developers and Maintainers\n\n``pygmtools`` is developed and maintained by members from [ThinkLab](http://thinklab.sjtu.edu.cn) at \nShanghai Jiao Tong University.\n\n## Citing Pygmtools\n\n``pygmtools`` is published on Journal of Machine Learning Research (JMLR). If you find our toolkit helpful in your \nresearch, please cite:\n```\nRunzhong 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.\nPygmtools: A Python Graph Matching Toolkit.\nJournal of Machine Learning Research, 25(33):1−7, 2024.\n```\n\nIn Bibtex format:\n```\n@article{wang2024pygm,\n  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},\n  title   = {Pygmtools: A Python Graph Matching Toolkit},\n  journal = {Journal of Machine Learning Research},\n  year    = {2024},\n  volume  = {25},\n  number  = {33},\n  pages   = {1-7},\n  url     = {https://jmlr.org/papers/v25/23-0572.html},\n}\n```\n\n## References\n\u003c!--MLA style references--\u003e\n\n[1] Sinkhorn, Richard, and Paul Knopp. \"Concerning nonnegative matrices and doubly stochastic matrices.\" _Pacific Journal of Mathematics_ 21.2 (1967): 343-348.\n\n[2] Munkres, James. \"Algorithms for the assignment and transportation problems.\" _Journal of the Society for Industrial and Applied Mathematics_ 5.1 (1957): 32-38.\n\n[3] Leordeanu, Marius, and Martial Hebert. \"A spectral technique for correspondence problems using pairwise constraints.\" _International Conference on Computer Vision_ (2005).\n\n[4] Cho, Minsu, Jungmin Lee, and Kyoung Mu Lee. \"Reweighted random walks for graph matching.\" _European conference on Computer Vision_ (2010).\n\n[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).\n\n[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.\n\n[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.\n\n[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.\n\n[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.\n\n[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.\n\n[11] Yu, Tianshu, et al. \"Learning deep graph matching with channel-independent embedding and hungarian attention.\" _International Conference on Learning Representations_. 2019.\n\n[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.\n\n[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.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthinklab-sjtu%2Fpygmtools","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthinklab-sjtu%2Fpygmtools","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthinklab-sjtu%2Fpygmtools/lists"}