Slime Mould Networks, Explained

After reading this you can predict how a swarm of Physarum agents turns three simple sensing rules into glowing transport networks, and you can set the deposit and evaporation numbers to get a fine mesh, bold arteries, or restless reorganisation on purpose.

What the model does, and one example

A single-celled slime mould called Physarum polycephalum grows a web of tubes that carries nutrients between food sources. It has no brain and no map. Yet the web it builds is close to the shortest network that connects the food while keeping some backup routes. In 2010 Atsushi Tero and colleagues grew it on a wet plate dotted with oat flakes arranged like the towns around Tokyo. The tubes it kept matched the real Tokyo rail network for total length, average travel distance, and tolerance to a cut link.

This tool runs Jeff Jones' 2010 agent model of that behaviour. It is not the chemistry of a real cell. It is a much simpler system that produces the same kind of network. Over a hundred thousand particles crawl across a shared 2D chemical field. Each particle sniffs the field at three points ahead of it, turns toward the strongest reading, steps forward, and drops a small amount of trail. Between steps the field is blurred a little and multiplied by a number smaller than 1 so it fades. Nothing coordinates the particles. The pattern you see is the only thing that remembers what happened.

When to reach for this model, and when not

Use this model when you want to see stigmergy: agents that communicate only by changing a shared environment, never by talking to each other directly. Ants leaving pheromone work the same way. The model is a good teaching example of how global structure appears from local rules and a decaying memory.

Do not use it to make claims about real biology. The real organism uses a network of protoplasm that pulses and rebalances flow, not point particles with three nose sensors. The agent model reproduces the shape of the answer, not the mechanism. If a demonstration tells you Physarum "computes" or "thinks", treat that as a metaphor. The particles follow arithmetic.

The 2000 maze result from Toshiyuki Nakagaki's group and the 2010 Tokyo result from Tero are about the living organism. The tool reproduces the emergent networks with a cheap simulation, which is why it can run a hundred thousand agents in your browser at all.

The update rule and why each part matters

Each agent has a position and a heading angle \theta. It reads the trail field T at three sample points: one straight ahead, one rotated left by the sensor angle \alpha, one rotated right by the same angle, each at sensor distance d in front.

S_c = T(x + d\cos\theta,\; y + d\sin\theta)

Here S_c is the centre reading. The left and right readings S_l and S_r use \theta + \alpha and \theta - \alpha in place of \theta. The steering rule is a small decision tree: if the centre reading is the largest, keep going straight; if the left is largest, turn left by the turn angle; if the right is largest, turn right; if the two sides beat the centre equally, pick a side at random.

\theta_{t+1} = \theta_t + \begin{cases} +\phi & S_l \gt S_c,\; S_l \ge S_r \\ -\phi & S_r \gt S_c,\; S_r \gt S_l \\ 0 & \text{otherwise} \end{cases}

Here \phi is the turn speed in radians per step. After turning, the agent moves a fixed step length forward and adds a deposit amount D to the field at its new cell.

Then the whole field updates once per tick. First a blur (a 3 by 3 average) spreads trail to neighbours, which is the diffusion term. Then every cell is multiplied by (1 - e), where e is the evaporation fraction.

T_{t+1} = (1 - e)\,\big(T_t * K\big)

Here K is the 3 by 3 averaging kernel and * is convolution. Diffusion widens trails so nearby agents can find each other. Evaporation deletes trail that no agent refreshes. The balance between the deposit D flowing in and the loss e flowing out decides everything. Too little loss and every cell saturates into one bright blob. Too much loss and no trail survives long enough to attract a second agent, so nothing organises.

A worked example with the demo defaults

Following one field cell for six ticks

The demo starts with the field defaults: sensor angle \alpha = 22.5^\circ, sensor distance d = 9 cells, turn speed \phi = 22.5^\circ, deposit D = 5 per agent per step, and evaporation e = 0.10 (a decay factor of 0.9). Ignore diffusion for a moment so you can check the deposit-versus-decay balance by hand.

Take one cell that two agents step onto each tick, so it gains 10 units per tick before decay. Start it at 0.

  1. Tick 1: add 10, then multiply by 0.9. (0 + 10)\times 0.9 = 9.0.
  2. Tick 2: (9.0 + 10)\times 0.9 = 17.1.
  3. Tick 3: (17.1 + 10)\times 0.9 = 24.39.
  4. Tick 4: (24.39 + 10)\times 0.9 = 30.95.
  5. Tick 5: (30.95 + 10)\times 0.9 = 36.86.
  6. Tick 6: (36.86 + 10)\times 0.9 = 42.17.

The value climbs but the steps shrink. It is heading for a fixed point where the gain and the loss cancel. Set T = (T + 10)\times 0.9 and solve: T = 90. A cell fed 10 units per tick settles near 90. A cell fed nothing decays by 10% each tick, losing about half its brightness every 7 ticks because 0.9^{7} \approx 0.478. That gap between a fed cell holding at 90 and an abandoned cell fading to near zero is exactly what draws the sharp veins.

