NetLogo banner

 NetLogo Publications
 Contact Us

 Modeling Commons

 User Manuals:
 Farsi / Persian


NetLogo User Community Models

(back to the NetLogo User Community Models)

[screen shot]

If clicking does not initiate a download, try right clicking or control clicking and choosing "Save" or "Download".

Try It in NetLogo Web


In some networks, a few "hubs" have lots of connections, while everybody else only has a few. This model shows one way such networks can arise.

Such networks are ubiquitous of real world situations, ranging from the connections between websites to the collaborations between actors.

The model generates these networks by a process of "Highly/Heuristically Optimized/Organized Tolerance/Tradeoffs", in which new network members make a connection to the members which optimize multiple functional objectives.


The model starts with two nodes connected by an edge: the root node, in the center, and a node situated randomly in the space.

At each step, a new node is added. A new node is created in a random place in the space and then it chooses to attach himself to the node which minimizes the sum of two objectives: Euclidean distance from the node to attach to and number of hops from the root node.


First you have to hit SETUP button which creates two connected nodes.
Pressing the GO-ONCE button adds one new node. To continuously add nodes, press GO.

The PLOT? switch turns off the plots.

The RESIZE-NODES button will make all of the nodes take on a size representative of their degree magnitude. If you press it again the nodes will return to equal size.

If you want the network to have a more appealing layout, press the REDO-LAYOUT button which will run the layout-step procedure until you press the button again. You can press REDO-LAYOUT at any time but should be used only _after_ simulation run, to avoid interfering with base logic.

If you want save nodes degree on a file for later use, push SAVE-NODES-DEGREE. It will save a file called "NodesDegree.txt".

If you want the model to run faster, you can turn off the PLOT? switch, slide to the right the speed and/or uncheck "view updates".


The networks that result from running this model are often called "power law" networks. These are networks in which the distribution of the number of connections of each node is not a normal distribution --- instead it follows what is a called a power law distribution. Power law distributions are different from normal distributions in that they do not have a peak at the average, and they are more likely to contain extreme values. Alex Fabrikant, Elias Koutsoupias, and Christos H. Papadimitriou propose a plausible explanation of the power law distributions of degrees observed in the graphs arising in the Internet topology based on a toy model of Internet growth in which two objectives are optimized simultaneously: “last mile” connection costs, and transmission delays measured in hops. Results seem to suggest that power laws tend to arise as a result of complex, multi-objective optimization. John C. Doyle et al. goes even further showing the power of S-metric and how this kind of networks can have greater performance and resilience than "scale-free" networks like "preferential attachment" of Barabasi & Albert.

You can see the degree distribution of the network in this model by looking at the plots. The top plot is a histogram of the degree of each node. The bottom plot shows the same data, but both axes are on a logarithmic scale. When degree distribution follows a power law, it appears as a straight line on the log-log plot. One simple way to think about power laws is that if there is one node with a degree distribution of 1000, then there will be ten nodes with a degree distribution of 100, and 100 nodes with a degree distribution of 10.


Let the model run a little while. How many nodes are "hubs", that is, have many connections? How many have only a few? Does some low degree node ever become a hub? How often?

Allow a large network to form. What is the shape of the histogram in the top plot? What do you see in log-log plot? Notice that the log-log plot is only a straight line for a limited range of values. Why is this? Does the degree to which the log-log plot resembles a straight line grow as you add more node to the network?


Assign an additional attribute to each node. Make the attachment depend on this new attribute as well as on degree or other parameters.

In this network all nodes are peers but this is not the case of internet where differences exist between end users and ISPs; can be power law degrees distribution preserved?

Can the layout algorithm be improved? Perhaps nodes from different hubs could repel each other more strongly than nodes from the same hub, in order to encourage the hubs to be physically separate in the layout.

What about S(g)? How does it vary? Why?


There are many ways to graphically display networks. This model uses a common "spring" method where the movement of a node at each time step is the net result of "spring" forces that pulls connected nodes together and repulsion forces that push all the nodes away from each other. This code is in the `layout-step` procedure. You can force this code to execute any time by pressing the REDO LAYOUT button, and pressing it again when you are happy with the layout.


Nodes are turtle agents and edges are link agents. The `layout-spring` primitive places the nodes, as if the edges are springs and the nodes are repelling each other.


See other models in the Networks section of the Models Library, such as Giant Component or Preferential Attachment.

See also Network Example, in the Code Examples section.


This model is based on:
Alex Fabrikant, Elias Koutsoupias, and Christos H. Papadimitriou. Heuristically Optimized Trade-offs: A New Paradigm for Power Laws in the Internet.

For a more technical treatment, see also:
Lun Li, David Alderson, Reiko Tanaka, John C. Doyle, Walter Willinger. Towards a Theory of Scale-Free Graphs: Definition, Properties, and Implications,
Technical Report CIT-CDS-04-006, Engineering & Applied Sciences Division California Institute of Technology, Pasadena, CA, USA.

The layout algorithm is based on the Fruchterman-Reingold layout algorithm. More information about this algorithm can be obtained at:


If you mention this model in a publication, we ask that you include these citations for the model itself and for the NetLogo software:
- Tomasini Marcello (2012). HOTnet model.
Student at University of Modena and Reggio Emilia.
- Wilensky, U. (1999). NetLogo. Center for Connected Learning and Computer-Based Modeling, Northwestern University, Evanston, IL.


Copyright 2012 Tomasini Marcello,

![CC BY-NC-SA 3.0](

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.

(back to the NetLogo User Community Models)