Simulated News Spreading on Social Network Sites_Final

Simulated News Spreading on Social Network Sites_Final preview image

1 collaborator

Default-person Bing Zhang (Author)

Tags

(This model has yet to be categorized with any tags)
Model group MAM-2013 | Visible to everyone | Changeable by everyone
Model was written in NetLogo 5.0.4 • Viewed 1382 times • Downloaded 153 times • Run 0 times
Download the 'Simulated News Spreading on Social Network Sites_Final' 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

nw:set-snapshot

Error:Nothing named NW:SET-SNAPSHOT has been defined. please help me solve this error.

Posted over 2 years ago

article as a refrence (Question)

I want to address this article as a refrence but it seems it hasn't published in a valid magazine. if it is, please send me information about it. Thanks

Posted over 1 year ago

need your published paper

Have you published a paper on this model?Can I have a reference if there is a paper?Thank you very much.

Posted about 1 year ago

Click to Run Model

extensions [ nw ]
globals [ centralities 
          clustering-coefficient
          centralities-diff
          clustering-coefficient-diff
          ]
turtles-own
[
  source
  belong-to   ;;news belong to whome
  centrality
  local-cluster
  newscolor   ;;initial news color red
  nodecolor   ;;original color
]


breed [news a-news]
breed [people node]

;;red 15, pink 135, blue 105, yellow 45

to setup
  clear-all
  create-people 1 [set color 15 set nodecolor 15 set shape "circle" set size 0.6]
  create-people 1 [set color 15 set nodecolor 15 create-link-with turtle 0 set shape "circle" set size 0.6]
  while [count turtles < number-of-nodes]
  [
  setup-initial-network find-partner
  ]
  ask one-of turtles[set color 135]
  let newscreater turtles with [color = 135]
  nw:set-snapshot turtles links
  cal-centrality newscreater
  setup-news 
  ask news [put-ontop]
  set centralities []
  set clustering-coefficient []
  set centralities-diff []
  set clustering-coefficient-diff []
  ;set centralities fput [centrality] of newscreater centralities
  ;set noderead fput 1 noderead
  reset-ticks
end 
  
;;prefential attachment

to setup-initial-network [old-node]
  
  create-people 1
  [
    set color 15
    set nodecolor 15
    set shape "circle"
    set size 0.6
    if old-node != nobody
      [ create-link-with old-node 
        ;; position the new node near its partner
        move-to old-node
        fd 8
      ]
  ]
end 

to-report find-partner
  let total random-float sum [count link-neighbors] of turtles
  let partner nobody
  ask turtles
  [
    let nc count link-neighbors
    ;; if there's no winner yet...
    if partner = nobody
    [
      ifelse nc > total
        [ set partner self ]
        [ set total total - nc ]
    ]
  ]
  report partner
end 
;;;;;;;;;;;;;;;;;;;;;;;;;

to setup-news
  create-news 1
  [ 
    set shape "square"
    set color 45  ;;yellow
    set newscolor 15
    set size 1
    set source one-of turtles with [color = 135]
    ]
  let temp one-of turtles with [color = 135]
  ask news [move-to temp set belong-to temp]
end 

to grow
   ifelse ticks mod news-life = 0 and ticks > 0
  [
    let countgreen count people with [color = 65]
    let countpink count people with [color = 135]
    let countgrey count people with [color = 9]
    let countsame countgreen + countpink
    let countdiff countgrey
    let countread countsame + countdiff
    
    ;;set noderead fput countread noderead
  
    ask news [die]
  ask turtles [set color nodecolor]
  ask one-of turtles [set color 135]
  let newscreater turtles with [color = 135]
  setup-news
  cal-centrality newscreater
  ;;set centralities fput [centrality] of newscreater centralities
  ]
  
  [
  ask turtles with [color = 135]
  [
    
    while [count link-neighbors with [color = 15 or color = 105] > 0]
    [
    let spread one-of link-neighbors with [color != 135] ;;node we are going to spread
    let parent one-of turtles-here with [color = 45]  ;;news to be spread
    
    if spread != nobody [
      
      ifelse [newscolor] of parent = [color] of spread
      [
        ask spread [set color 65]      ;; the people with same opinion read the news green
      if random-float 100 < news-is-interesting [
        ask spread [set color 135]
        ask parent[hatch 1]
        ask parent [move-to spread set belong-to spread]
        ask spread [create-link-with [source] of parent]
        ]] 
      [
        ask spread [set color 9]     ;; the people with different opinion read the news grey
        ]
    ]
    ]
    ]
  ]
  
  tick
end 

