Skip to main content

Root system explorer via the combinatorial mutation game on graphs

Project description

Mutation Game

PyPI Documentation

A Python library for exploring root systems through the combinatorial mutation game on graphs.

Given a graph (or a Dynkin diagram name like A3, D5, E8), the library computes the full root system via iterated mutations and visualizes the mutation graph.

Installation

pip install mutation-game

Or for development:

git clone git@github.com:andreacortis/mutation_game.git
cd mutation_game
uv sync
from mutation_game import MutationGame

game = MutationGame.from_dynkin("A3")
roots = game.calculate_roots()
print(f"A3 has {len(roots)} roots")  # 12

fig = game.plot_root_orbits()
fig.savefig("a3_positive.png", bbox_inches="tight", dpi=150)

A3 positive roots

Features

  • Dynkin diagram support -- create games from A_n, D_n, E_6, E_7, E_8 by name
  • Matrix-based mutations -- each mutation is a precomputed matrix multiply (v' = M_k @ v)
  • Cartan matrix analysis -- eigenvalues, eigenvectors, and automatic finite-type detection via positive definiteness
  • Root system computation -- full BFS enumeration with verified root counts for all ADE types
  • Mutation path finding -- shortest path between any two roots via BFS on the mutation graph
  • Path tables -- all-pairs shortest mutation paths in a formatted table
  • Visualization -- side-by-side Dynkin diagram and mutation graph with color-coded simple roots

Finite-type detection

The library checks whether the Cartan matrix C = 2I - A is positive definite before attempting to enumerate roots. Infinite-type graphs are rejected early with a clear error:

cycle = MutationGame([[0,1,1],[1,0,1],[1,1,0]])
cycle.is_finite_type()  # False
cycle.calculate_roots()  # RuntimeError: Cartan matrix is not positive definite

Mutation path table

game = MutationGame.from_dynkin("A3")
game.print_mutation_path_table()
Source     Target     Mutations         Len
-------------------------------------------
(0, 0, 1)  (0, 1, 0)  1 -> 2            2
(0, 0, 1)  (0, 1, 1)  1                 1
(0, 0, 1)  (1, 0, 0)  1 -> 2 -> 0 -> 1  4
(0, 0, 1)  (1, 1, 0)  1 -> 2 -> 0       3
(0, 0, 1)  (1, 1, 1)  1 -> 0            2
...

Each path is reversible: to go from B back to A, apply the same mutations in reverse order.

Tests

uv run pytest test_mutation.py -v

43 tests covering Dynkin construction, mutation rule, root counts for all ADE types, Cartan matrix properties, mutation paths, and plotting.

Documentation

Full documentation with mathematical background is available at mutation-game.readthedocs.io

To build locally:

cd docs
uv run sphinx-build -b html . _build/html

Dependencies

  • numpy -- linear algebra and matrix operations
  • networkx -- graph construction and layout
  • matplotlib -- visualization

License

See LICENSE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mutation_game-0.1.4.tar.gz (2.8 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mutation_game-0.1.4-py3-none-any.whl (13.7 kB view details)

Uploaded Python 3

File details

Details for the file mutation_game-0.1.4.tar.gz.

File metadata

  • Download URL: mutation_game-0.1.4.tar.gz
  • Upload date:
  • Size: 2.8 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for mutation_game-0.1.4.tar.gz
Algorithm Hash digest
SHA256 303006d248b3b2f0738c47314dff99285dd52b1d9d798eed6c8a86955d83e61c
MD5 5811773bc4b5ccd7c5772260cae9fadf
BLAKE2b-256 acab0db24936570f5d6d445117cc37fa2be205386fcca0812abcedc5dcbf3630

See more details on using hashes here.

Provenance

The following attestation bundles were made for mutation_game-0.1.4.tar.gz:

Publisher: publish.yml on andreacortis/mutation_game

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file mutation_game-0.1.4-py3-none-any.whl.

File metadata

  • Download URL: mutation_game-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 13.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for mutation_game-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 fc370dcdf112c82b46c8e7b502cfa84ea24f2087a86e1a17ea20e6d05b6dfdaf
MD5 91e2450b3a5b0c73c82250f168c9576b
BLAKE2b-256 fca1022988c9da2ff8f192e2199ff448eedca2291a86f2610425be2730f69042

See more details on using hashes here.

Provenance

The following attestation bundles were made for mutation_game-0.1.4-py3-none-any.whl:

Publisher: publish.yml on andreacortis/mutation_game

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page