![]() |
|||
Home Download Help Forum Resources Extensions FAQ NetLogo Publications Contact Us Donate Models: Library Community Modeling Commons Beginners Interactive NetLogo Dictionary (BIND) NetLogo Dictionary 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 is from Chapter Five of the book "Introduction to Agent-Based Modeling: Modeling Natural, Social and Engineered Complex Systems with NetLogo", by Uri Wilensky & William Rand.
This model is in the IABM Textbook folder of the NetLogo Models Library. The model, as well as any updates to the model, can also be found on the textbook website: http://www.intro-to-abm.com/.
This is a simplified version of the Preferential Attachment model in the networks section of the NetLogo models library. It generates a network where the probability of a new link being connected to a node is proportional to the number of links the node already has.
Such networks are "scale-free" in that they look the same at whatever scale you look. Such scale-free networks can be found in a surprisingly large range of real world situations, ranging from the connections between websites to the collaborations between actors.
This model generates these networks by a process of “preferential attachment”, in which new network members prefer to make a connection to the more popular existing members.
Scale-free networks generate a degree distribution that follows a "power law" with a few very "link-rich" nodes or hubs, and many "link-poor" nodes.
The model starts with two nodes connected by an edge. At each step, a new node is added. A new node picks an existing node to connect to randomly, but with some bias. More specifically, a node’s chance of being selected is directly proportional to the number of connections it already has, or its “degree.” This is the mechanism which is called “preferential attachment.”
SETUP creates two nodes and creates a link between them.
GO-ONCE creates one new node and finds it a partner based on preferential attachment.
GO continuously preferentially adds nodes until there are NUM-NODES nodes.
The LAYOUT button attempts to move the nodes around to make the structure of the network easier to see. Some network layout happens in the GO procedure, but pressing the LAYOUT button can add more layout during processing or in post-processing the network.
The MIN DEGREE monitor shows the degree of the node with the least links. It has to be at least 1, as all new nodes are linked to old nodes.
The MAX DEGREE monitor shows the degree of the node with the most links.
The DEGREE DISTRIBUTION plot shows the number of nodes with each degree value. This is a power law distribution.
If you look at the DEGREE DISTRIBUTION histogram, you will see that there are many more nodes with low degrees than nodes with high degrees. Nodes with a degree of one (meaning that they have just one link) should be by far the most common.
The DISPLAY-DEGREE? switch, toggles an alternate visualization in which the size of the node is proportional to its degree.
The networks that result from running this model are often called “scale-free” or “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 (see Albert & Barabási 2002 for a further description of the frequency and significance of scale-free networks). Barabási and Albert originally described this mechanism for creating networks, but there are other mechanisms for creating scale-free networks and so the networks created by the mechanism implemented in this model are referred to as "Barabási scale-free networks".
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?
Choose a large value for the NUM-NODES slider, then allow a large network to form. Do you see a pattern as the number of nodes increases?
Assign an additional attribute to each node. Make the probability of attachment depend on this new attribute as well as on degree. (A bias slider could control how much the attribute influences the decision.)
Nodes are turtle agents and edges are link agents.
The model uses the ONE-OF primitive to chose a random link and the BOTH-ENDS primitive to select the two nodes attached to that link.
It uses some clever code to give "tickets" to each node so that its chance of winning the lottery (and thus being linked to by the new node) is proportional to its degree:
let partner one-of [ both-ends ] of one-of links
There are many ways to graphically display networks. This model uses the layout-spring
primitive to implement a common method in which 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.
Because the model uses a bounded topology, some additional layout code keeps the nodes from staying at the view boundaries.
Though it is not used in this model, there exists a network extension for NetLogo (bundled with NetLogo) that has many more network primitives.
See other models in the Networks section of the Models Library, such as the fuller Preferential Attachment model, the Giant Component model and others.
See also Network Example, in the Code Examples section.
This model is a simplified version of:
Both the original and this model are based on:
For a more technical treatment, see:
The layout algorithm is based on the Fruchterman-Reingold layout algorithm. More information about this algorithm can be obtained at: http://cs.brown.edu/people/rtamassi/gdhandbook/chapters/force-directed.pdf.
For a model similar to the one described in the suggested extension, please consult:
This model is part of the textbook, “Introduction to Agent-Based Modeling: Modeling Natural, Social and Engineered Complex Systems with NetLogo.”
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:
Please cite the textbook as:
Copyright 2008 Uri Wilensky.
This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License. To view a copy of this license, visit https://creativecommons.org/licenses/by-nc-sa/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)