{"id":13476927,"url":"https://github.com/twitter-research/graph-neural-pde","last_synced_at":"2025-03-27T04:31:36.965Z","repository":{"id":40361825,"uuid":"327411458","full_name":"twitter-research/graph-neural-pde","owner":"twitter-research","description":"Graph Neural PDEs","archived":false,"fork":false,"pushed_at":"2022-10-20T12:46:02.000Z","size":19232,"stargazers_count":322,"open_issues_count":5,"forks_count":52,"subscribers_count":12,"default_branch":"main","last_synced_at":"2024-12-06T21:50:35.915Z","etag":null,"topics":["deep-learning","graph-convolutional-networks","graph-neural-networks","partial-differential-equations","pytorch"],"latest_commit_sha":null,"homepage":"","language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/twitter-research.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-01-06T19:34:09.000Z","updated_at":"2024-11-28T14:35:54.000Z","dependencies_parsed_at":"2022-08-09T18:11:46.665Z","dependency_job_id":null,"html_url":"https://github.com/twitter-research/graph-neural-pde","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/twitter-research%2Fgraph-neural-pde","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/twitter-research%2Fgraph-neural-pde/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/twitter-research%2Fgraph-neural-pde/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/twitter-research%2Fgraph-neural-pde/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/twitter-research","download_url":"https://codeload.github.com/twitter-research/graph-neural-pde/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245784988,"owners_count":20671621,"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":["deep-learning","graph-convolutional-networks","graph-neural-networks","partial-differential-equations","pytorch"],"created_at":"2024-07-31T16:01:36.274Z","updated_at":"2025-03-27T04:31:36.958Z","avatar_url":"https://github.com/twitter-research.png","language":"Jupyter Notebook","funding_links":[],"categories":["Jupyter Notebook"],"sub_categories":[],"readme":"![example workflow](https://github.com/twitter-research/graph-neural-pde/actions/workflows/python-package.yml/badge.svg)\n\n![Cora_animation_16](https://user-images.githubusercontent.com/5874124/143270624-265c2d01-39ca-488c-b118-b68f876dfbfa.gif)\n\n## Introduction\n\nThis repository contains the source code for the publications [GRAND: Graph Neural Diffusion](https://icml.cc/virtual/2021/poster/8889) and [Beltrami Flow and Neural Diffusion on Graphs (BLEND)](https://arxiv.org/abs/2110.09443).\nThese approaches treat deep learning on graphs as a continuous diffusion process and Graph Neural\nNetworks (GNNs) as discretisations of an underlying PDE. In both models, the layer structure and\ntopology correspond to the discretisation choices\nof temporal and spatial operators. Our approach allows a principled development of a broad new\nclass of GNNs that are able to address the common plights of graph learning models such as\ndepth, oversmoothing, and bottlenecks. Key to\nthe success of our models are stability with respect to perturbations in the data and this is addressed for both \nimplicit and explicit discretisation schemes. We develop linear and nonlinear\nversions of GRAND, which achieve competitive results on many standard graph benchmarks. BLEND is a non-Euclidean extension of GRAND that jointly evolves the feature and positional encodings of each node providing a principled means to perform graph rewiring.\n\n## Running the experiments\n\n### Requirements\nDependencies (with python \u003e= 3.7):\nMain dependencies are\ntorch==1.8.1\ntorch-cluster==1.5.9\ntorch-geometric==1.7.0\ntorch-scatter==2.0.6\ntorch-sparse==0.6.9\ntorch-spline-conv==1.2.1\ntorchdiffeq==0.2.1\nCommands to install all the dependencies in a new conda environment\n```\nconda create --name grand python=3.7\nconda activate grand\n\npip install ogb pykeops\npip install torch==1.8.1\npip install torchdiffeq -f https://pytorch-geometric.com/whl/torch-1.8.1+cu102.html\n\npip install torch-scatter -f https://pytorch-geometric.com/whl/torch-1.8.1+cu102.html\npip install torch-sparse -f https://pytorch-geometric.com/whl/torch-1.8.1+cu102.html\npip install torch-cluster -f https://pytorch-geometric.com/whl/torch-1.8.1+cu102.html\npip install torch-spline-conv -f https://pytorch-geometric.com/whl/torch-1.8.1+cu102.html\npip install torch-geometric\n```\n\n### Troubleshooting\n\nThere is a bug in pandas==1.3.1 that could produce the error ImportError: cannot import name 'DtypeObj' from 'pandas._typing'\nIf encountered, then the fix is \npip install pandas==1.3.0 -U\n\n## GRAND (Graph Neural Diffusion)\n\n### Dataset and Preprocessing\ncreate a root level folder\n```\n./data\n```\nThis will be automatically populated the first time each experiment is run.\n\n### Experiments\nFor example to run for Cora with random splits:\n```\ncd src\npython run_GNN.py --dataset Cora \n```\n\n## BLEND (Beltrami Flow and Neural Diffusion on Graphs)\n\n### Dataset and Preprocessing\n\nCreate a root level \n```\n./data folder\n``` \nThis will be automatically populated the first time each experiment is run.\ncreate a root level folder\n```\n./data/pos_encodings\n```\nDIGL positional encodings will build automatically and populate this folder, but DeepWalk or Hyperbollic positional encodings will need generating using the relevant generator scripts or downloading. We include a shell script (warning: it's slow) to generate them: \n```\nsh deepwalk_gen.sh\n```\nthen create symlinks to them with \n```\npython deepwalk_gen_symlinks.py\n```\nAlternatively, we also provide precomputed positional encodings [here](https://www.dropbox.com/sh/wfktgbfiueikcp0/AABrIjyhR6Yi4EcirnryRXjja?dl=0)\nSpecifically, the positional encodings required to run the default settings for Citeseer, Computers, Phota and ogbn-arxiv are\n- [Citeseer](https://www.dropbox.com/sh/wfktgbfiueikcp0/AAB9HypMFO3QCeDFojRYuQoDa/Citeseer_DW64.pkl?dl=0)\n- [Computers](https://www.dropbox.com/sh/wfktgbfiueikcp0/AAD_evlqcwQFLL6MVyGeiKiha/Computers_DW128.pkl?dl=0)\n- [Photo](https://www.dropbox.com/sh/wfktgbfiueikcp0/AAAAhsxAcHWB5OGTHLNMXR5-a/Photo_DW128.pkl?dl=0)\n- [ogbn-arxiv](https://www.dropbox.com/sh/wfktgbfiueikcp0/AADcRPI5pLrx3iUvUjGBcqD0a/ogbn-arxiv_DW64.pkl?dl=0)\n\nDownload them and place into\n```\n./data/pos_encodings\n```\n\n### Experiments\n \nFor example to run for Cora with random splits:\n```\ncd src\npython run_GNN.py --dataset Cora --beltrami\n```\n\n## Troubleshooting \n\nMost problems installing the dependencies are caused by Cuda version mismatches with pytorch geometric. We recommend checking your cuda and pytorch versions\n```\nnvcc --version\npython -c \"import torch; print(torch.__version__)\"\n```\nand then following instructions here to install pytorch geometric\nhttps://pytorch-geometric.readthedocs.io/en/latest/notes/installation.html\n\n## Cite us\nIf you found this work useful, please consider citing our papers\n```\n@article\n{chamberlain2021grand,\n  title={GRAND: Graph Neural Diffusion},\n  author={Chamberlain, Benjamin Paul and Rowbottom, James and Goronova, Maria and Webb, Stefan and Rossi, \n  Emanuele and Bronstein, Michael M},\n  journal={Proceedings of the 38th International Conference on Machine Learning,\n               (ICML) 2021, 18-24 July 2021, Virtual Event},\n  year={2021}\n}\n```\nand\n```\n@article\n{chamberlain2021blend,\n  title={Beltrami Flow and Neural Diffusion on Graphs},\n  author={Chamberlain, Benjamin Paul and Rowbottom, James and Eynard, Davide and Di Giovanni, Francesco and Dong Xiaowen and Bronstein, Michael M},\n  journal={Proceedings of the Thirty-fifth Conference on Neural Information Processing Systems (NeurIPS) 2021, Virtual Event},\n  year={2021}\n}\n```\n\n## Security Issues?\nPlease report sensitive security issues via Twitter's bug-bounty program (https://hackerone.com/twitter) rather than GitHub.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftwitter-research%2Fgraph-neural-pde","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftwitter-research%2Fgraph-neural-pde","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftwitter-research%2Fgraph-neural-pde/lists"}