The image on the left shows the details of a galaxy simulation of the style described by Schulman and Seiden.
The galaxy is composed of rings divided into cells with equal areas. Initially a random selection of galaxy cells are made active. Active galaxy cells are shown as being occupied by a black circle. After a galaxy cell has been active for a time step it is no longer considered active but a steadily diminishing circle is drawn in that cell to show that it was recently active.
With each simulation step, the cells in the vicinity of active cells are examined. These neighboring cells are made active themselves with a probability of 0.18. As there are 6 nearest neighbor cells for each active cell, this gives a slight bias in favor of more active galaxy regions with each timestep (6*0.18=1.08), which is counterbalanced by the fact that sometimes a given cell may be triggered by two neighboring active cells. Each cell is only active for one time step.
The rings of the galaxy rotate around the galaxy center. The speed of each rings rotation is set so that the rings rotate withe a constant velocity, not a constant angular velocity. So the outer rings perform fewer rotations per unit time than the inner rings.
The basic model is then one that assumes that the interstellar medium rotates at a constant velocity and that star formation is triggered by supernovae. Each supernova explosion can set off star formation in adjacent regions of the galaxy with a probability of 0.18. This is because the entire galaxy is composed of a dilute collection of hydrogen atoms. Given a suitable trigger, such as a nearby supernova, enough hydrogen can be compressed by the shockwave to trigger the gravitational build up of larger amounts of hydrogen leading to the formation of a star.
This simple model, constant rotational velocity, and adjacent star formation with a defined probability, leads to spiral galaxy formation. That might be a coincidence or it might indicate that the basic physics of galaxy formation is captured by this nearest neighbor model!
For additional information on galaxy simulation, see the following links on the galaxy simulation computer program and a video of galaxy formation.