NetLogo banner

NetLogo Publications
Contact Us

Modeling Commons

Beginners Interactive NetLogo Dictionary (BIND)
NetLogo Dictionary

User Manuals:
Farsi / Persian


NetLogo Models Library:
Sample Models/Chemistry & Physics/Diffusion Limited Aggregation

(back to the library)

DLA Alternate

[screen shot]

If you download the NetLogo application, this model is included. You can also Try running it in NetLogo Web


Like the main DLA model, this model demonstrates diffusion-limited aggregation, in which particles moving (diffusing) in random trajectories stick together (aggregate) to form beautiful treelike branching fractal structures. There are many patterns found in nature that resemble the patterns produced by this model: crystals, coral, fungi, lightning, and so on.

This model is called DLA Alternate because it is based on slightly different rules than the main DLA model. In the main model, the aggregate forms on a grid. In this version, there is no grid; the particles are circles and we do the necessary calculations to determine exactly when the circles touch each other. That makes this version more complicated, but arguably more physically accurate.


A single green particle is created in the center (patch 0 0). Red particles move in from the periphery in straight trajectories. When a moving red particle touches a stationary green particle, the red particle turns green and stops moving. Periodically, a new red particle is created to keep the process going.


Press SETUP, then press GO.

SETUP: eliminates all existing particles, initializes variables, and creates one new green particle in the center.

GO: creates a particle on the periphery that moves in towards the center. Because GO is a forever button, you will see many particles moving in.


Green particles block the passage of red particles. We get black areas that do not have any green turtles, because the red particle are moving in straight lines, so they cannot work their way in to fill the black areas.

The red particles first appear on the perimeter of a large circle around the center of the display window.

What does the green shape remind you of? Can you think of any process in nature that could possibly generate an object of this shape?

Particles move in order, according to their distances from the center -- closer particles move before farther particles, and each particle moves just one step at a time.


Run the program slowly (using the speed slider in the top-left corner of the display window). Watch how the red particles take turns in moving forward. See that only after each one of the red particles has moved, a new particle is created, which enters from the periphery.

Run the simulation until it stops. Now, beginning from the center, choose one of the "branches" and follow along outwards. At every node (a "fork in the road"), add 1, and then choose randomly between the two branches. How many nodes did you find along the way? Is it this number the same for any route you choose?


What happens if you start with more than one "seed" patch? What happens if the seed is a line instead of a point?

Create a graph showing the number of green particles over time. Over several runs, does this graph have a typical shape?

Let's use the term "envelope" to describe the large "circle" created by all the green particles, with the green particle that is farthest from the center defining the radius of this envelope. Within this envelope, what is the ratio between patches with green particles and patches that have no particles? Or, what is the ratio between particles and patches? Create a graph to track this ratio. Create a histogram that accumulates the end value of this process over multiple runs.

How circular is the envelope at the end of a simulation? Is it "smooth" or "bumpy"? How would you define the goodness of this circle?

Introduce a "wiggle" into the path of red particles. That means that just before the particle moves forward, it turns a bit, randomly. Should this affect the aggregation of green particles? One way to think of this extension is that you are modeling the DLA in different media, for instance in water or some chemical of different viscosity, or that there are currents in the liquid that jostle the particles about.

Let's use the term "end particles" to describe the green particles at the end of an outward reaching branch (so they are connected only to one other particle). Create a procedure to calculate and report the average number of nodes along all the possible paths from the center to the end particles). You can also create a histogram of these values.

How many "end particles" are there over time? It seem likely that this number should grow, but how would you expect this number to grow? Create a graph to track the growth in the number of these "end particles."

What is the ratio between "end particles" and nodes? Does this ratio change over time? Create a graph to track this ratio as the simulation runs.

Create a procedure that allows you to click on any two green particles and have another moving particle sprout at the first green particle you clicked and then track and color the path between these two green particles. What is the longest path between any two green particles? Is this number bound above?


Note the use of sort to make turtles execute in order by who number (meaning, oldest turtles first). Because sort reports a list, we must use foreach to iterate over the list in order to ask each agent in it.


The main DLA model is a simpler implementation of the same idea; it uses grid cells instead of touching circles to form the aggregate.

DLA Alternate Linear has particles that fall straight down from the top of the world, instead of falling towards a central point.


The mathematical procedures used in calculating the collision paths comes from: Eric W. Weisstein. "Circle-Line Intersection." From MathWorld--A Wolfram Web Resource.


If you mention this model or the NetLogo software in a publication, we ask that you include the citations below.

For the model itself:

Please cite the NetLogo software as:


Copyright 2005 Uri Wilensky.


This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License. To view a copy of this license, visit or send a letter to Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA.

Commercial licenses are also available. To inquire about commercial licenses, please contact Uri Wilensky at

(back to the NetLogo Models Library)