Know Your Network

No preview image

1 collaborator

Default-person David Weintrop (Author)

Tags

(This model has yet to be categorized with any tags)
Visible to everyone | Changeable by everyone
Model was written in NetLogo 5.1.0 • Viewed 490 times • Downloaded 57 times • Run 0 times
Download the 'Know Your Network' 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?

This model allows you to import social network data, and explore how a rumor might spread on it.

HOW IT WORKS

The rules are simple: you want to spread a rumor as fast as possible to everyone in your social network. To get the rumor started, you get to 'whiper' the rumor to five people. For every 'tick', they then have a 50% chance of telling each person they know.

The faster the rumor spreads, the more points you get. Specifically, the payoff you get for telling people drops by 10% for every tick. So make sure you initially whisper the rumor to people who, because of their location in your network, can spread the rumor as fast as possible!

HOW TO USE IT

Press LOAD-GRAPH first to import your data.

The widgets near the "Visualize it!" heading allow you to visually explore your network. You can set the size of nodes based on their various centralities, and you can show labels for those nodes that are in the highest percet, set by the LABEL-THRESHOLD slider. If you want to see a prettier, layouted version of your network, press the "Layout" button.

Click the SETUP RUMOR MODEL button to start spreading the rumor in your network.

You can infect people in various ways; by their specific name, by having the model tell someone based on their network centrality, and by 'touching' them. If you want to infect people by touching them, you have to click the "BY TOUCH" button" first.

Finally, click the GO button to start spreading the rumor. When everybody has heard the rumor, the model will automatically stop. The plot will show you how many people heard the rumor, and the SCORE monitor will tell you how well you did.

If you want to see a network representation of who told whom, click the SHOW RUMOR NETWORK button. This will show you how the rumor spread from each of the five people that you initialy told.

THINGS TO NOTICE

Running the model more than once may (and probably will) yield different results. This is because there is some randomness in how the rumor spreads.

CREDITS AND REFERENCES

Know Your Network. Arthur Hjorth, David Weintrop, Uri Wilensky 2014.

Comments and Questions

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

Click to Run Model

extensions [ nw ]

turtles-own [
  ;; facebook data
  id
  name
  centrality
  
  ;; infection variables
  infected?
  
  heard-from
  
]
links-own [
  weight
]

to load-graph
  clear-all  
  
  ;; Hard-code your path if you don't want to get prompted every time:
  ;; let filename user-file "/path/to/your-network.graphml"
  let filename user-file
  
  if (filename != false) [
    nw:load-graphml filename [
      set shape "circle"
    ]
    nw:set-context turtles links
  ]
  
;  let no-of-components length (sentence nw:weak-component-clusters)
;  ifelse no-of-components > 0 [let degrees-separated 360 / no-of-components
;    let counter 0
;    foreach nw:weak-component-clusters [
;      let biggest-component-size max map [count ?] nw:weak-component-clusters
;      if count ? != biggest-component-size [ask turtle-set ? [die]]
;    ]
;    reset-ticks
;  ]
;  [
;    user-message "No network was loaded, please try again."
;  ]
end 

to remove-most-central
  ask max-one-of turtles [ count my-links ] [ die ]
  nw:set-context turtles links
end 

to update-layout
  layout-spring turtles links 0.2 .1 1
end 

to toggle-labels
  ;; if any have a label, turn off all labels
  ifelse any? turtles with [label != ""]
  [
    ask turtles [set label ""]
  ]
  [
    let the-number-of-turtles count turtles * (100 - label-threshold) / 100
    ask max-n-of the-number-of-turtles turtles [size] [set label name]
  ]
end 

to calc-centrality
  if centrality-measure = "random" [
    ask turtles [set size random 14 + 1]
    stop 
  ]
  if centrality-measure = "reset-size" [
    ask turtles [set centrality 1 set size 1]
    stop
  ]
  if centrality-measure = "degree-centrality" [
    ask turtles [set centrality count my-links]
    ask turtles [set size 10 * (normalize centrality min [centrality] of turtles max [centrality] of turtles)]
    stop
  ]
  let the-task (word "set centrality nw:" centrality-measure)
  ask turtles [run the-task]
  ask turtles [set size 10 * (normalize centrality min [centrality] of turtles max [centrality] of turtles)]
end 

to setup
  clear-all-plots

  ask turtles [
    set infected? false 
    set label "" 
    set color white
    set size 3
  ]
    
  ask links [
    set thickness 1
    set color grey
  ]
  
  reset-ticks
end 


; this normalizes a number

to-report normalize [value the-min the-max]
  set the-min ifelse-value (the-min = 0) [.001] [the-min]
  let normalized (value - the-min) / (the-max - the-min)
  report normalized
end 

to kill-smaller-components
  let the-component []
  foreach nw:weak-component-clusters [
    if length ? > length the-component [set the-component ?]
  ]

  set the-component (turtle-set the-component)
  show count the-component
  ask turtles with [not member? self the-component] [die]
end 


;; turtle procedure

to show-centralities
  show (word "Name: " name ", degree: " count my-links ", betweenness: " nw:betweenness-centrality ", closeness: " nw:closeness-centrality ", eigenvector:" nw:eigenvector-centrality ", page-rank: " nw:page-rank)
end 

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Layouts
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

to redo-layout [ forever? ]
  repeat ifelse-value forever? [ 1 ] [ 50 ] [
    layout-spring turtles links 1 (80 / 1) (1 / 1)
    display
    if not forever? [ wait 0.005 ]
  ]
end 

to layout-once
  redo-layout false
end 

to spring-forever
  redo-layout true
end 

There is only one version of this model, created about 11 years ago by David Weintrop.

Attached files

File Type Description Last updated
dweintrop.graphml data GML Example about 11 years ago, by David Weintrop Download

This model does not have any ancestors.

This model does not have any descendants.