{"id":13687689,"url":"https://github.com/sangyx/gtrick","last_synced_at":"2025-04-05T01:07:53.323Z","repository":{"id":37670314,"uuid":"446742508","full_name":"sangyx/gtrick","owner":"sangyx","description":"Bag of Tricks for Graph Neural Networks.","archived":false,"fork":false,"pushed_at":"2024-07-19T01:32:17.000Z","size":710,"stargazers_count":292,"open_issues_count":2,"forks_count":19,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-03-29T00:09:55.413Z","etag":null,"topics":["dgl","graph-neural-networks","torch-geometric"],"latest_commit_sha":null,"homepage":"https://sangyx.com/gtrick/","language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sangyx.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"sangyx"}},"created_at":"2022-01-11T08:42:34.000Z","updated_at":"2025-03-19T07:24:57.000Z","dependencies_parsed_at":"2024-01-14T16:10:34.700Z","dependency_job_id":"695400de-0c33-418a-afa4-1109589e4692","html_url":"https://github.com/sangyx/gtrick","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sangyx%2Fgtrick","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sangyx%2Fgtrick/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sangyx%2Fgtrick/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sangyx%2Fgtrick/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sangyx","download_url":"https://codeload.github.com/sangyx/gtrick/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247271530,"owners_count":20911587,"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":["dgl","graph-neural-networks","torch-geometric"],"created_at":"2024-08-02T15:00:58.786Z","updated_at":"2025-04-05T01:07:53.303Z","avatar_url":"https://github.com/sangyx.png","language":"Jupyter Notebook","funding_links":["https://github.com/sponsors/sangyx"],"categories":["Jupyter Notebook","Useful Third-Tools"],"sub_categories":[],"readme":"# gtrick: Bag of Tricks for Graph Neural Networks.\n\n![](https://img.shields.io/pypi/pyversions/gtrick) ![](https://img.shields.io/pypi/v/gtrick) ![](https://img.shields.io/pypi/dm/gtrick) ![](https://img.shields.io/pypi/l/gtrick) ![](https://img.shields.io/github/stars/sangyx/gtrick?style=social)\n\ngtrick is an easy-to-use Python package that collects tricks for graph neural networks. It tests and provides powerful tricks to boost your models' performance.\n\nTrick is all you need! ([English Document](https://sangyx.com/gtrick/) | [中文介绍](https://zhuanlan.zhihu.com/p/508876898))\n\n## Library Highlights\n* **Easy-to-use**: All it takes is to add a few lines of code to apply a powerful trick, with as few changes to existing code as possible.\n* **Verified Trick**: All tricks implemented in gtrick are tested on our selected datasets. Only the tricks indeed improving a model's performance can be collected by gtrick.\n* **Backend Free**: We provide all tricks both in [DGL](https://www.dgl.ai/) and [PyG](https://www.pyg.org/). Whatever graph learning library you use, feel free to try it.\n\n## Installation\n\n*Note: This is a developmental release.*\n\n```bash\npip install gtrick\n```\n\n## Quick Start\nIt is very easy to get started with gtrick. You can enhance your GNN model with only a few lines of code.\n\n![quickstart](imgs/quickstart.png)\n\nFor more detailed examples, see Example in [Trick](#trick).\n\n## Trick\n\n|     Trick    | Example | Task | Reference |\n|:------------:|:------------:|:------------:|:-----:|\n| VirtualNode |  [DGL](https://nbviewer.org/github/sangyx/gtrick/blob/main/benchmark/dgl/VirtualNode.ipynb)\u003cbr\u003e[PyG](https://nbviewer.org/github/sangyx/gtrick/blob/main/benchmark/pyg/VirtualNode.ipynb) | graph | [OGB Graph Property Prediction Examples](https://github.com/snap-stanford/ogb/tree/master/examples/graphproppred/mol) |\n| FLAG |  [DGL](https://nbviewer.org/github/sangyx/gtrick/blob/main/benchmark/dgl/FLAG.ipynb)\u003cbr\u003e[PyG](https://nbviewer.org/github/sangyx/gtrick/blob/main/benchmark/pyg/FLAG.ipynb) | node*\u003cbr\u003egraph | [Robust Optimization as Data Augmentation for Large-scale Graphs](https://arxiv.org/abs/2010.09891) |\n| Fingerprint |  [DGL](https://nbviewer.org/github/sangyx/gtrick/blob/main/benchmark/dgl/Fingerprint.ipynb)\u003cbr\u003e[PyG](https://nbviewer.org/github/sangyx/gtrick/blob/main/benchmark/pyg/Fingerprint.ipynb) | molecular graph* | [Extended-Connectivity Fingerprints](https://pubs.acs.org/doi/10.1021/ci100050t) |\n| Random Feature |  [DGL](https://nbviewer.org/github/sangyx/gtrick/blob/main/benchmark/dgl/RandomFeature.ipynb)\u003cbr\u003e[PyG](https://nbviewer.org/github/sangyx/gtrick/blob/main/benchmark/pyg/RandomFeature.ipynb) | graph* | [Random Features Strengthen Graph Neural Networks](http://arxiv.org/abs/2002.03155) |\n| Label Propagation |  [DGL](https://nbviewer.org/github/sangyx/gtrick/blob/main/benchmark/dgl/LabelProp.ipynb)\u003cbr\u003e[PyG](https://nbviewer.org/github/sangyx/gtrick/blob/main/benchmark/pyg/LabelProp.ipynb) | node* | [Learning from Labeled and Unlabeled Data with Label Propagation](http://mlg.eng.cam.ac.uk/zoubin/papers/CMU-CALD-02-107.pdf) |\n| Correct \u0026 Smooth |  [DGL](https://nbviewer.org/github/sangyx/gtrick/blob/main/benchmark/dgl/C\u0026S.ipynb)\u003cbr\u003e[PyG](https://nbviewer.org/github/sangyx/gtrick/blob/main/benchmark/pyg/C\u0026S.ipynb) | node* | [Combining Label Propagation And Simple Models Out-performs Graph Neural Networks](https://arxiv.org/abs/2010.13993) |\n| Common Neighbors |  [DGL](https://nbviewer.org/github/sangyx/gtrick/blob/main/benchmark/dgl/EdgeFeat.ipynb)\u003cbr\u003e[PyG](https://nbviewer.org/github/sangyx/gtrick/blob/main/benchmark/pyg/EdgeFeat.ipynb) | link* | [Link Prediction with Structural Information](https://github.com/lustoo/OGB_link_prediction/blob/main/Link%20prediction%20with%20structural%20information.pdf) |\n| Resource Allocation |  [DGL](https://nbviewer.org/github/sangyx/gtrick/blob/main/benchmark/dgl/EdgeFeat.ipynb)\u003cbr\u003e[PyG](https://nbviewer.org/github/sangyx/gtrick/blob/main/benchmark/pyg/EdgeFeat.ipynb) | link* | [Link Prediction with Structural Information](https://github.com/lustoo/OGB_link_prediction/blob/main/Link%20prediction%20with%20structural%20information.pdf) |\n| Adamic Adar |  [DGL](https://nbviewer.org/github/sangyx/gtrick/blob/main/benchmark/dgl/EdgeFeat.ipynb)\u003cbr\u003e[PyG](https://nbviewer.org/github/sangyx/gtrick/blob/main/benchmark/pyg/EdgeFeat.ipynb) | link* | [Link Prediction with Structural Information](https://github.com/lustoo/OGB_link_prediction/blob/main/Link%20prediction%20with%20structural%20information.pdf) |\n| Anchor Distance |  [DGL](https://nbviewer.org/github/sangyx/gtrick/blob/main/benchmark/dgl/EdgeFeat.ipynb)\u003cbr\u003e[PyG](https://nbviewer.org/github/sangyx/gtrick/blob/main/benchmark/pyg/EdgeFeat.ipynb) | link* | [Link Prediction with Structural Information](https://github.com/lustoo/OGB_link_prediction/blob/main/Link%20prediction%20with%20structural%20information.pdf) |\n\nWe have tested all these tricks on selected datasets, you can find the benchmark in [PyG Benchmark](benchmark/pyg/README.md) and [DGL Benchmark](benchmark/dgl/README.md).\n\n*For the ogbg-molhiv GIN, please refer to [@willy-b](https://github.com/willy-b)'s [code](https://colab.research.google.com/drive/1MluOH3pOafwGdt9TKMqOBLfvLyeeDMX1?usp=sharing).*\n\n## Contributing\nPlease let me know if you encounter a bug or have any suggestions by [filing an issue](https://github.com/sangyx/gtrick/issues).\n\nAll contributions for bug fixes, new tricks, and better examples are welcome. \n\nThere are also some tricks I'm planning to add, feel free to implement one of them for gtrick:\n\n- [ ] [SCR](https://github.com/THUDM/SCR)\n- [ ] [GSAT](https://github.com/Graph-COM/GSAT)\n- [ ] [Edge Proposal Set](https://arxiv.org/pdf/2106.15810.pdf)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsangyx%2Fgtrick","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsangyx%2Fgtrick","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsangyx%2Fgtrick/lists"}