Motivation: The topology of the network induced by the neurons connectivity's in the Caenorhabditis elegans differs from most common random networks. The neurons positions of the C.elegans have been previously explained as being optimal to induce the required network wiring. We here propose a complementary explanation that the network wiring is the direct result of a local stochastic synapse formation process. Results: We show that a model based on the physical distance between neurons can explain the C.elegans neural network structure, specifically, we demonstrate that a simple model based on a geometrical synapse formation probability and the inhibition of short coherent cycles can explain the properties of the C.elegans' neural network. We suggest this model as an initial framework to discuss neural network generation and as a first step toward the development of models for more advanced creatures. In order to measure the circle frequency in the network, a novel graph-theory circle length measurement algorithm is proposed. Contact: email@example.com Supplementary information: Supplementary data are available at Bioinformatics online.