This page was automatically generated by NetLogo 5.0.2.

The applet requires Java 5 or higher. Java must be enabled in your browser settings. Mac users must have Mac OS X 10.4 or higher. Windows and Linux users may obtain the latest Java from Oracle's Java site.

In order for this to work, this file, your model file (sectarian-blogosphere.nlogo), and the files NetLogoLite.jar and NetLogoLite.jar.pack.gz must all be in the same directory. (You can copy NetLogoLite.jar and NetLogoLite.jar.pack.gz from the directory where you installed NetLogo.)

On some systems, you can test the applet locally on your computer before uploading it to a web server. It doesn't work on all systems, though, so if it doesn't work from your hard drive, please try uploading it to a web server.

You don't need to include everything in this file in your page. If you want, you can just take the HTML code beginning with <applet> and ending with </applet>, and paste it into any HTML file you want. It's even OK to put multiple <applet> tags on a single page.

If the NetLogoLite files and your model are in different directories, you must modify the archive= and value= lines in the HTML code to point to their actual locations. (For example, if you have multiple applets in different directories on the same web server, you may want to put a single copy of the NetLogoLite files in one central place and change the archive= lines of all the HTML files to point to that one central copy. This will save disk space for you and download time for your users.)

powered by NetLogo

view/download model file: sectarian-blogosphere.nlogo


This is a network model, programed for NetLogo, that can be used to make experiments that reply the behaviour of present political social networks. These networks are highly divided (Adamic et Glance, 2005, Guadian 2011), but there are several exceptions and details, the blogosphere is less sectarian and divided than social networks (twitter, Facebook) (Ugarte, 2010), and in the more complex political systems the social networks of politic activists are less divided. The model can explain these different behaviours with variables that are initially very similar. Finally, the learning option in the experiment could give us insight of why original social agents without sectarist behaviour could become sectarians.

The model can explain too why there are heterodoxian nodes in the political social networks, nodes that in spite of general behaviour, have links with other party nodes and why there exists some “heterodoxian” and exceptional behaviour in the most sectarian and endogamic social networks.

The model can be found in this URL:

or get the code

How this model works

You can create two, three or four communities of partisan nodes, which can describe the politics blogosphere of two parties (like US), or three parties, with two bigs ones, and one smaller (like UK, or nearly all european politics), or the more complicated politics of many, many parties like Italian or Catalonian ones.

The use of model with NetLogo

The NUM-Color gives the number of blogs of every community. The Sectarian1, et. al. can describe the tendency of every blogger of the community 1, 2, etc.. to get an ideological bias and made a link to a blogger of the same community and not to a random one.

Then click on SETUP to get the desired number of nodes of every community. You can put
only 2 communities, or create a more complex situation.

Click on ADD-EDGES to start adding edges just between nodes.

Click on LAYOUT to use a spring layout algorithm to reposition the nodes. I recommend this and to play with the slides.
(Optional) I put two additional slides that could bring some dynamics and improve the visualization of sectarian relations. The survival of a link and the number of links that all the blogs made in a row before the links start to banish. This wants to modelize the vanishing memory of bloggers, and the slow out-date of links and backlinks in posts.

Click on ADD-EDGES again to stop the process

Following one random node with OBSERVE ONE NODE

Rules for the nodes and links

Every node has an internal variable called “sectarian behaviour” that depends on general variables that can be selected, and the ability to learn or not. Every tick a node is asked to make a link, if a random check between 0 and 1 is less than this variable the node creates a link to a node of his same color that we identify like an endogamic-link, if the check is greater than this variable the node creates a link to a random color node that we identify like a non-endogamic link.

There are some outputs that can be observed, two of them of special interest: apparent sectarism (or the links that are made between nodes of the same colour, made on a random link or an endogamic link) and real sectarism that is the average sum of “sectarian behaviour” of all the nodes.

Models that can be compared

This model can be compared with small world network with or without redrawn random links, or any model of random growth network without preference attachment, or model of growth network with preferent attachment.

The clear differences are that the clustering in every network that the sectarian blogosphere experiments creates is greater than in a random network, small world network or a network with a preferent attachment (it really makes sense, the sectarian blogosphere creates clear separate communities with a big number of endogamic links in most cases). You can see more nodes with a great betweenness in most of the experiments of “The sectarian blogosphere” (there are “bridges” between communities that don’t appear in the small world network). There are no nodes with bigger degree than others as happens in the preferent attachment network.

