Package: pygmtools
pygmtoolsis published in JMLR! Pleasecite our paperif our tools are useful in your research!pygmtools(Python Graph Matching Tools) provides graph matching solvers in Python and is easily accessible via:$pipinstallpygmtoolsOfficial documentation:https://pygmtools.readthedocs.ioSource code:https://github.com/Thinklab-SJTU/pygmtoolsGraph 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,pygmtoolshas 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, includingnumpywhich 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.InstallationYou can install the stable release on PyPI:$pipinstallpygmtoolsor get the latest version by running:$pipinstall-Uhttps://github.com/Thinklab-SJTU/pygmtools/archive/master.zip# with --user for user install (no root)Now the pygmtools is available with thenumpybackend.The following packages are required, and shall be automatically installed bypip: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-timeoutAvailable Graph Matching SolversThis library offers user-friendly API for the following solvers:Two-Graph Matching SolversLinear assignment solvers including the differentiable softSinkhorn algorithm[1],
and the exact solverHungarian[2].Soft and differentiable quadratic assignment solvers, includingspectral graph matching[3]
andrandom-walk-based graph matching[4].Discrete (non-differentiable) quadratic assignment solverinteger projected fixed point method[5].Multi-Graph Matching SolversComposition based Affinity Optimization (CAO) solver[6]
by optimizing the affinity score, meanwhile gradually infusing the consistency.Multi-Graph Matching based onFloyd shortest path algorithm[7].Graduated-assignment based multi-graph matching solver[8][9]
by graduated annealing of Sinkhorn’s temperature.Neural Graph Matching SolversIntra-graph and cross-graph embedding based neural graph matching solversPCA-GMandIPCA-GM[10]
for matching individual graphs.Channel independent embedding (CIE)[11]
based neural graph matching solver for matching individual graphs.Neural graph matching solver (NGM)[12]
for the general quadratic assignment formulation.Graph edit neural network A-star (GENN-A*)[13]
for the graph edit distance problem.Available BackendsThis 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(defaultbackend, CPU only)PyTorch(GPU friendly, deep learning friendly)Jittor(GPU friendly, JIT support, deep learning friendly)PaddlePaddle(GPU friendly, deep learning friendly)Tensorflow(GPU friendly, deep learning friendly)Development statusNumpyPyTorchJittorPaddlePaddleTensorflowMindSporeLinear Solvers✔✔✔✔✔✔Classic Solvers✔✔✔✔✔✔Multi-Graph Solvers✔✔✔✔📆📆Neural Solvers✔✔✔✔📆📆Examples Gallery✔✔✔✔📆📆✔: Supported; 📆: Planned for future versions (contributions welcomed!).For more details, pleaseread the documentation.Pretrained ModelsThe 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 Benchmarkpygmtoolsis also featured with a standard data interface of several graph matching benchmarks. Please readthe corresponding documentationfor details.We also maintain a repository containing non-trivial implementation of deep graph matching models, please check outThinkMatchif you are interested!Chat with the CommunityIf you have any questions, or if you are experiencing any issues, feel free toraise an issueon GitHub.We also offer the following chat rooms if you are more comfortable with them:Discord (for English speakers):QQ Group (for Chinese speakers)/QQ群(中文用户): 696401889ContributingAny contributions/ideas/suggestions from the community is welcomed! Before starting your contribution, please read theContributing Guide.Developers and Maintainerspygmtoolsis developed and maintained by members fromThinkLabat
Shanghai Jiao Tong University.Citing Pygmtoolspygmtoolsis 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 Mathematics21.2 (1967): 343-348.[2] Munkres, James. "Algorithms for the assignment and transportation problems."Journal of the Society for Industrial and Applied Mathematics5.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 Systems22 (2009).[6] Yan, Junchi, et al. "Multi-graph matching via affinity optimization with graduated consistency regularization."IEEE Transactions on Pattern Analysis and Machine Intelligence38.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 Intelligence43.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 Intelligence27.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 Intelligence45.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 Intelligence45.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 Intelligence44.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.