Homophily

Homophily preview image

1 collaborator

Default-person Jiawei Fu (Author)

Tags

(This model has yet to be categorized with any tags)
Visible to everyone | Changeable by everyone
Model was written in NetLogo 5.2.0 • Viewed 465 times • Downloaded 39 times • Run 0 times
Download the 'Homophily' modelDownload this modelEmbed this model

Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)


WHAT IS IT?

In some networks, a few "hubs" have lots of connections, while everybody else only has a few. New network members prefer to make a connection to the more popular existing members.

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.

In some other networks, actors prefer to connect to similar actors to onself.

Such networks can be found in a surprisingly large range of real world situations as well, ranging from the connections between friends, collaborations, to hyperlink networks.

This model generates these networks by a process of "preferential attachment" and "homophily" at the same time, testing whether preferential attachment and homophily mechanism work more dominant.

HOW IT WORKS

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.

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."

Alternatively, there is a homophily mechanism.That is, a new node picks an existing node to connect to, which has the same color with the new node.

Depending on the probability whether preferential attachment is higher or homophily is higher, each links picks different new nodes from different mechanisms. If the probability of preferential attachment is higher, the actor has a higher probability to pick an existing popular node with high degrees, and the link between us is green. If the probability of homophily is higher, the actor has a higher probability to pick an existing similar node with the same color, then the link is set to be yellow

HOW TO USE IT

Pressing the GO ONCE button adds one new node. To continuously add nodes, press GO.

The LAYOUT? switch controls whether or not the layout procedure is run. This procedure attempts to move the nodes around to make the structure of the network easier to see.

The PLOT? switch turns off the plots which speeds up the model.

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

If you want the model to run faster, you can turn off the LAYOUT? and PLOT? switches and/or freeze the view (using the on/off button in the control strip over the view). The LAYOUT? switch has the greatest effect on the speed of the model.

If you have LAYOUT? switched off, and then 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 even if you had LAYOUT? switched on and it will try to make the network easier to see.

THINGS TO NOTICE

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 of 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.

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.

THINGS TO TRY

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?

Turn off the LAYOUT? switch and freeze the view to speed up the model, then 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 nodes to the network?

EXTENDING THE MODEL

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.)

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.

NETWORK CONCEPTS

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.

NETLOGO FEATURES

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.

The layout-spring primitive places the nodes, as if the edges are springs and the nodes are repelling each other.

Though it is not used in this model, there exists a network extension for NetLogo that comes bundled with NetLogo, that has many more network primitives.

RELATED MODELS

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

See also Network Example, in the Code Examples section.

CREDITS AND REFERENCES

This model is based on:
Albert-László Barabási. Linked: The New Science of Networks, Perseus Publishing, Cambridge, Massachusetts, pages 79-92.

For a more technical treatment, see:
Albert-László Barabási & Reka Albert. Emergence of Scaling in Random Networks, Science, Vol 286, Issue 5439, 15 October 1999, pages 509-512.

Barabási'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 suggested 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.

HOW TO CITE

If you mention this model in a publication, we ask that you include these citations for the model itself and for the NetLogo software:

COPYRIGHT AND LICENSE

Copyright 2005 Uri Wilensky.

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 http://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.

Comments and Questions

Please start the discussion about this model! (You'll first need to log in.)

Click to Run Model

extensions[nw] 
globals[number-homophily]

to setup
  clear-all
  nw:set-context turtles links
  create-turtles 10 [
    set color one-of [yellow blue violet red]
    ]
  ask turtles [
    if != myself
  if color = yellow [create-link-with one-of turtles with [color = yellow]]
  if color = blue [create-link-with one-of turtles with [color = blue]]
  if color = violet[create-link-with one-of turtles with [color = violet]]
  if color = red [create-link-with one-of turtles with [color = red]]
  ]
  ;setxy random-xcor random-ycor
  set-default-shape turtles "circle"    
  ;make-node nobody
  ;make-node turtle 0     
  reset-ticks
end 

to go
  ask links [ set color gray ]
  ;make-node 
  ;find-partner
  tick
 ;if layout? [ layout ]
end 

;to make-node [old-node]  
  ;crt 1
 ; [
   ;setxy random-xcor random-ycor
   ;set color one-of [yellow blue violet red]
    ;ifelse any? old-node with [[color] of myself][
     ;!= nobody[
    ; [color] of old-node = [color] of myself[
      ;create-link-with old-node
      ; move-to old-node
    ;fd 8
    ;set number-homophily number-homophily + 1
    ;]
;]
;end

to-report find-partner
  report one-of turtles
end 

There is only one version of this model, created over 10 years ago by Jiawei Fu.

Attached files

File Type Description Last updated
Homophily.png preview Preview for 'Homophily' over 10 years ago, by Jiawei Fu Download

This model does not have any ancestors.

This model does not have any descendants.