Skip to content

Latest commit

Β 

History

History
62 lines (43 loc) Β· 3.09 KB

File metadata and controls

62 lines (43 loc) Β· 3.09 KB

Growing Graphs & High-Performance Visualization - ✨DEMO✨

A high-performance engine for simulating and visualizing rule-based growing graphs. This project combines graph-rewriting automata with a custom force-directed layout engine optimized using WebAssembly and WebGL.

πŸš€ Key Features

  • High-Performance Physics: All core simulation logic (multibody forces, link forces, and octree construction) is implemented in WebAssembly (C) for near-native performance.
  • N-Body Optimization: Implements a dual-tree Barnes-Hut algorithm in WASM for efficient $O(N \log N)$ charge force calculations.
  • GPU-Accelerated Rendering: Uses SwissGL (WebGL 2.0) for smooth, high-bandwidth visualization of thousands of nodes and links.
  • Dynamic Growth: Nodes evolve according to neighborhood-based rewriting rules, creating complex emergent structures from simple initial conditions.
  • Autonomous Mode: A generative artwork mode with aggressive stall detection, noise-induced recovery, and smooth transitions between procedural rules.

🎨 Acknowledgments & Inspiration

This project draws significant inspiration from the following research into graph-based automata and emergent complexity:

  • Graph-Rewriting Automata by Paul Cousin β€” An exploration of rule-based graph evolution.
  • Growing Graphs (arXiv:2211.13619) β€” Research into the structural properties and evolution of procedural graph systems.

πŸ›  Tech Stack

  • Core Logic: JavaScript (ES6+)
  • Physics Engine: WebAssembly (compiled from C via zig build-exe)
  • Rendering: SwissGL (WebGL 2.0)
  • Post-Processing: Custom Bloom filter and GLSL color mapping.

πŸ— Build Instructions

To compile the WebAssembly core:

bash build.sh

Requires the Zig compiler to targeting wasm32-freestanding.

πŸ“‚ Project Structure

  • src/main.c: WASM physics core (Octree, Barnes-Hut, Link Forces).
  • js/app.js: High-level application controller and autonomous behavior.
  • js/force.js: Interface between JS and WASM physics.
  • js/graph.js: Graph management and rewriting logic.
  • js/bloom.js: Bloom post-processing effect.
  • js/tree.js: Vanilla JS Octree implementation (kept for reference).
  • lib/: External dependencies (SwissGL, dat.gui).
  • index.html: Interactive simulation viewer.
  • alice.html: Autonomous generative art mode.

πŸ€– AI Development Assistance

This project was developed with the assistance of Gemini, which helped in:

  • Porting complex graph and octree logic from JavaScript to high-performance WebAssembly (C).
  • Architecting and optimizing the dual-tree Barnes-Hut algorithm for $O(N \log N)$ force calculations.
  • Refactoring the codebase into a modular, reusable architecture.

πŸ“„ License

This project is licensed under the MIT License. See the LICENSE file for details.