Visualizations
378 / 500

378 · Nature

Wood Wide Web

Roots and fungal hyphae weave a soil network that shuttles carbon to shaded seedlings.

Tree roots grow by space colonization toward water and nutrient attractors scattered through a layered soil, denser where it is moist. Mycorrhizal hyphae leave the root tips, wander with persistence and a pull toward nutrient patches, branch, and fuse when they touch another hypha (anastomosis) or a different tree's root. Carbon (from trees with light to spare to shaded ones) and nutrients (from soil patches to every tree) are routed as Kirchhoff flows: a warm-started conjugate gradient solves the graph Laplacian for each commodity several times a second, and hyphal conductances adapt as in the Tero Physarum model, so busy cords thicken while idle threads thin and die back. Glowing pulses ride the fluxes, choosing each junction in proportion to the outgoing flow, under trees whose silhouettes are seeded recursive branching skeletons rim-lit by the setting sun.

Try it. Click a tree to cast it into shade: it flips from carbon donor to receiver and the pulses reroute toward it. Click the soil to drop a nutrient patch and watch hyphae turn toward it and new blue traffic appear. S shades the largest tree and Space regrows the whole network.

  • Space colonization roots
  • Hyphal anastomosis
  • Conjugate gradient flow
  • Tero network adaptation

View the source · one module, plus a small shared runtime for sizing, the animation loop and input

Build your own

Paste this into Claude Code, Codex or any coding agent to get a simple version running, then take it wherever you like.

Build an underground "wood wide web" where fungal threads connect tree roots and carry flows between them, using JavaScript and the HTML canvas element. Put everything in a single index.html file with no libraries or build step, so I can open it directly in a browser.

Start simple:
- Make a canvas that fills the window and stays sharp on high-DPI screens (scale by devicePixelRatio). Paint a dusk sky in the top third with three simple tree silhouettes, and brown soil below.
- Grow roots from each tree base with space colonization: scatter a few hundred attractor points in the soil, let each attractor pull its nearest root node within 60 pixels, grow every pulled node a 4 pixel step toward the average direction, and delete attractors once a root reaches them.
- Start fungal hyphae at random root tips. Each hypha tip moves 2 to 3 pixels per frame with a little random turning, branches occasionally, and stops when it touches another hypha or another tree's root, adding an edge there. Keep every node and edge in a graph.
- Draw roots as tapered brown lines and hyphae as thin pale lines.

Once that works, make it flow:
- Give each tree a light level. Trees above the average light are carbon sources and the rest are sinks. Solve for a pressure at every node with Gauss-Seidel or conjugate gradient on the graph Laplacian, where each edge's conductance is its thickness over its length, and compute the flux on every edge.
- Spawn small glowing amber dots at source trees and move them along edges in the direction of the flux, picking each next edge in proportion to its outgoing flux.
- Let the visitor click a tree to shade it, and watch the flows reverse.

Explain the key ideas in short code comments. When you're done, tell me how to open it and suggest three directions I could take it next, such as making busy hyphae thicken while idle ones fade (the Tero Physarum rule), adding nutrient patches as a second commodity in blue, or layered soil horizons with stones and moisture.
PreviousRisograph PressA poster printed in CMYK or two riso inks, with a loupe that shows the rosettes. NextNeural EcosystemHerbivores and predators with tiny neural brains evolve in a pastel petri dish.

Related visualizations

  • Forest of LightNature Trees grow by competing for light in a watercolor forest that turns with the seasons.
  • Leaf VenationNature Veins chase auxin sources across a growing leaf, pressed onto a herbarium sheet.
  • Soap Film Steiner TreesPhysics Soap films between pegs relax into Steiner trees, meeting at 120 degrees.
  • Tree of LifeSimulation A living phylogeny: species branch, die out and survive mass extinctions in a ring.
  • Fractal TreeNature A recursive tree that grows, blossoms and sways in the wind.
  • Tree RingsNature A pine grows for a century under a simulated climate, one sanded ring per year.
  • Neuron GrowthNature A Golgi-stained circuit grows its dendrites and axons, wires up, then fires.
  • Slime MoldEmergence Simple agents leave trails that self-organize into living networks.
  • Huffman GardenAlgorithms Letter frequencies sprout into a Huffman tree drawn as a botanical plate.

Use ← and → to move between demos. While the canvas has focus, keys go to the demo instead.

← More from Emergent Mind Labs