Watts Strogatz Small World Model

created with NetLogo (warning - varying p automatically can hog your CPU and cause your browser to crash. If this is the case, simply vary it manually)

view/download model file: SmallWorldWS.nlogo


This model explores the formation of networks that result in the "small world" phenomenon -- the idea that a person is only a couple of connections away any other person in the world.

A popular example of the small world phenomenon is the network formed by actors appearing in the same movie (e.g. the "six degrees of Kevin Bacon" game), but small worlds are not limited to people-only networks. Other examples range from power grids to the neural networks of worms. This model illustrates some general, theoretical conditions under which small world networks between people or things might occur.


This model is an adaptation of a model proposed by Duncan Watts and Steve Strogatz (1998). It begins with a network where each person (or "node") is connected to his or her two neighbors on either side.

The REWIRE-ONCE button creates the network and then visits all edges and tries to rewire them. By rewiring, we mean changing one end of a connected pair of nodes, and keeping the other end the same. The REWIRING-PROBABILITY slider determines the probability that an edge will get rewired. Running VARY REWIRING-PROBABILITY will rewire at multiple probabilities and produces a range of possible networks with varying average path lengths and clustering coefficients.

To identify small worlds, the "average path length" (abbreviated "av-path") and "clustering coefficient" (abbreviated "cc") of the network are calculated and plotted. (Note: The plots for both the clustering coefficient and average path length are normalized by dividing by the values of the initial network. The monitors give the actual values.)

Average Path Length: Average path length is calculated by finding the shortest path between all pairs of nodes, adding them up, and then dividing by the total number of pairs. This shows us, on average, the number of steps it takes to get from one member of the network to another.

Clustering Coefficient: Another property of small world networks is that from one person's perspective it seems unlikely that they could be only a few steps away from anybody else in the world. This is because their friends more or less know all the same people they do. The clustering coefficient is a measure of this "all-my-friends-know-each-other" property. This is sometimes described as the friends of my friends are my friends. More precisely, the clustering coefficient of a node is the ratio of existing links connecting a node's neighbors to each other to the maximum possible number of such links.


The NUM-NODES slider controls the size of the network. Choose a size and press INITIAL SETUP.

Pressing the REWIRE-ONCE button rewires the network for a given REWIRING-PROBABILITY.

Pressing the VARY REWIRING-PROBABILITY button re-creates the initial network (each node connected to its two neighbors on each side for a total of four neighbors) and rewires all the edges with varying rewiring probability, then plots the resulting network properties.


Note that for certain ranges of the fraction of nodes, the relative average path length decreases faster than the relative clustering coefficient. That is, the average path length soon reaches that of the random graph (the graph when REWIRING-PROBABILITY = 1), while the clustering coefficient more slowly descends to that value. The region when the average shortest path is close to that of a random graph while the clustering coefficient is still significantly higher than that of a random graph is when one would call the graph "small world".


Try plotting the values for different rewiring probabilities and observe the trends of the values for average path length and clustering coefficient. What is the relationship between rewiring probability and fraction of nodes? In other words, what is the relationship between the rewire-one plot and the rewire-all plot?

Do the trends depend on the number of nodes in the network?


Try to see if you can produce the same results if you start with a different initial network. Create new BehaviorSpace experiments to compare results.

In a precursor to this model, Watts and Strogatz created an "alpha" model where the rewiring was not based on a global rewiring probability. Instead, the probability that a node got connected to another node depended on how many mutual connections the two nodes had. The extent to which mutual connections mattered was determined by the parameter "alpha." Create the "alpha" model and see if it also can result in small world formation.


Diffusion in a small world:

Search in a small world:

Graph coloring in a small world:


This model is adapted from:
Duncan J. Watts, Six Degrees: The Science of a Connected Age (W.W. Norton & Company, New York, 2003), pages 83-100.

The work described here was originally published in:
DJ Watts and SH Strogatz. Collective dynamics of 'small-world' networks, Nature,
393:440-442 (1998)

For more information please see Watts' website: http://smallworld.columbia.edu/index.html

The small worlds idea was first made popular by Stanley Milgram's famous experiment (1967) which found that two random US citizens where on average connected by six acquaintances (giving rise to the popular "six degrees of separation" expression):
Stanley Milgram. The Small World Problem, Psychology Today, 2: 60-67 (1967).

This model and documentation was adapted by Eytan Bakshy and Lada Adamic from: Wilensky, U. (2005). NetLogo Small Worlds model. http://ccl.northwestern.edu/netlogo/models/SmallWorlds. Center for Connected Learning and Computer-Based Modeling, Northwestern University, Evanston, IL.