powered by NetLogo
view/download model file: BADiffusion.nlogo
This is Lada and Eytan's modification of the default BA model that comes with the NetLogo There is an added parameter gamma, which when 0 implies preferential attachment, and when 1 implies completley random attachment between a new node and the exisiting network.
Additionally, this is a diffusion model. After setting up the network with the desired number of nodes (num-nodes), it will infect one node at random. You can then step through the diffusion process either step by step (spread once) or until every node is infected (spread complete). The plot will show the number of nodes infected at each time point. The time monitor will give the current time, and in the case of the 'spread complete' option, how many steps it took until all the nodes are infected. Note that this is the SI model - nodes are either suceptible or infected and there is no recovery. The 'p' parameter gives the probability that a an infected node will infect a neighbor at each time step.
From here on down is Uri's original, much more organized documentation:
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 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.
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."
The NUM-NODES slider controls the size of the network.
The GAMMA parameter determines whether the attachment is preferential (gamma = 0
means entirely preferential, gamma = 1 means entirely random).
Choose num-nodes and gamma and press SETUP.
Adjust the p value to determine the infectiousness of the spreading agent.
To re-infect one will infect a single individual while keeping the same topology - press "reinfect-one".
Now to allow the disease to spread, you can advance on time step at a time (each infected node will infect each of its neighbors with probability p) with the "spread once" button. To let the disease run its full course, you can click the "spread" button.
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 Barabasi 2002 for a further description of the frequency and significance of scale-free networks). Barabasi originally described this mechanism for creating networks, but there are other mechanisms of creating scale-free networks and so the networks created by the mechanism implemented in this model are referred to as Barabasi scale-free networks.
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.
Try plotting the values for different rewiring probabilities observe how long it takes the infection to spread completely. What is the shape of the infection curve when the rewiring probability is 0? Is there much difference in the spead of spread past a certain value of p?
Try to see if you can create the SIS model - nodes recover and return to the 'susceptible state' after either a fixed time period, or with some probability at each time step. In this case you are looking for the conditions under which you will observe epidemics - outbreaks that affect a significant fraction of the network, vs. conditions under which the outbreak remains small and contained.
Both nodes and edges are turtles. Edge turtles have the "line" shape. The edge turtle's SIZE variable is used to make the edge be the right length.
Lists are used heavily in this model. Each node maintains a list of its neighboring nodes.
See other models in the Networks section of the Models Library, such as Giant Component.
See also Network Example, in the Code Examples section.
This model is based on:
Albert-Laszlo Barabasi. Linked: The New Science of Networks, Perseus Publishing, Cambridge, Massachusetts, pages 79-92.
For a more technical treatment, see:
Albert-Laszlo Barabasi & Reka Albert. Emergence of Scaling in Random Networks, Science, Vol 286, Issue 5439, 15 October 1999, pages 509-512.
Barabasi's webpage has additional information at: http://www.nd.edu/~alb/
The layout algorithm is based on the Fruchterman-Reingold layout algorithm. More information about this algorithm can be obtained at: http://citeseer.ist.psu.edu/fruchterman91graph.html.
For a model similar to the one described in the first extension, please consult:
W. Brian Arthur, "Urban Systems and Historical Path-Dependence", Chapt. 4 in Urban systems and Infrastructure, J. Ausubel and R. Herman (eds.), National Academy of Sciences, Washington, D.C., 1988.
To refer to this model in academic publications, please use: Wilensky, U. (2005). NetLogo Preferential Attachment model. http://ccl.northwestern.edu/netlogo/models/PreferentialAttachment. Center for Connected Learning and Computer-Based Modeling, Northwestern University, Evanston, IL.
Modified by Lada Adamic 2007