Modeling the Spread of Viral Videos

No preview image

1 collaborator

Default-person Jeanette Pranin (Author)

Tags

(This model has yet to be categorized with any tags)
Model group MAM-2016 | Visible to everyone | Changeable by group members (MAM-2016)
Model was written in NetLogo 5.2.1 • Viewed 532 times • Downloaded 56 times • Run 0 times
Download the 'Modeling the Spread of Viral Videos' modelDownload this modelEmbed this model

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


Info tab cannot be displayed because of an encoding error

Comments and Questions

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

Click to Run Model

extensions [ nw ]
globals [
  ;;from http://link.springer.com.turing.library.northwestern.edu/article/10.1007/s10844-011-0191-2/fulltext.html\
  ;;rates of likelihood of sharing based on type of video
  likelihood-list

  ;;Possible types of video
  types-of-video

  ;most popular video
  most-popular-video

  ;most sharing person
  most-sharing-person

  ;total number of videos that have been shared
  total-number-shared

  ;rates of sharing by video-type found by model
  rates-of-sharing

  types-of-social-motivation
]

turtles-own [
  ;; videos this turtle has seen (will have video-ids of patches)
  videos-seen
  ;; chance that this person will share
  chance-of-sharing
  ;; if you are recommending right now
  recommending?
  ;previous recommender
  prev-recommender
  ;number of times this person has shared a video
  num-times-shared
]
patches-own [
  ;; number of times video has been viewed
  num-times-viewed
  ;; type of video
  video-type
  ;; id for videos to be put into "videos-seen" of turtles
  video-id
  ;social motivation ratings
  motivation-ratings

  ;last person who shared this video
  shared-by

]

links-own [
  weight
]

to setup
  clear-all
  set-globals
  create-people
  create-all-videos
  reset-ticks
end 

to set-globals
  ;;from http://link.springer.com.turing.library.northwestern.edu/article/10.1007/s10844-011-0191-2/fulltext.html\
  ;;rates of likelihood of sharing based on type of video

   set likelihood-list [42.3 38.8 31.7 29.5 28.8 28.4 28.1 26.7 23.8 20.0 19.7 15.6 15.3 14.0 12.8 9.8]

   set types-of-social-motivation ["shared-passion" "social-irl" "social-utility" "social-good" "zeitgeist" "kudos" "reaction-seeking" "self-expression" "shared-emotional-experience"]

   set rates-of-sharing [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]

   ;;possible types of video
   set types-of-video [1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16]

   set most-popular-video max-one-of patches [num-times-viewed]

   set most-sharing-person max-one-of turtles [num-times-shared]

   set total-number-shared 1
end 

to create-people
  set-default-shape turtles "person"
  if network-type = "random" [ create-random-network ]
  if network-type = "preferential" [ create-preferential-network ]
  if network-type = "small-world" [ create-small-world-network ]
  setup-links

  ask turtles [
    ;nobody has recommended a video yet
    set prev-recommender nobody

    set color brown + 1

    ;;nobody has seen any videos at the start
    set videos-seen []

    ;how often this turtle shares a video they like
    set chance-of-sharing random 100

    ;no turtle is recommending a video upon initialization
    set recommending? false

    ;;random x y position
    setxy random-xcor random-ycor
  ]
end 

;creates a random network between turtles

to create-random-network
  ; with 10% chance of being connected
  nw:generate-random turtles links number-of-people 0.1
end 

to create-preferential-network
  nw:generate-preferential-attachment turtles links number-of-people
end 

to create-small-world-network
  let sq sqrt number-of-people
  nw:generate-small-world turtles links sq sq 2.0 false
end 

to setup-links ;link procedure
  ask links [
    set weight 1
    set label weight
  ]
end 

to create-new-video ;patch procedure
  set num-times-viewed 0

  set shared-by nobody

  set motivation-ratings (list (random 5 + 1) (random 5 + 1) (random 5 + 1) (random 5 + 1) (random 5 + 1) (random 5 + 1) (random 5 + 1) (random 5 + 1) (random 5 + 1) )

  ;going from upper-left corner to bottom right corner
  if pxcor <= -8 and pxcor >= -16 and pycor <= 16 and pycor >= 8 [ set video-type 1 ]
  if pxcor <= -8 and pxcor >= -16 and pycor <= 8 and pycor >= 0 [ set video-type 2 ]
  if pxcor <= 0 and pxcor >= -8 and pycor <= 16 and pycor >= 8 [ set video-type 3 ]
  if pxcor <= -8 and pxcor >= -16 and pycor <= 0 and pycor >= -8 [ set video-type 4 ]
  if pxcor <= 0 and pxcor >= -8 and pycor <= 8 and pycor >= 0 [ set video-type 5 ]
  if pxcor <= 8 and pxcor >= 0 and pycor <= 16 and pycor >= 8 [ set video-type 6 ]
  if pxcor <= -8 and pxcor >= -16 and pycor <= -8 and pycor >= -16 [ set video-type 7 ]
  if pxcor <= 0 and pxcor >= -8 and pycor <= 0 and pycor >= -8 [ set video-type 8 ]
  if pxcor <= 8 and pxcor >= 0 and pycor <= 8 and pycor >= 0 [ set video-type 9 ]
  if pxcor <= 16 and pxcor >= 8 and pycor <= 16 and pycor >= 8 [ set video-type 10 ]
  if pxcor <= 0 and pxcor >= -8 and pycor <= -8 and pycor >= -16 [ set video-type 11 ]
  if pxcor <= 8 and pxcor >= 0 and pycor <= 0 and pycor >= -8 [ set video-type 12 ]
  if pxcor <= 16 and pxcor >= 8 and pycor <= 8 and pycor >= 0 [ set video-type 13 ]
  if pxcor <= 8 and pxcor >= 0 and pycor <= -8 and pycor >= -16 [ set video-type 14 ]
  if pxcor <= 16 and pxcor >= 8 and pycor <= 0 and pycor >= -8 [ set video-type 15 ]
  if pxcor <= 16 and pxcor >= 8 and pycor <= -8 and pycor >= -16 [ set video-type 16 ]
  set pcolor video-color? video-type
