Information Spread by Search Engines.

Information Spread by Search Engines. preview image

1 collaborator

Img_20161026_134244_(1) Alon Sela (Author)

Tags

information spread 

"Word of mouth and Search engines"

Tagged by Alon Sela almost 8 years ago

search engine vs. word of mouth 

Tagged by Alon Sela almost 8 years ago

Visible to everyone | Changeable by the author
Model was written in NetLogo 5.1.0 • Viewed 633 times • Downloaded 39 times • Run 0 times
Download the 'Information Spread by Search Engines.' 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?

A model of diffusion of ideas in a many opinion environment that include two methods of spread. 1) WOM -> word of mouth 2) WEB -> search engines spread dynamics

HOW IT WORKS

The model starts with "num-infected-init" (see slider) nodes which can have any of the "num-opinions" (see slider) opinions. At each step, the opinions might spread to any of their neighbors along a WOM dynamics, (word of mouth), by which each node can adopt the opinion of its social neighbors, or according to WEB dynamics (web search engine), by which a node adopts an opinion according to its likelihood to appear in a search engine query.

HOW TO USE IT

  1. Press "Setup" to create a power law network.

  2. Press "Reinfect-once" to distribute the initial opinions to few random nodes.

  3. Set the k-opinion slider, which represents the number of opinion which a user reads before choosing his/her own opinion.

  4. Choose the model in the "group-influence-type" selection, to WOM or to WEB.

  5. Press "spread" to repeatedly spreading the different ideas along the population.

THINGS TO NOTICE

The distribution of ideas is more narrow (less ideas spread to more nodes, while rare ideas disappear) in the WEB as compared to the WOM model. This can be seen by the histogram, (bottom right) as well as the "proportion of opinion" and "#opinion" monitors

CREDITS AND REFERENCES

For more detail, see the Europhysics letters (EPL) article

Alon Sela, Louis Shekhtman, Shlomo Havlin and Irad Ben-Gal, Comparing the diversity of information by word-of-mouth vs. web spread, Europhysics letters (EPL), 114(5)

http://iopscience.iop.org/article/10.1209/0295-5075/114/58003/meta

Based on an initial model Copyright 2008 Uri Wilensky. Modified by Lada Adamic 2009.

Comments and Questions

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

Click to Run Model

; Adapted from models library by Lada Adamic (see copyright below)
; for the purposes of SI708/CSCS608
; also now contains major improvements by Eytan Bakshy

;This version is created by Alon Sela 7/2013-9/2015 on the base of the above...
 extensions [nw]

;correct - method of choice in WOM -
globals
[
  new-node  ;; the last node we created
  degrees   ;; this is an array that contains each node in proportion to its degree
  num-infected
  tree-mode?
  time-to-90 ;; Alon
  time-to-1  ;; Alon
  time-to-10 ;; Alon
  time-from-1-to-90
  global-infect-rate ;; Alon
  cured?   ;; Alon
  memory-of-t-0 ;; Alon
  prob-to-inf-of-t-0 ;Alon
  final-distribution ;; Alon
  dist-non-zero;;Alon
  initial-num-infected ;;Alon
  remove-zero?
]

turtles-own
[
  group-mates      ;; ALONs addition
  prob-to-inf      ;; ALONs addition, probability of infection
  memory
  message          ;;ALONs addition, message spreading
]

;;;;;;;;;;;;;;;;;;;;;;;;
;;; Setup Procedures ;;;
;;;;;;;;;;;;;;;;;;;;;;;;

to setup
  ;; (for this model to work with NetLogo's new plotting features,
  ;; __clear-all-and-reset-ticks should be replaced with clear-all at
  ;; the beginning of your setup procedure and reset-ticks at the end
  ;; of the procedure.)
  ca
  __clear-all-and-reset-ticks
  let partner nobody
  set remove-zero? true
  set-default-shape turtles "circle"
  set degrees []   ;; initialize the array to be empty
  ;; make the initial network of two turtles and an edge
  crt (m + 1)
  ask turtles [
    repeat m [set degrees lput self degrees] ; insert nodes into array
    ask other turtles with [not link-neighbor? myself] [
      create-link-with myself
    ]
  ]

  ;set num-infected 0
  no-display
  repeat (num-nodes - m - 1) [
  crt 1 [
    set new-node self ;; set the new-node global
    repeat m [
      ifelse (random-float 1.0 <= prob-pref) ; if pref attachment
      [set partner new-node
        while [partner = new-node] [
          set partner one-of (degrees)
          ask partner [
            if link-neighbor? self [  ; we can't link to someone we already share an edge with
              set partner new-node    ; so set to self so we redo
            ]
          ]
        ]
      ]
     [  ; if not pref attachment
     set partner one-of other turtles with [(not link-neighbor? new-node)]
     ]
     move-to partner
     fd 5
     create-link-with partner [set color green]
     set degrees lput new-node degrees
     set degrees lput partner degrees
    ]
  ]
  ]
  ;repeat 100 [do-layout]
  repeat 10 [do-layout]
  ask turtles [set color gray
    set shape "circle"
    set size 0.3
    ;set infection-count 0
    ;set infected? false
    ]
  ask links [set color gray]
