Granovetter's threshold model of collective behaviour

Granovetter's threshold model of collective behaviour preview image

1 collaborator

Tags

social science 

Tagged by Giangiacomo Bravo about 8 years ago

Visible to everyone | Changeable by the author
Model was written in NetLogo 6.0 • Viewed 978 times • Downloaded 104 times • Run 0 times
Download the 'Granovetter's threshold model of collective behaviour' modelDownload this modelEmbed this model

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


Comments and Questions

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

Click to Run Model

turtles-own [threshold riot?]

to setup
  ca
  set-default-shape turtles "circle"
  if max-threshold < min-threshold [
    print "min-threshold should be smaller than max-threshold"
    stop
  ]
  create-agents
  reset-ticks
end 

to go
  ask turtles [
    let prop-rioting 100 * count link-neighbors with [riot? = true] / count link-neighbors
    if prop-rioting >= threshold [
      set riot? true
      set color red
    ]
  ]
  tick
end 

to create-agents

  let min-threshold-n min-threshold * number-of-agents / 100
  let max-threshold-n max-threshold * number-of-agents / 100
  let mean-threshold-n mean-threshold * number-of-agents / 100
  let sd-threshold-n sd-threshold * number-of-agents / 100

  crt number-of-agents [
    set riot? false
    set color blue
    if threshold-distribution = "uniform" [set threshold (min-threshold + random (max-threshold - min-threshold))]
    if threshold-distribution = "normal" [set threshold round (random-normal mean-threshold sd-threshold)]
    if threshold < 0 [set threshold 0]
    if threshold > 100 [set threshold 100]
  ]

  ;layout-circle (sort turtles) (max-pxcor - 1)
  arrange-turtles

  ; random network of grade 2 * number of links
  if network = "random" [
    ask turtles [create-links-with n-of number-of-links other turtles with [link-with myself = nobody]]
  ]

  ; small-world network
  if network = "small-world" [
    let max-who 1 + max [who] of turtles
    let sorted sort ([who] of turtles)
    foreach sorted[ [?1] ->
      ask turtle ?1 [
        let i 1
        repeat number-of-links [
          create-link-with turtle ((?1 + i) mod max-who)
          set i i + 1
        ]
      ]
    ]
    repeat round (rewire-prop * number-of-agents) [
      ask one-of turtles [
        ask one-of my-links [die]
        create-link-with one-of other turtles with [link-with myself = nobody]
      ]
    ]
  ]

  ; fully connected network
  if network = "fully connected" [
    ask turtles [create-links-with other turtles with [link-with myself = nobody]]
  ]
end 

to arrange-turtles ;similar to layout-circle (sort turtles) (max-pxcor - 1)
  let the-turtles sort [who] of turtles
  let angle 360 / number-of-agents
  let dist max-pxcor - 1
  let i 0
  foreach the-turtles [ [?1] ->
    ask turtle ?1 [
      setxy (dist * cos (angle * i)) (dist * sin (angle * i))
    ]
    set i i + 1
  ]
end 

There are 4 versions of this model.

Uploaded by When Description Download
Giangiacomo Bravo over 7 years ago Some further fixes to make the model work woth Netlogo 6 Download this version
Giangiacomo Bravo over 7 years ago Code changes to comply with Netlogo 6 Download this version
Giangiacomo Bravo about 8 years ago Circle layout fixed (previously not working in the web version) Download this version
Giangiacomo Bravo about 8 years ago Initial upload Download this version

Attached files

File Type Description Last updated
Granovetter's threshold model of collective behaviour.png preview Preview for 'Granovetter's threshold model of collective behaviour' about 8 years ago, by Giangiacomo Bravo Download

This model does not have any ancestors.

This model does not have any descendants.