{"id":15647762,"url":"https://github.com/danielegrattarola/gnca","last_synced_at":"2025-08-11T19:10:52.299Z","repository":{"id":47126228,"uuid":"417500325","full_name":"danielegrattarola/GNCA","owner":"danielegrattarola","description":"Code for \"Learning Graph Cellular Automata\" (NeurIPS 2021).","archived":false,"fork":false,"pushed_at":"2022-09-16T11:58:05.000Z","size":91,"stargazers_count":67,"open_issues_count":0,"forks_count":15,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-19T01:32:02.868Z","etag":null,"topics":["cellular-automata","graph-neural-networks","machine-learning","neurips-2021","tensorflow"],"latest_commit_sha":null,"homepage":"https://arxiv.org/abs/2110.14237","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/danielegrattarola.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-10-15T12:58:48.000Z","updated_at":"2025-04-09T15:38:05.000Z","dependencies_parsed_at":"2023-01-18T10:17:22.846Z","dependency_job_id":null,"html_url":"https://github.com/danielegrattarola/GNCA","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/danielegrattarola%2FGNCA","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielegrattarola%2FGNCA/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielegrattarola%2FGNCA/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielegrattarola%2FGNCA/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/danielegrattarola","download_url":"https://codeload.github.com/danielegrattarola/GNCA/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251691658,"owners_count":21628366,"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":["cellular-automata","graph-neural-networks","machine-learning","neurips-2021","tensorflow"],"created_at":"2024-10-03T12:20:57.808Z","updated_at":"2025-04-30T11:33:34.940Z","avatar_url":"https://github.com/danielegrattarola.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Learning Graph Cellular Automata\n\n![](image.png)\n\nThis code implements the experiments from the NeurIPS 2021 paper: \n\n**\"Learning Graph Cellular Automata\"**  \n_Daniele Grattarola, Lorenzo Livi, Cesare Alippi_\n\n[Paper](https://arxiv.org/abs/2110.14237) | \n[Blog](https://danielegrattarola.github.io/posts/2021-11-08/graph-neural-cellular-automata.html)\n\nBibtex: \n\n```\n@article{grattarola2021learning,\n  title={Learning graph cellular automata},\n  author={Grattarola, Daniele and Livi, Lorenzo and Alippi, Cesare},\n  journal={Advances in Neural Information Processing Systems},\n  volume={34},\n  pages={20983--20994},\n  year={2021}\n}\n```\n\n## Setup \n\nThe dependencies of the project are listed in `requirements.txt`. You can install them with:\n\n```sh\npip install -r requirements.txt\n```\n\n## Reproducing experiments\n\nMost scripts have CLI options that you can use to control the behaviour.\nRun:\n\n```shell\npython [script_name].py --help\n```\n\nto see a list of options.\n\n### Voronoi GCA\n\n![](https://danielegrattarola.github.io/images/2021-11-08/voronoi.png)\n\nThe experiments with the Voronoi GCA can be reproduced using the scripts in the \n`voronoi` folder. \n\nTo train the GNCA:\n\n```shell\npython run_voronoi.py\n```\n\nTo compute the entropy of the GNCA after every training step:\n\n```shell\npython run_voronoi_entropy.py\n```\n\nTo plot the entropies as a function of the rule's threshold:\n\n```shell\npython run_entropy_v_th.py\n```\n\n### Boids\n\n![](https://danielegrattarola.github.io/images/2021-11-08/boids_animation.gif)\n\nThe experiments with the Boids GCA can be reproduced using the scripts in the \n`boids` folder. \n\nTo train the GNCA:\n\n```shell\npython run_boids.py\n```\n\nTo compute the complexity of the GNCA every 10 training steps:\n\n```shell\npython run_boids.py --test_complexity_every 10\n```\n\nTo make all the plots included in the paper, after training the GNCA with `run_boids.py`:\n\n```shell\npython evaluate_boids.py\n```\n\nTo train the minimal MLP that implements the transition rule:\n\n```shell\npython run_learn_exact_mlp.py\n```\n\n### Fixed target\n\n![](https://danielegrattarola.github.io/images/2021-11-08/clouds/Minnesota_20/anim.gif)\n\nThe experiments to train the GNCA to converge to a fixed target can be \nreproduced using the scripts in the `fixed_target` folder.\n\nTo train the GNCA:\n\n```shell\npython run_fixed_target.py  # By default, t=10\n```\n\nTo train the GNCA by sampling t randomly in a range:\n\n```shell\npython run_fixed_target.py --min_steps 10 --max_steps 21  # t \\in [10, 20]\n```\n\nTo make all plots included in the paper:\n\n```shell\npython make_plots.py --path results/Grid2d/  # Replace with target folder for each graph\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanielegrattarola%2Fgnca","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdanielegrattarola%2Fgnca","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanielegrattarola%2Fgnca/lists"}