Skip to content

Repository files navigation

Try the demo online

Open In Colab Binder Documentation Status

  • Colab — open the starter notebook in Google Colab
  • Binder — launch a temporary JupyterLab session from this repo
  • Streamlit — local/web UI over the Python package (see below)

graphnet-automata

Study of graph evolution using cellular automaton-like methods, packaged as a modern uv Python project.

Documentation: https://graphnet-automata.readthedocs.io/

This study was inspired by the recent announcement from Wolfram concerning his project to find the fundamental theory of physics. Although graphnet-automata's approach is not as elegant, it involves the conversion of "seed graphs" to matrices for manipulation using cellular automaton-like methods.

Premise

Starting from an undirected graph with a few nodes (a "seed graph"), graphnet-automata manipulates its node connections, represented as a matrix, by first padding the matrix with one layer (adding two new nodes). Depending on the number of neighboring node connections, the matrix is updated, much like in a cellular automaton. This is repeated in a recursive fashion (i.e. "evolved"), and the resulting matrix is converted into a graph. To further characterize the graph, a community detection method is employed to visualize the number of communities that have formed.

For example, a seed graph of three nodes

evolves into a graph that is distinctly separated into two communities.

Initial experiments have shown that the evolved graph shows a "bonding" or "anti-bonding" graph, depending on whether the number of nodes in the seed graph are odd or even, like so:

evolves into:

Other novel structures found so far include a whip-like structure:

See the notebook directory for details. Pre-NetworkX-3 snapshots are frozen under notebooks/archive/.

Project layout

.
├── app.py                     # Streamlit interactive demo
├── data/                      # Generated HDF5 datasets
├── docs/                      # Sphinx / Read the Docs sources
├── images/                    # Example figures
├── notebooks/                 # Active notebooks (NetworkX 3+)
│   └── archive/               # Frozen NetworkX 2-era snapshots
├── src/graphnet_automata/     # Installable package (uv src layout)
│   ├── generator.py           # Shared automaton core
│   ├── degree.py              # Degree-count kernel search
│   ├── generate.py            # Dataset generation
│   ├── optimize.py            # Optuna seed optimization
│   └── search.py              # Entropy-based kernel search
├── requirements.txt           # Streamlit Cloud / Binder install list
├── tests/
├── pyproject.toml
└── .python-version

Requirements

  • Python 3.10+
  • Managed via uv

Core libraries: NetworkX, NumPy, SciPy, Numba, python-louvain, Matplotlib, h5py, Optuna.

Installation

Install uv, then from the repository root:

uv sync

Optional extras:

uv sync --extra dev --extra viz   # notebooks / pyvis
uv sync --extra app               # Streamlit demo
uv sync --extra docs              # Sphinx documentation

Streamlit demo

Run the interactive UI locally:

uv sync --extra app
uv run streamlit run app.py

To publish on Streamlit Community Cloud: sign in with GitHub, pick this repository, set the main file to app.py, and deploy (uses requirements.txt).

Usage

After uv sync, run the CLI entry points:

uv run graphnet-automata                 # list commands
uv run graphnet-automata-degree          # search by degree-count average
uv run graphnet-automata-generate        # write data/GA_seed_13_0.05_50.h5
uv run graphnet-automata-search          # search by degree-distribution entropy
uv run graphnet-automata-optimize        # Optuna optimization (slow)

Or import the shared generator from Python / notebooks:

from graphnet_automata import GeneratorState, kernel_from_index

kernel = kernel_from_index(448)
gen = GeneratorState(nodes=13, prob=0.05, kernel=kernel, steps=100)
adjacency = gen.run()

Exploratory work remains in the Jupyter notebooks under notebooks/. Recursive calculations may take a minute or more depending on your environment.

Documentation

Hosted docs: https://graphnet-automata.readthedocs.io/

Sphinx sources live in docs/. Build locally:

uv sync --extra docs
uv run sphinx-build -b html docs docs/_build/html

Development

uv sync --extra dev
uv run pytest

Author

License

graphnet-automata is under the MIT license.

About

A study of the evolution of graphs using cellular automaton-like methods.

Resources

Stars

3 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages