Beautiful visual art generated from the spectral properties of graphs — eigenvectors, eigenvalues, Laplacians, and conservation ratios.
Every graph has a spectral fingerprint: the eigenvalues and eigenvectors of its Laplacian matrix encode deep structural information. This project transforms those mathematical properties into stunning visual art.
Conservation ratio — how smoothly attributes flow across a graph's structure — drives color harmony, layer coherence, and visual tension.
Eigenvectors define angles and radii; eigenvalues control mandala layers. Conservation ratio governs color harmony.
- Erdős-Rényi Constellation
- Barabási-Albert Nebula
- Small World Chakra
- Grid Lattice Bloom
- Western / Gamelan / Indian / Jazz / African Tradition Mandalas
Eigenvector 2 × Eigenvector 3 coordinates form the terrain. Attribute values become elevation. Conservation ratio maps to color.
- Scale-Free Topology
- Small-World Terrain
- Lattice Prairie
- Gamelan / Jazz Spectral Terrain
Graph nodes become attractors. Laplacian eigenvectors define flow direction. Conservation equals flow coherence.
- Laplacian Vortex
- Scale-Free Currents
- Random Walk Dreams
- Western / Gamelan Tradition Flows
Each musical tradition's Laplacian eigenvalues define a unique abstract shape.
- Western — Structured geometric polygons
- Gamelan — Layered organic curves
- Indian — Spiral raga complexity
- Jazz — Improvisational chaos
- African — Polyrhythmic bold patterns
Multi-scale conservation ratio mapped to color gradients. Shows the transition from well-conserved (smooth) to anomalous (rough).
- Scale-Free / Small-World / Random / Lattice Conservation
pip install -r requirements.txtor manually:
pip install numpy scipy matplotlib pillowpython generate.pyAll output saved to output/ as PNG files.
- Tradition graphs (
western,gamelan,indian,jazz,african) are derived deterministically from the tradition name, so a given tradition always yields the same underlying graph across runs and machines. - Generic random-graph galleries (Erdős-Rényi, Barabási-Albert,
small-world, grid) draw from numpy's global RNG without a fixed seed, so
re-running
generate.pyproduces different art each time. Seed numpy yourself (numpy.random.seed(...)) before calling the generators if you need bit-reproducible generic pieces.
- Normalized Laplacian: L = I − D^{−1/2} A D^{−1/2}
- Conservation Ratio: σ(x) = 1 / (1 + x^T L x / x^T x)
- Rayleigh Quotient: Measures smoothness of attribute x on graph structure
- Spectral Embedding: Eigenvectors map graph to visual space
The conservation ratio takes values in [1/3, 1] for the normalized
Laplacian (whose spectrum lies in [0, 2]); σ = 1 for a perfectly smooth
signal and σ → 1/3 for the most oscillatory one. This bound is covered by
tests/test_math.py.
The test suite covers the spectral math (closed-form spot-checks against known graphs), graph invariants, color logic, and end-to-end rendering of every generator (each rendered PNG is opened and checked to be a valid, non-blank image).
pip install -r requirements.txt # includes pytest
pytest -vMIT
Part of the SuperInstance OpenConstruct ecosystem.