Experiments with this model

Non-learning nodes’ experiments

The nodes can change their behaviour with a learning algorithm, the less complex experiments we are going to make are those where the nodes’ behaviour doesn’t evolve (but you can see the evolution of the entire network).

Experiment 1.1 The two party sectarian blogosphere

For this simple experiment you only need to create two communities (red and blue) with sectarism of the nodes of 0.85 for the two communities and dispersion of individual sectarism of 0.2. This last variable is a random factor that gives a little diversity for the endogamic behaviour of nodes, simulating that individual activists get some variation from the main behaviour of their partners.

After a few ticks the system gets to an equilibrium, where you can see a high level of sectarism (near to the original of 0.85) and a few nodes that link to the other community, like we can see in, or in more recent studies of blogosphere communities .

You can lower the sectarism of red and blue nodes, and find that apparent sectarism doesn’t follow.

This is provoked by the high probability (50%) that a non-endogamic link ends in the same color node, making an apparent sectarism that doesn’t correspond to a endogamic behaviour.

1.2 The multyparty medium-hight sectarian blogosphere

This simple experiment is very similar to the 1.1 experiment. The variation is that you create four communites of the same dimension. The other variables stay the same: sectarism of the nodes of 0.85 fot the four communities and dispersion of individual sectarism of 0.2.

You can see this behaviour:

You get the equilibrium with a few ticks, and like 1.1 experiment you can do variations in the level of sectarism.

This experiment shows us an apparently less sectarian network, showing a behaviour that can be compatible with empirical observation of multiparty real networks (see Annex I and the low image, take with sectarism of red, blue, green and yellow node of 0.5)
The individual nodes are not more non-endogamic than in experiment 1.1 but the non-endogamic links have a great probability (75%) to land in other color node. This probability grants a less apparent sectarian network with the same real sectarian behaviour of nodes.

Experiments with learning-nodes

With this model you can stablish a learning capability on the nodes. If a node has links with nodes of another color it learns to be less endogamic, and if he have links with nodes of the same color he becomes more endogamic. With these experiments we can see dynamical behaviour and find that the systems get an equilibrium.

3 Experiment 2.1: The emergence of sectarian behaviour in learning partisan networks

In this experiment you start with only two communities of nodes (you can think about a system with two parties like US) without no sectarism. You can see that the learning nodes start with 0 endogamic behaviour but it increases over time to attain a high level of sectarism and two clear and separate communities. The endogamic behaviour rises from 0 to 0.85-0.90 and only a few nodes retain non-endogamic behaviour becoming little bridges between communities. You can see an animation of this experiment here:

This experiment is consistent with the behaviour observed in real political blogosphere or partisan twitter communities.

Experiment 2.2: The three-communities or equilibrium blogosphere between endogamic and non-endogamic behaviour

This experiment is very similar to “The emergence of sectarian behaviour” with the difference that we introduce a small third community. This can simulate the generic political communities in most of european countries with 3 parties, two of them big (center-left, center-right) and one small alternative (extreme-left in most cases, and economic liberal party in other cases). One example is Guadian 2011 analysis of spanish political twitter activists.

As a result of the experiment you can see a more equilibrated network. With only a very small third community (of 20 members, when the two others are of 50 members), the collective behaviour changes. There is a great % of endogamic nodes, but the nodes that make bridges between communities grow alot, and about 40% of them get a non-endogamic behaviour. You can see a dynamic example here:

Experiment 2.3: The plural blogosphere or the evolution of multyparty blogosphere.

This experiment creates 4 communities, two of them of big size, and two of them of medium-small size. The nodes start with 0 sectarism and learning behaviour. We can see that complex communities become a more plural and interlinked network, with low endogamy (only ¼ of the nodes). You can see a more interlinked network and not clearly separated communities.

There are some surprises. For example, the diference between “the emergence of sectarism” experiment and this one, can be of only 40 nodes, in front of a total of 140, and the behaviour changes dramatically.

You can see a dynamic demo here:

This is consistent with empirical analysis of twitter activists’ networks (see Annex I), more than 1.2 experiment. A first cursory conclusion that you can see is that learning networks do better predictions of the real political activists’ social networks than non-learning networks with fixed rules.

Experiment 2.4 The oblivious network

