DEC 2025

Biological design inspired by slime mold

I. Inspiration

Physarum polycephalum, or slime mold, is a single-celled amoeboid that has the ability to sense mechanical cues in its surrounding environment and decide which direction to grow, despite not having a brain. Scientists have been fascinated by this model organism, especially because of its capacity for complex decision making and path-planning. Researchers from Tokyo observed that it was able to optimize networks between food sources in a strikingly similar way to the Tokyo subway system, sparking conversation of biological inspired adaptive network design [1].

Fig. 1. Comparison of the Physarum networks with the Tokyo rail network. (A) In the absence of illumination, the Physarum network resulted from even exploration of the available space. (B) Geographical constraints were imposed on the developing Physarum network by means of an illumination mask to restrict growth to more shaded areas corresponding to low-altitude regions. The ocean and inland lakes were also given strong illumination to prevent growth. (C and D) The resulting network (C) was compared with the rail network in the Tokyo area (D). (E and F) The minimum spanning tree (MST) connecting the same set of city nodes (E) and a model network constructed by adding additional links to the MST (F). 

While brainstorming visuals for my homepage, I wanted to represent my projects as a graph, since many of my interests span multiple disciplines. I was inspired to create a simulation modeled after the movements of this plasmodium, so my initial idea was to have it grow across nodes (projects) to reveal subsequent projects.


I’ve also been meaning to explore creative coding, so I decided that p5.js would be suitable for this project. I was inspired by a very helpful tutorial by Patt Vira, who simulates the slime mold’s algorithm using p5.js off the paper, Characteristics of Pattern Formation and Evolution in Approximations of Physarum Transport Networks [2, 3].

II. Biological overview

Physarum polycephalum moves by sensing local concentration gradients and responding to these by changing the strcture of its external membrane. It shuttles its cytoplasm through its body in regular waves while softening of the outer membrane, causing its protoplasm to move in the direction of the gradient. When the plasmodium has engulfed the food source, veins appear to connect the food sources, allowing continued transport of protoplasm among the distributed extremes. These eventually form a tubular network that is optimized to transfer nutrients efficiently throughout the entire organism.

III. Particle-based formation model

Jones outlines a multi-agent, chemotaxis-based approach to generate pattern formation. The framework involve two layers; the landscape, or trail map, is represented by a 2D grayscale image, in which features can represent different features such as food stimuli. This is connected to the data map, which keeps track of individual cells’ locations.

Figure 2. Layered approach of coupled maps used in the framework. Areas on data map indicate pre-patterning stimuli. Such pre-patterning is considered only in the latter sections of this report.

A single agent represents a particle of Physarum that exists in a discrete location in the environment corresponding to a pixel of the image. The agent receives stimuli from its environment through its three forward sensors: left, forward, and right. After receiving the chemoattractant stimuli in these sensors, which is represented by the alpha value in the pixel grid, it reacts to these differences in the levels by either rotating itself either left or right in the direction of the higher chemoattractant value. If the forward sensor senses the greatest value, the agent randomly rotates either left or right.


At each time step, the agent move a step forward and deposits a chemoattractant value from the trail map, which is represented by the pixel being colored white. In the original algorithm, the canvas subject to a diffusion operation after every step. My implementation modifies this by simply adding a transparent layer over the entire grid, which effectively decreases all pixel values’ alpha.

Figure 3. Base agent behavioral algorithm and agent morphology. Left: Agent motor-sensory algorithm orients agent toward strongest source of chemoattractant gradient and attempts to move forward in current direction. Right: Individual agent structure showing central position and forward-biased offset sensors.

Using simple local behaviors based on chemotaxis, the population can form complex and dynamic transport networks. Adjusting model parameters can allow you to create distinct, complex patterns of patterning. The model has several parameters are control the overall framework, but these main parameters significantly affect the patterning:

  • offset distance

  • sensor angle

  • rotation angle

  • initial population

Figure 4. Examples of reticular, labyrinthine, island, and hybrid or incomplete patterns from the parameter space mapping. 500 × 500 lattice, %p 15, SO 9, run for 500 steps. Agent particle positions shown. 1st column: examples of reticular patterns. 2nd column: examples of labyrinthine patterns. 3rd column: examples of island patterns. 4th column: examples of hybrid or incomplete patterning.

IV. Modifications

In addition to Patt’s implementation, I made a few modifications to better suit it to my use:


First, I wanted to stimulate food sources to represent my project nodes. To do so, I created another class of food source nodes, which secreted chemoattractant. Since I wanted the effect of chemoattractant to have a greater visual effect on the patterning, I modified the algorithm to sense this additional chemoattractant and adjusted its movement accordingly by rotating the sensor angle. I also made it so that once a mold approached the food source, it slowly appeared and also started initializing mold objects.


Playing around with the initial population of nodes also alters the overall pattern, as Jones also outlines. Instead of random initialization all over the canvas, I wanted all the agents to initialize at one specific node, so that they could gradually discover the other nodes. I modified the edge behavior so that agents simply were removed if they existed the canvas rather than wrapping to the other side. I wanted to make a light version, with darker colored mold on a white background. To do so, I just had to invert the logic inside the algorithm (but found that I liked the dark version more anyways).


Parameter tuning is important for achieving your desired effect; increasing the velocity of the agents, the sensor angle, sensor distance, etc. Since I wanted a reticular patterning (Fig. 4), I had to tweak it a lot to get it as you see it; often times, the mold all clustered in one area, so I would decrease the chemoattractant strength. Another challenge was balancing a faster speed with too great of attractant; the molds wouldn’t leave the first food source, so I had to decrease the chemoattractant strength for the first node specifically once it initialized.


If you’re interested in learning more, I would recommend reading the Jones paper, as they cover this phenomenon much better than my implementation. Also note that my implementation is not completely biologically accurate.

  1. Tero, Atsushi, et al. Rules for Biologically Inspired Adaptive Network Design. Science, vol. 327, no. 5964, 22 Jan. 2010, pp. 439–442. Science, doi:10.1126/science.1177894.

  2. Jones, Jeff. “Characteristics of Pattern Formation and Evolution in Approximations of Physarum Transport Networks.” Artificial Life, vol. 16, no. 2, 2010, pp. 127–153, doi:10.1162/artl.2010.16.2.16202.

  3. p5.js Coding Tutorial | Slime Molds (Physarum).” YouTube, uploaded by Web Dev Simplified, 4 Aug. 2023, https://www.youtube.com/watch?v=VyXxSNcgDtg

Jenny Li © 2025