RismanPreferentialAttachment

No preview image

1 collaborator

Default-person Alexander Risman (Author)

Tags

(This model has yet to be categorized with any tags)
Parent of 2 models: Knights and Kings and Prejudice
Visible to everyone | Changeable by everyone
Model was written in NetLogo 4.1.2 • Viewed 154 times • Downloaded 23 times • Run 1 time
Download the 'RismanPreferentialAttachment' 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 section could give a general understanding of what the model is trying to show or explain.

HOW IT WORKS

This section could explain what rules the agents use to create the overall behavior of the model.

HOW TO USE IT

This section could explain how to use the model, including a description of each of the items in the interface tab.

THINGS TO NOTICE

This section could give some ideas of things for the user to notice while running the model.

THINGS TO TRY

This section could give some ideas of things for the user to try to do (move sliders, switches, etc.) with the model.

EXTENDING THE MODEL

This section could give some ideas of things to add or change in the procedures tab to make the model more complicated, detailed, accurate, etc.

NETLOGO FEATURES

This section could point out any especially interesting or unusual features of NetLogo that the model makes use of, particularly in the Procedures tab. It might also point out places where workarounds were needed because of missing features.

RELATED MODELS

This section could give the names of models in the NetLogo Models Library or elsewhere which are of related interest.

CREDITS AND REFERENCES

This section could contain a reference to the model's URL on the web if it has one, as well as any other necessary credits or references.

Comments and Questions

Click to Run Model

directed-link-breed [friendships friendship]

breed [persons person]
persons-own [
  in-friends
  out-friends
  total-friends
  extended-network
  ]

to setup
  clear-all
  create-persons number-of-people
   ask persons [
     move-to one-of patches
     set shape "person"
     set color red
      ]
end 

to go
  ifelse link-type = "directed"
  [go-directed]
  [go-undirected]
end 

to go-directed
  ask persons[
  
  set out-friends count out-friendship-neighbors
  set in-friends count in-friendship-neighbors
  let total-friend-set (turtle-set in-friendship-neighbors out-friendship-neighbors)
  set total-friends count total-friend-set
  let extended-network-set (turtle-set [in-friendship-neighbors] of total-friend-set 
    [out-friendship-neighbors] of total-friend-set total-friend-set)
  set extended-network count extended-network-set
  wiggle
    make-friends
    maintain-max
    
  ]
end  

to wiggle 
  rt random-float 360 fd 1
end 

to make-friends
  let prospect one-of other persons-here
  if prospect != nobody
  [
    if out-friends < max-out-friends
  [create-friendship-to prospect]
  if out-friends = max-out-friends
  [let worst-friend min-one-of out-friendship-neighbors [total-friends]
    if worst-friend != nobody
    [
  if [total-friends] of prospect > [total-friends] of worst-friend
  [ask out-friendship-to worst-friend [die] 
    create-friendship-to prospect]]
  ]
  ]
end 

to maintain-max
  let worst-out-friend min-one-of out-friendship-neighbors [total-friends]
  let worst-in-friend min-one-of in-friendship-neighbors [total-friends]
  if worst-out-friend != nobody
  [
    if out-friends > max-out-friends
  [ask out-friendship-to worst-out-friend [die] ]
  ]
  if worst-in-friend != nobody  
    [if in-friends > max-in-friends
    [ask in-friendship-from worst-in-friend [die] ]
    ]
end 

to cut-doubles
  ask turtles [ask out-friendship-neighbors
  [
    if out-friendship-neighbor? myself
    [ask in-friendship-from myself [die]
    ]
  ]]
end 

to go-undirected
  ask persons[
  let total-friend-set link-neighbors
  set total-friends count total-friend-set
  let extended-network-set (turtle-set [link-neighbors] of link-neighbors 
    total-friend-set)
  set extended-network count extended-network-set
  
  wiggle
  make-friends-undirected
  maintain-max-undirected
  ]
end 

to make-friends-undirected
  let prospect one-of other persons-here
  if prospect != nobody
  [
    if total-friends < max-total-friends
  [create-link-with prospect]
  if total-friends = max-total-friends
  [let worst-friend min-one-of link-neighbors [total-friends]
    if worst-friend != nobody
    [
  if [total-friends] of prospect > [total-friends] of worst-friend
  [ask link-with worst-friend [die] 
    create-link-with prospect]]
  ]
  ]
end 

to maintain-max-undirected
  let worst-friend min-one-of link-neighbors [total-friends]
  if worst-friend != nobody
  [
    if total-friends > max-total-friends
  [ask link-with worst-friend [die] ]
  ]
end 
  
      
     

There are 3 versions of this model.

Uploaded by When Description Download
Alexander Risman almost 13 years ago No description provided Download this version
Alexander Risman almost 13 years ago No description provided Download this version
Alexander Risman almost 13 years ago Initial upload Download this version

Attached files

No files

This model does not have any ancestors.

Children:

Graph of models related to 'RismanPreferentialAttachment'