The chart below traces the fed cell against an abandoned cell that started at 90 and receives nothing.

The fed cell rises toward its fixed point at 90 and never reaches it. Change the deposit or evaporation and the ceiling moves.

Explore the deposit-to-evaporation balance

The single most instructive number is the ratio of deposit to evaporation, because it sets the fixed point that a fed cell climbs toward. The widget lets you move it and watch the ceiling shift.

For a cell fed g units per tick with decay factor (1 - e), the steady value is T^{*} = g(1-e)/e. With g = 10 and e = 0.10 that is 90. Halve the evaporation to 0.05 and the ceiling jumps to 190. Double it to 0.20 and the ceiling drops to 40.

Reading the patterns you get

Once you know the fixed point, the visible patterns follow from the sensor geometry.

Fine mesh
Small sensor angle and short distance with moderate evaporation. Agents commit to whatever trail is right in front of them, so many thin veins survive side by side. Try \alpha near 15 degrees and d near 5.
Bold arteries
Larger sensor distance and lower evaporation. Agents sense far ahead and pool onto a few high-value channels, which then hold near their fixed point and starve the rest. Try d near 20 and e near 0.05.
Restless reorganisation
High evaporation with a high turn speed. No channel holds long enough to lock in, so the network keeps pruning and rebuilding. Try e near 0.25 and \phi near 45 degrees.

An attractant blob is just a region of the field held at a high constant value. Agents downhill from it read a stronger centre or side sensor and steer toward it, so a fresh vein reaches out and connects within a few dozen ticks.

If the whole screen goes uniformly bright, your deposit-to-evaporation ratio is too high. Raise evaporation a few hundredths or cut the deposit. A good starting balance keeps the fixed point around 90 to 150 on an 8-bit brightness scale so veins are bright but the background stays dark.

Common mistakes

The first mistake is reading the network as an optimum. The agent model finds a connected network, often a good one, but it is not solving a shortest-path problem exactly and it can settle into different networks from different random seeds. Run it twice and compare.

The second is turning evaporation to zero to "keep more detail". With e = 0 the fixed point is infinite, so every fed cell grows without bound and the contrast between vein and background disappears. Detail comes from decay, not from its absence.

The third is confusing the sensor distance with the step length. The sensor distance sets how far ahead an agent looks and therefore how far apart parallel veins sit. The step length sets how fast it moves. Changing one while blaming the other leads to confusion. Move sensor distance first when you want to change vein spacing.

Do not read biological meaning into the exact numbers. The deposit of 5 and evaporation of 0.10 are model parameters chosen so the pattern is legible, not measured cell quantities. The tool shows how the rules behave, not what the organism's chemistry actually is.

Related tools on this site

The closest relative here is the Ant Colony Pheromone Trails simulator: ants also communicate only through an evaporating shared field, the same stigmergy this model uses. For emergence from local rules without any shared memory, see the Boids Flocking Simulator, where three steering rules produce flocks, and Firefly Synchronization, where pulse coupling produces unison.

For other ways to grow branching networks, Mycelium Growth uses the space-colonization algorithm and L-System Plants grows structure from a grammar. For continuous fields that self-organise into lifeforms, try Lenia Continuous Life. If you want randomness and selection instead of stigmergy, see Genetic Drift Simulator and Evolving Creatures. For single-cell excitability rather than swarms, Neuron Action Potential covers thresholds and refractory periods.

Frequently asked questions

Does the slime mould actually solve mazes?

The living organism does. Nakagaki's group showed in 2000 that a plasmodium spanning a maze retracts its dead-end tubes and keeps the shortest connection between two oat flakes. This tool reproduces the network shape with agents, not the cell's protoplasmic flow, so treat it as an illustration of the outcome.

Why do the veins keep moving even after they form?

Because evaporation never stops. Any vein not refreshed by enough agents fades below the threshold that attracts new agents, so it dies and traffic reroutes. With e = 0.10 an abandoned cell loses about half its value every 7 ticks, which is fast enough to keep the network alive and slow enough to keep it stable.

How many agents do I need?

Enough that a forming vein gets several deposits per tick before it decays. With deposit 5 and evaporation 0.10, one agent per tick gives a fixed point near 5\times 0.9/0.1 = 45, and two give 90. Below roughly one agent per vein-width per tick the trails never reinforce and you get noise instead of structure.

What does the sensor angle change?

It sets how sharply agents can turn toward a side trail. A small angle (near 15 degrees) makes tight, dense meshes because agents only notice trails almost straight ahead. A large angle (near 45 degrees) makes agents swing onto trails off to the side, producing fewer, thicker channels and more junctions.

Can I export a frame?

Yes. The tool exports the current field as a PNG at any moment, so you can capture a mesh state and an artery state from the same run and compare them side by side.