This experiment start like 2.1, with two communities of red and blue nodes, with mid sectarian behaviour (0.70). The variable to modify in the experiment is survival ratio of links. Lowing this one the links live less time. We can see some evolution, the nodes in low links’ survival ratios become more endogamics than with high links’ survival ratios. This is consistent with qualitative works (Ugarte 2011) that established that social networks with more oblivious behaviour of the social activist are more sectarian than blogospheres where the links and backlinks have more lifespan.


This model was an adaptation of a model adapted by Lada Adamic from Uri Wilensky’s Giant Component model in NetLogo’s models library. But the original model is far, and fa away of this.

Copyright 2012 Jose Rodríguez.


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.


  ;; this is used to mark turtles we have already visited
  distance-from-other-turtles   ;; list of distances of this node from other turtles

directed-link-breed [endogamics endogamic]
directed-link-breed [noendogamics noendogamic]

  component-size          ;; number of turtles explored so far in the current component
  giant-component-size    ;; number of turtles in the giant component
  giant-start-node        ;; node from where we started exploring the giant component

;;; Setup Procedures ;;;
to make-turtles

  ask patches [set pcolor white]
  crt (red-nodes) [
    set shape "circle"
    set xcor (-1) * abs random-xcor + (1) * abs random-xcor
    set ycor (1) * abs random-ycor + (-1) * abs random-ycor
    set color 15
    set turtle-sectarism sectarism - 0.03  + random-normal 0.05 random-sectarism 
    if turtle-sectarism > 1 [set turtle-sectarism 1]
  crt (blue-nodes) [
    set shape "circle"

    set xcor (-1) * abs random-xcor + (1) * abs random-xcor
    set ycor (1) * abs random-ycor + (-1) * abs random-ycor
    set color 105
    set turtle-sectarism sectarism2 - 0.03 + random-normal 0.05 random-sectarism
    if turtle-sectarism > 1 [set turtle-sectarism 1]
    crt (green-nodes) [
    set shape "circle"

    set xcor (-1) * abs random-xcor + (1) * abs random-xcor
    set ycor (1) * abs random-ycor + (-1) * abs random-ycor
    set color 195
    set turtle-sectarism sectarism3 - 0.03 + random-normal 0.05 random-sectarism
    if turtle-sectarism > 1 [set turtle-sectarism 1]
    crt (yellow-nodes) [
    set shape "circle"
    set xcor (-1) * abs random-xcor + (1) * abs random-xcor
    set ycor (1) * abs random-ycor + (-1) * abs random-ycor
    set color 45
    set turtle-sectarism sectarism4 - 0.03 + random-normal 0.05 random-sectarism 
    if turtle-sectarism > 1 [set turtle-sectarism 1]
  ask turtles [set size 4]
  set secta 0
  set nosecta 1
  set total-nodes (red-nodes +  blue-nodes + green-nodes + yellow-nodes)
  set correction-variable ( (red-nodes * red-nodes) / (total-nodes * total-nodes) + (blue-nodes * blue-nodes) / (total-nodes * total-nodes) + (green-nodes * green-nodes) / (total-nodes * total-nodes)  + (yellow-nodes * yellow-nodes) / (total-nodes * total-nodes) )
  set endogamins-total correction-variable
  set real-sectarism sum [turtle-sectarism] of turtles / total-nodes
to make-movie
  ;; prompt user for movie location
  user-message "First, save your new movie file (choose a name ending with .mov)"
  let path user-new-file
  if not is-string? path [ stop ]  ;; stop if user canceled

  ;; run the model
  movie-start path
  movie-set-frame-rate 50
  repeat 1000[add-edge layout movie-grab-view]

  ;; export the movie
  user-message (word "Exported movie to " path)
;;; Network wiring procedures ;;;

;;; Network Exploration ;;;
;;; code by Uri Wilensky ;;

;; to find all the connected components in the network, their sizes and starting turtles
to find-all-components
  set giant-component-size 0
  ask turtles [ set explored? false ]
  ;; keep exploring till all turtles get explored
    ;; pick a node that has not yet been explored
    let start one-of turtles with [ not explored? ]
    if start = nobody [ stop ]
    ;; reset the number of turtles found to 0
    ;; this variable is updated each time we explore an
    ;; unexplored node.
    set component-size 0
    ;; at this stage, we recolor everything to light gray
    ask start [ explore (gray + 2) ]
    ;; the explore procedure updates the component-size variable.
    ;; so check, have we found a new giant component?
    if component-size > giant-component-size
      set giant-component-size component-size
      set giant-start-node start

;; Finds all turtles reachable from this node (and recolors them)
to explore [new-color]  ;; node procedure
  if explored? [ stop ]
  set explored? true
  set component-size component-size + 1
  ;; color the node
  set color new-color
  ask link-neighbors [ explore new-color ]

;; color the giant component red
to color-giant-component
  ask turtles [ set explored? false ]
  ask giant-start-node [ explore red ]
;  ask links [ set color [color] of end1 ]  ;; recolor all edges

;;; Edge Operations ;;;

;; pick a random missing edge and create it
to go
repeat 100 [add-edge layout]
to add-edge
  if (time-check > post-in-a-row) [set time-check 0 ask links [ if (random-float 1 > survival ) [ die  ]  ] ]
  if (time-vision > 250) [rp]
  if learning-net [ask links [ask one-of links [if ([color] of end1 != [color] of end2 ) [ask end1 [set turtle-sectarism turtle-sectarism - 0.01] ask end2 [set turtle-sectarism turtle-sectarism - 0.01]]]]]
  if learning-net [ask links [ask one-of links [if ([color] of end1 = [color] of end2 ) [ask end1 [set turtle-sectarism turtle-sectarism + 0.005 / ((count links) / (count turtles)) ] ask end2 [set turtle-sectarism turtle-sectarism + 0.005 / ((count links) / (count turtles))] ] ]]]
  if not any? turtles [
    print "Click on SETUP first to add nodes"
  ask turtles [if (turtle-sectarism < 0) [set turtle-sectarism 0 ]]
  ask turtles [if (turtle-sectarism > 1) [set turtle-sectarism 1]]
  ask one-of turtles [
    ifelse ( random-float 1 <= turtle-sectarism ) [ 
         ask one-of other turtles with [color = [color] of myself] [
          create-endogamic-to myself [set color [color] of end2 set thickness 0.5 ] set shape "circle" set size 4
    ] [
         ask one-of other turtles [if ( color = [color] of myself) [create-endogamic-to myself [set color [color] of end1 set thickness 0.5 ] set shape "circle" set size 4] if ( color != [color] of one-of other turtles) [ask myself [create-noendogamic-to one-of other turtles [set color [color] of end1 set thickness 0.5] ]  ]   
  set time-check time-check + 1             
  set endogamins count noendogamics
  set links-total count links
  set sectarian 1 - ((endogamins + 1) / (links-total * (1 - correction-variable) + 1))
  set time time + 1
  set time-vision time-vision + 1
  set endogamins-total endogamins-total + (1 - (endogamins / (links-total  + 1 )))
  set endogamins-median endogamins-total / time
  set endogamins-real endogamins-real + (1 - (endogamins / (links-total * (1 - correction-variable) + 1)))
  set endogamins-realmedian endogamins-real / time
  set real-sectarism sum [turtle-sectarism] of turtles / total-nodes
  ask patch -120 140 [set plabel "Sectarism" set plabel-color red]
  ask patch -20 140 [set plabel real-sectarism set plabel-color red]

to observe-one-node
    if mouse-down? [
    let candidate min-one-of turtles [distancexy mouse-xcor mouse-ycor]
    if [distancexy mouse-xcor mouse-ycor] of candidate < 3 [
      ;; The WATCH primitive puts a "halo" around the watched turtle.
      watch candidate
        ;; If we don't force the view to update, the user won't
        ;; be able to see the turtle moving around.
        ;; The SUBJECT primitive reports the turtle being watched.
      ;; Undoes the effects of WATCH.  Can be abbreviated RP.
      set time-vision 0


;;; Layout ;;;
to layout
  ;; the number 10 here is arbitrary; more repetitions slows down the
  ;; model, but too few gives poor layouts

  repeat 10 [

    display  ;; so we get smooth animation

to do-layout
  layout-spring (turtles with [any? my-out-noendogamics]) links spring-constant spring-length repulsion-strength
  layout-spring (turtles with [any? endogamics]) links spring-constant spring-length repulsion-strength

;;; Plotting ;;;

to do-plotting
     plotxy ticks sectarian

; Original Copyright 2005 Uri Wilensky.
; Modified by Lada Adamic with Copyright 2012
; Modified by Jose Rodríguez, the original model not have resemblance whith this late version. Copyright 2012.
; See Info tab for full copyright and license.