end 

                          ;;;;;;;;;;;;;;;;;;;;;;;;;;
                          ;;; REINFECT ONCE      ;;;
                          ;;;;;;;;;;;;;;;;;;;;;;;;;;

; reset diffusion simulation

to reinfect-once
  clear-all-plots
  ;let init-oppinion []
  set num-infected 0
  set time-to-90 0
  set time-to-1 0
  set time-to-10 0
  set time-from-1-to-90 0
  set memory-of-t-0 0
  set final-distribution 0
  set dist-non-zero 0
  reset-ticks
  ask turtles [
    set color gray
    set shape "circle"
    set size 0.3
    ;set infection-count 0
    ;set infected? false
    set prob-to-inf 0
    set memory 0
    set message 0
  ]

  ask links [set color gray + 2]
  while [count turtles with [message != 0] < num-infected-init]
    [
  ;repeat num-infected-init [
    ask one-of turtles
    [if not (message != 0)
       [;set infected? true
        set memory 1
        set size 3
        set shape "target"
        set num-infected num-infected + 1
        set message (random num-oppinions ) + 1
        set color (message * 10 + 5)]
  ;      set init-oppinion lput message init-oppinion
    ]
  ]
update-plots
set dist-non-zero distribution-no-zeroes
set initial-num-infected length dist-non-zero
end 

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;                             Main SPREAD    procedure                      ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

to spread


  ;first we construct alist of nodes with an opinion
  let myInfecttedAgentset []
  set myInfecttedAgentset turtles with [message != 0]


  ;create the search engine result list sorten by the PageRank of the believers in the network
  let search-result-list create-search-engine-list myInfecttedAgentset


  ;this function reports a list of non-infected friends of infected nodes (Optional Infected List (OIL)
  let myOptionalToInfectlist []
  ask myInfecttedAgentset
  [ask link-neighbors with [message = 0]
    [set myOptionalToInfectlist lput who myOptionalToInfectlist ] ]
  set myOptionalToInfectlist remove-duplicates myOptionalToInfectlist


  foreach myOptionalToInfectlist
  [ask turtle ?
    [set color green
      set size 1
    ]
  ]

  ; chose opinion to adopt for every agent that is exposed to the message
  foreach optional-infect-list ; OIL
    [ask turtle ?
      [if (Group-influence-type = "WOM")
        [set message vote-message-WOM self         ; good for remove-zero = TRUE as well as remove-zero = FALSE

        ]

      if (Group-influence-type = "WEB")
        [ set message vote-message-WEB2  search-result-list

        ]
      ]
    ]

  ask turtles with [message != 0]
    [ set size 1
      show-turtle
      set color (message * 10 + 5)
      ;set infection-count infection-count + 1 ;; incremement infection-count of the node doing the infection
      set num-infected num-infected + 1
    ]

  do-plotting
  compute-distributions
  tick
  if (all? turtles [message != 0])
    [set final-distribution compute-reporter
      set dist-non-zero distribution-no-zeroes
      stop]
end 

;;;;;;;;;;;;;;;;
;;; Plotting ;;;
;;;;;;;;;;;;;;;;

to do-plotting
  ;; plot the number of infected individuals at each step
  set-current-plot "Number infected"
  set-current-plot-pen "num-inf"
  set num-infected count turtles with [message != 0]
  plotxy ticks num-infected /  num-nodes
end 

to toggle-tree
  ;; toggle infection tree mode
  ;; when tree-mode is on, only links responsible for contagion and infected nodes
  ;; are displayed. tree-mode also affects layout
  ifelse tree-mode? ;on
    [ask turtles [show-turtle]
      ask links [show-link]
      set tree-mode? false]
    [ask turtles with [message = 0]  [hide-turtle]
      ask turtles with [message != 0] [show-turtle]
      ask links with [color != red - 1] [hide-link]
      ask links with [color = green ] [show-link]
      set tree-mode? true ]
end 

;;;;;;;;;;;;;;
;;; Layout ;;;
;;;;;;;;;;;;;;

to do-layout
  if layout?
    [repeat 10 [layout-spring turtles links 0.01 10 1]
      ;repeat 10 [layout-spring (turtles with [color = green]) (links with [color = green]) 0.01 10 5]
      repeat 10 [layout-spring (turtles with [message != 0]) (links with [color = red - 1]) 0.5 20 10]
    ]
  display
end 

to-report vote-message-WOM [node]
  ; This reporter receives a non-infected node (in a turtle agent form not just a number) and
  ; reports the oppinion this node would choose if debating between several simmilar oppinions.
  ; The algorithm sample k (with repetition) neigbhors and builds a list "opp-list" of their oppinions.
  ; Then, it randomely choses one opinion from opp-list.

  let mylist []
  ask node
    [ask link-neighbors
      [set mylist lput message mylist]]
  if remove-zero?
    [set mylist remove 0 mylist]
  if k-oppinion < length(mylist)
    [set mylist n-of k-oppinion mylist]
  let result one-of mylist

  report result
end 

to-report create-search-engine-list [Agentset]; this function receives as INPUT of an agentset and returns
                                              ; as OUTPUT a list of nodes sorted by the PageRank of their holders
  let oplist []
   let sortagents sort-on [nw:page-rank] Agentset
   foreach sortagents
     [set oplist fput [message] of ? oplist

     ]
  report oplist
end 

;OK

to-report vote-message-WEB2 [mylist]  ;turtle procedure
                                      ;this function reports the voted message in the WEB dynamics for one turtle

                                      ;create the list of k opinions of a debating user taking into consideration the SERP function
  let k-opp-list k-list mylist
  let chosenMessage []
  ;choses one opinion by the most common or random of most commons if few have same comonness
  if length(k-opp-list) > 0
    [;set chosenMessage one-of modes k-opp-list
      set chosenMessage one-of modes k-opp-list


    ]
    report chosenMessage
end 

to-report histomize [ #list ] ; this amazing (fount in the internet) function receives a list and reports a list of two lists.
                              ;; reports a list of two lists:
                              ;; the first is a sorted list of unique values in given list,
                              ;; the second is a list of corresponding counts of each value.
  set #list sort #list
  report list
  remove-duplicates #list
  but-first reduce [ifelse-value (first ?1 = ?2)  ; if same value...
    [lput (1 + last ?1) but-last ?1]  ; incr count
    [fput ?2 lput 1 but-first ?1]]    ; new value
  fput list (first #list) 1 but-first #list
end 


;ok

to-report compute-reporter  ;this function reports the histomize results in a more fitting format
  let result []
  let ans [message] of turtles
  let res histomize ans

  let res-length length ans
  foreach item 1 res
    [set result lput (precision (?1 / res-length) 4) result]
  report sort-by > result
end 

to-report compute-reporter-new [chosen] ;this function reports the histomize results in a more fitting format
  let result []
  let ans [message] of chosen

  let res histomize ans

  let res-length length ans
  foreach item 1 res
    [set result lput (precision (?1 / res-length) 4) result]

  report sort-by > result
end 

to-report distribution-no-zeroes  ; reports the list of non infected turtles
  let a turtles with [message != 0]

  report sort-by > compute-reporter-new a
end 


;used

to-report optional-infect-list             ;observer procedure
                                           ;this function reports a list of non-infected friends of infected nodes
  let mylist []
  ask turtles with [message != 0][ask link-neighbors with [message = 0][set mylist lput who mylist ] ]
  set mylist remove-duplicates mylist

  foreach mylist [ask turtle ?
    [
       set color green
      set size 1]]
  report mylist
end 

to compute-distributions ;this function recompute all the distributions
  set final-distribution compute-reporter
  set dist-non-zero distribution-no-zeroes
end 



;OK

to-report k-list [srl] ; this function receives as an INPUT the searth results opinion list
                       ; and reurtns as OUTPUT a list of k opinions that would be read by a user according to the SERP function
                       ; If the SERP function returns an opinion that is in position larger than the existing nuber of opinions, the function would not include this opinion in the list
  let klist []

  ; the a and b are the parameters in the equation  y=aX^-b which has an inverse inverse(y): y=(x/a)^(1/b)
  let a 0.11
  let b 0.46
  let lengthlist length srl

  repeat k-oppinion
  [
    let u random-float 1
    let rank exp(5 * u - (5 / 4) )
    set rank int(rank) + 1
    ifelse (rank < lengthlist)
      [set klist lput item rank srl klist]
      []
  ]
  ; produce a list of opinions that are located in positon
  report klist
end 

There is only one version of this model, created about 8 years ago by Alon Sela.

Attached files

File Type Description Last updated
Information Spread by Search Engines..png preview Preview for 'Information Spread by Search Engines.' about 8 years ago, by Alon Sela Download

This model does not have any ancestors.

This model does not have any descendants.