end 

to create-all-videos ;patch procedure
  ask patches [ create-new-video ]
  ;;create unique id for each patch
  (foreach (sort patches) (n-values count patches [?]) [ ask ?1 [ set video-id ?2 ] ])
end 

to go
  ask turtles [
    watch-video
    find-new-video
  ]
  ; every deletion-rate number of ticks, delete old videos with too little views
  if ticks mod deletion-rate = 0 [
    check-if-delete-video
  ]

  ;update MPV variable
  set most-popular-video max-one-of patches [num-times-viewed]

  ;update MSP variable
  set most-sharing-person max-one-of turtles [num-times-shared]

  tick
end 

to watch-video ;turtle procedure
  set recommending? false
  let video [video-id] of patch-here
  ;if you've seen it, only a 50% chance you'll see it again. Otherwise, move to a related video
  ifelse member? video videos-seen and random 10 < 5 [
     rt random 360
     fd 1
  ] [
    ask patch-here [
      ;set patch's own num-times-viewed
      set num-times-viewed num-times-viewed + 1
       ;change color every 5 views
       if num-times-viewed mod 5 = 0 [
         ifelse pcolor mod 10 = 0 [ set pcolor 0 ] [ set pcolor pcolor - 0.1 ]
       ]
     ]
    set videos-seen lput video videos-seen
    calculate-chance-of-sharing
  ]
end 

to calculate-chance-of-sharing ;turtle procedure
  let temp-likelihood 0
  let index video-type - 1
  set temp-likelihood item index likelihood-list
  let social-motivation-rate [mean motivation-ratings] of patch-here / 5 ;5 because maximum motivation rating is a 5 for each of 9 categories, find that mean
  ; if product of them sharing it and likelihood of video type being shared is enough, share it
  if random-float 1 <  social-motivation-rate * (chance-of-sharing / 100) * (temp-likelihood / 100) [
    set shared-by self
    share-video index
    ;you liked and shared the video your previous recommender recommended
    ;strengthen the connection between you two
    if prev-recommender != nobody [
      ask link-with prev-recommender [
        set weight weight + 1
        set label weight
      ]
    ]
  ]
end 

to share-video [index] ;turtle procedure
  set num-times-shared num-times-shared + 1

  ;set total times shared
  set total-number-shared total-number-shared + 1

  ;set total times this video type has been shared
  let temp-val item index rates-of-sharing
  set temp-val temp-val + 1
  set rates-of-sharing replace-item index rates-of-sharing temp-val

  set recommending? true
end 

to find-new-video ;turtle procedure
  let links-sharing my-links with [[recommending?] of other-end]

  ; if anyone is currently sharing
  if any? links-sharing [
    let bff-whos-sharing [other-end] of max-one-of links-sharing [weight]

    ;let bff-whos-sharing [other-end] of max-one-of my-links with [[recommending?] of other-end] [weight]
    if bff-whos-sharing = nobody [ stop ]

    set prev-recommender bff-whos-sharing

    move-to [patch-here] of bff-whos-sharing
  ]
end 

to check-if-delete-video ;patches procedure
  ;will let us know whether to delete video-id from turtles' videos-seen list
  let deleted-videos []
  ask patches [
    let most-viewed [num-times-viewed] of most-popular-video
    ;create a new video in its place
    if random 100 < chance-of-deletion [
      set deleted-videos lput video-id deleted-videos
      create-new-video
    ]
  ]
  ;remove the deleted videos from the turtles "video-seen" list because now
  ;new videos have taken their place
  foreach deleted-videos [
    ask turtles [
      if member? ? videos-seen [
        set videos-seen remove ? videos-seen
      ]
    ]
  ]
end 

to-report video-color? [v-type]
  let dark-gray gray - 3
  let color-list (list red orange brown yellow green lime turquoise cyan sky blue violet magenta pink gray dark-gray white)

  let index v-type - 1
  report item index color-list
end 

to-report nominal-video-type? [v-type]
  let type-list ["Animals" "Activism" "Politics" "Travel" "Education" "Science" "Sports" "People" "Autos" "Comedy" "Howto" "Entertainment" "Games" "Film" "Music" "Shows"]
  let index v-type - 1
  report item index type-list
end 

There are 4 versions of this model.

Uploaded by When Description Download
Jeanette Pranin almost 8 years ago Final Version Download this version
Jeanette Pranin almost 8 years ago Added types of video ("Animals", "Activism", etc) Download this version
Jeanette Pranin almost 8 years ago Turtles now "watch" the videos Download this version
Jeanette Pranin almost 8 years ago Initial upload Download this version

Attached files

File Type Description Last updated
JeanettePranin_May16.docx word Second Progress Report almost 8 years ago, by Jeanette Pranin Download
JeanettePranin_May23.docx word Third Progress Report almost 8 years ago, by Jeanette Pranin Download
JeanettePranin_May9.docx word First Progress Report for Final Project, due May 9th 2016 almost 8 years ago, by Jeanette Pranin Download
Modeling Viral Videos.docx word Final Report with Results of Model almost 8 years ago, by Jeanette Pranin Download

This model does not have any ancestors.

This model does not have any descendants.