Diffusion-limited aggregation

Simulation of diffusion-limited aggregation, a simple model for cluster growth observed in many natural systems. Random walkers are released from the source locations (colored green) and added to the aggregate when they collide with it. The initial structure of the aggregate can be set by changing the attractor type. (The walker source also changes.)

Attractor type: (Number of sites for Voronoi diagram attractor: )
with a cell side length of pixels (note that the canvas size is 600 by 600 pixels).
Show walkers.
Require perpendicular contact (no diagonals).
Override walker source with mouse position.

Speed at which pixels are added to aggregate (simulation may lag at high speeds)
Walker speed
Stickiness:
Constraints on walker source locations (for Voronoi attractor only):
No constraints
Exclude walkers contacting tree
Exclude walkers contacting or adjacent to tree

Press 'p' to pause/unpause.

Stickiness is the probability that a pixel is added to the tree when it neighbors an existing pixel. By reducing it below 1, we get "hairier" aggregates. See this excellent website showcasing diffusion-limited aggregation with varying stickiness and attractors: "http://paulbourke.net/fractals/dla/"

The color corresponds to when the walker was added to the aggregate -- the color maps will cycle if the number of cells in the aggregate gets large enough.

The algorithm is relatively straightforward: a set of locations adjacent to the existing aggregate is maintained, and each time a random walker takes a step, you check if the walker location is in the set of adjacent locations. If it is, that location is added to the aggregate and removed from the adjacent locations set, and new locations adjacent to the added cell are added to the set of adjacent locations. Otherwise, the walker keeps taking steps in random directions until it is added to the cluster or it gets too far away from the cluster, at which point a new walker is generated.

Link to Github repo

Back to programs