to spreadnews
   ifelse ticks mod news-life = 0 and ticks > 0
  [
    let countgreen count people with [color = 65]
    let countpink count people with [color = 135]
    let countgrey count people with [color = 9]
    let countsame countgreen + countpink
    let countdiff countgrey
    let countread countsame + countdiff   ;;everyone read news
    let creater [source] of one-of news
    ;;set noderead fput countread noderead
    
    set centralities fput(list [centrality] of creater countread) centralities
    set centralities-diff fput(list [centrality] of creater countdiff) centralities-diff
    if [local-cluster] of creater > 0
    [
      set clustering-coefficient fput(list [local-cluster] of creater countread) clustering-coefficient
      set clustering-coefficient-diff fput(list [local-cluster] of creater countdiff) clustering-coefficient-diff
      ]
    ask news [die]
  ask turtles [set color nodecolor]
  ask one-of turtles [set color 135]
  let newscreater turtles with [color = 135]
  setup-news
  cal-centrality newscreater
  cal-cluster newscreater
  ;set centralities fput [centrality] of newscreater centralities
  ]
  
  [
  ask turtles with [color = 135]
  [
    
    while [count link-neighbors with [color = 15 or color = 105] > 0]
    [
    let spread one-of link-neighbors with [color != 135] ;;node we are going to spread
    let parent one-of turtles-here with [color = 45]  ;;news to be spread
    
    if spread != nobody [
      
      ifelse [newscolor] of parent = [color] of spread
      [
        ask spread [set color 65]      ;; the people with same opinion read the news green
      if random-float 100 < news-is-interesting [
        ask spread [set color 135]
        ask parent[hatch 1]
        ask parent [move-to spread set belong-to spread]
        ]] 
      [
        ask spread [set color 9]     ;; the people with different opinion read the news grey
        ]
    ]
    ]
    ]
  ]
  
  tick
end 

to put-ontop
  hatch 1;;[create-links-with [links]of myself]
  die
end 

to layout
  ;; the number 3 here is arbitrary; more repetitions slows down the
  ;; model, but too few gives poor layouts
  repeat 3 [
    ;; the more turtles we have to fit into the same amount of space,
    ;; the smaller the inputs to layout-spring we'll need to use
    let factor sqrt count turtles
    ;; numbers here are arbitrarily chosen for pleasing appearance
    layout-spring turtles links (1 / factor) (7 / factor) (1 / factor)
    display  ;; for smooth animation
  ]
  ;; don't bump the edges of the world
  let x-offset max [xcor] of turtles + min [xcor] of turtles
  let y-offset max [ycor] of turtles + min [ycor] of turtles
  ;; big jumps look funny, so only adjust a little each time
  set x-offset limit-magnitude x-offset 0.1
  set y-offset limit-magnitude y-offset 0.1
  ask turtles [ setxy (xcor - x-offset / 2) (ycor - y-offset / 2) ]
  ask news [move-to [belong-to] of self]
end 

to-report limit-magnitude [number limit]
  if number > limit [ report limit ]
  if number < (- limit) [ report (- limit) ]
  report number
end 

to resize-nodes
  ifelse all? turtles [size <= 1]
  [
    ;; a node is a circle with diameter determined by
    ;; the SIZE variable; using SQRT makes the circle's
    ;; area proportional to its degree
    ask turtles [ set size sqrt count link-neighbors ]
  ]
  [
    ask turtles [ set size 1 ]
  ]
end 

to cal-centrality [choice]
  ifelse centrality-measure = "degree-centrality"
  [ask choice [ 
        set centrality count my-links
      ]
    ]
  [
    ask choice[
  set centrality runresult (word "nw:" centrality-measure)
  ]
  ]
  ;;report [centrality] of choice
end 

to cal-cluster [choice]
  ask choice
  [ let hood link-neighbors
    ifelse count hood <= 1
    [
      set local-cluster -1
    ]
    [
      let links-in-hood links with [ (member? end1 hood and member? end2 hood) ]
      set local-cluster (2 * count links-in-hood) / (count hood * (count hood - 1))
    ]
    ]
end 

to cal-local-cluster [choice]
  ask choice
  [let num-nei one-of link-neighbors with [color = 15]
    
    ]
end 

to two-color
  ask people with [who mod 2 = 0]
  [ 
    if color != 135
    [
    set color 105
    set nodecolor 105
    ]
    ]
end 
  

There is only one version of this model, created about 6 years ago by Bing Zhang.

Attached files

File Type Description Last updated
472 Project.zip data Everything about 6 years ago, by Bing Zhang Download
Bing Zhang_Proposal.pdf pdf Original Proposal about 6 years ago, by Bing Zhang Download
Bing_June 3.pdf pdf Progress Report_June 3 about 6 years ago, by Bing Zhang Download
Bing_May 13.pdf pdf Progress Report_May 13 about 6 years ago, by Bing Zhang Download
Bing_May 20.pdf pdf Progress Report_May 20 about 6 years ago, by Bing Zhang Download
Bing_May 27.pdf pdf Progress Report_May 27 about 6 years ago, by Bing Zhang Download
Final Paper_Bing Zhang.pdf pdf Final Paper about 6 years ago, by Bing Zhang Download
Simulated News Spreading on Social Network Sites_Final.png preview preview about 6 years ago, by Bing Zhang Download
Social_network - final.nlogo data NetLogo model about 6 years ago, by Bing Zhang Download
Social_network - HubNet_done.nlogo data HubNet Activity about 6 years ago, by Bing Zhang Download
Zhang_Bing_Slam_v2.pptx powerpoint Slam about 6 years ago, by Bing Zhang Download

This model does not have any ancestors.

This model does not have any descendants.