test

test preview image

1 collaborator

Default-person Nicole lim (Author)

Tags

(This model has yet to be categorized with any tags)
Visible to everyone | Changeable by everyone
Model was written in NetLogo 6.0 • Viewed 100 times • Downloaded 8 times • Run 0 times
Download the 'test' 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]

turtles-own [
  adopted?    ;; whether or not the agent has adopted the product
]

to setup
  clear-all
  create-network
  seed
  reset-ticks
end 

;; seed the population with users who have already been given the product
;;  you can either seed randomly or use betweenness centrality

to seed
  if seeding-method = "random" [
    ask n-of budget turtles [
      set adopted? true
      update-color
    ]
  ]
  if seeding-method = "betweenness" [
    ask max-n-of budget turtles [ nw:betweenness-centrality ] [
      set adopted? true
      update-color
    ]
  ]
end 

;; create the social network

to create-network
  if network-type = "random" [ create-random-network ]
  if network-type = "preferential-attachment" [ create-preferential-attachment ]
end 

;; the Barabasi-Albert method of creating a PA graph

to create-preferential-attachment
  nw:generate-preferential-attachment turtles links 500 [
    set size 2
    set shape "circle"
    set color blue
    set adopted? false
  ]
end 

;; generate an Erdos-Renyi random graph

to create-random-network
  nw:generate-random turtles links 500 0.004 [
    set shape "circle"
    set color blue
    set size 2
    set adopted? false
  ]
end 

;; simple loop just check to see if a turtle hasn't adopted then decide if they should adopt

to go
  if all? turtles [ adopted? ] [ stop ]
  ask turtles with [ not adopted? ] [ decide-to-adopt ]
  ask turtles [ update-color ]
  tick
end 

;; the decision rule to adopt which is based on the Bass model of diffusion

to decide-to-adopt
  ifelse random-float 1.0 < 0.01 [
    set adopted? true
  ] [
    if any? link-neighbors [
      let neighbors-adoption count link-neighbors with [ adopted? ] / count link-neighbors
      if random-float 1.0 < 0.5 * neighbors-adoption [
        set adopted? true
      ]
    ]
  ]
end 

;;
;; utility procedures
;;

to update-color
  if adopted? [ set color red ]
end 

to layout
  layout-spring turtles links 1 14 1.5
  display
end 


; Copyright 2012 Uri Wilensky.
; See Info tab for full copyright and license.

There is only one version of this model, created over 6 years ago by Nicole lim.

Attached files

File Type Description Last updated
test.png preview Preview for 'test' over 6 years ago, by Nicole lim Download

This model does not have any ancestors.

This model does not have any descendants.