Home Download Help Resources Extensions FAQ NetLogo Publications Contact Us Donate Models: Library Community Modeling Commons User Manuals: Web Printable Chinese Czech Farsi / Persian Japanese Spanish

NetLogo Models Library: 
If you download the NetLogo application, this model is included. You can also Try running it in NetLogo Web 
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 from 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., "Six Degrees of Kevin Bacon"), but small worlds are not limited to peopleonly 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 the WattsStrogatz 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. Using this a base, we then modify the network by rewiring nodesâ€“changing one end of a connected pair of nodes and keeping the other end the same. Over time, we analyze the effect this rewiring has the on various connections between nodes and on the properties of the network.
Particularly, we're interested in identifying "small worlds." To identify small worlds, the "average path length" (abbreviated "apl") and "clustering coefficient" (abbreviated "cc") of the network are calculated and plotted after a rewiring is performed. Networks with short average path lengths and high clustering coefficients are considered small world networks. See the Statistics section of HOW TO USE IT on how these are calculated.
The NUMNODES slider controls the size of the network. Choose a size and press SETUP.
Pressing the REWIREONE button picks one edge at random, rewires it, and then plots the resulting network properties in the "Network Properties RewireOne" graph. The REWIREONE button ignores the REWIRINGPROBABILITY slider. It will always rewire one exactly one edge in the network that has not yet been rewired unless all edges in the network have already been rewired.
Pressing the REWIREALL button starts with a new lattice (just like pressing SETUP) and then rewires all of the edges edges according to the current REWIRINGPROBABILITY. In other words, it asks
each edge
to roll a die that will determine whether or not it is rewired. The resulting network properties are then plotted on the "Network Properties RewireAll" graph. Changing the REWIRINGPROBABILITY slider changes the fraction of edges rewired during each run. Running REWIREALL at multiple probabilities produces a range of possible networks with varying average path lengths and clustering coefficients.
When you press HIGHLIGHT and then point to a node in the view it colorcodes the nodes and edges. The node itself turns white. Its neighbors and the edges connecting the node to those neighbors turn orange. Edges connecting the neighbors of the node to each other turn yellow. The amount of yellow between neighbors gives you a sort of indication of the clustering coefficient for that node. The NODEPROPERTIES monitor displays the average path length and clustering coefficient of the highlighted node only. The AVERAGEPATHLENGTH and CLUSTERINGCOEFFICIENT monitors display the values for the entire network.
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 node in the network to another.
In order to find the shortest paths between all pairs of nodes we use the [standard dynamic programming algorithm by Floyd Warshall] (https://en.wikipedia.org/wiki/FloydWarshall_algorithm). You may have noticed that the model runs slowly for large number of nodes. That is because the time it takes for the Floyd Warshall algorithm (or other "allpairsshortestpath" algorithm) to run grows polynomially with the number of nodes.
Clustering Coefficient: The clustering coefficient of a node is the ratio of existing edges connecting a node's neighbors to each other to the maximum possible number of such edges. It is, in essence, a measure of the "allmyfriendsknoweachother" property. The clustering coefficient for the entire network is the average of the clustering coefficients of all the nodes.
The "Network Properties RewireOne" visualizes the averagepathlength and clusteringcoefficient of the network as the user increases the number of singlerewires in the network.
The "Network Properties RewireAll" visualizes the averagepathlength and clustering coefficient of the network as the user manipulates the REWIRINGPROBABILITY slider.
These two plots are separated because the xaxis is slightly different. The REWIREONE xaxis is the fraction of edges rewired so far, whereas the REWIREALL xaxis is the probability of rewiring.
The plots for both the clustering coefficient and average path length are normalized by dividing by the values of the initial lattice. The monitors CLUSTERINGCOEFFICIENT and AVERAGEPATHLENGTH give the actual values.
Note that for certain ranges of the fraction of nodes rewired, the average path length decreases faster than the clustering coefficient. In fact, there is a range of values for which the average path length is much smaller than clustering coefficient. (Note that the values for average path length and clustering coefficient have been normalized, so that they are more directly comparable.) Networks in that range are considered small worlds.
Can you get a small world by repeatedly pressing REWIREONE?
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 rewireone plot and the rewireall plot?
Do the trends depend on the number of nodes in the network?
Set NUMNODES to 80 and then press SETUP. Go to BehaviorSpace and run the VARYREWIRINGPROBABILITY experiment. Try running the experiment multiple times without clearing the plot (i.e., do not run SETUP again). What range of rewiring probabilities result in small world networks?
Try to see if you can produce the same results if you start with a different type of 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.
Links are used extensively in this model to model the edges of the network. The model also uses custom link shapes for neighbor's neighbor links.
Lists are used heavily in the procedures that calculates shortest paths.
See other models in the Networks section of the Models Library, such as Giant Component and Preferential Attachment.
Check out the NW Extension General Examples model to see how similar models might implemented using the builtin NW extension.
This model is adapted from: Duncan J. Watts, Six Degrees: The Science of a Connected Age (W.W. Norton & Company, New York, 2003), pages 83100.
The work described here was originally published in: DJ Watts and SH Strogatz. Collective dynamics of 'smallworld' networks, Nature, 393:440442 (1998).
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: 6067 (1967).
This experiment was popularized into a game called "six degrees of Kevin Bacon" which you can find more information about here: https://oracleofbacon.org
Thanks to Connor Bain for updating this model in 2020.
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 2015 Uri Wilensky.
This work is licensed under the Creative Commons AttributionNonCommercialShareAlike 3.0 License. To view a copy of this license, visit https://creativecommons.org/licenses/byncsa/3.0/ 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 uri@northwestern.edu.
(back to the NetLogo Models Library)