Link Breeds Example

Link Breeds Example preview image

1 collaborator

Uri_dolphin3 Uri Wilensky (Author)

Tags

code example 

Tagged by Reuven M. Lerner almost 12 years ago

Model group CCL | Visible to everyone | Changeable by group members (CCL)
Model was written in NetLogo 5.0.4 • Viewed 1491 times • Downloaded 210 times • Run 2 times
Download the 'Link Breeds Example' modelDownload this modelEmbed this model

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


Comments and Questions

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

Click to Run Model

;; every link breed must be declared as either directed or undirected
directed-link-breed [red-links red-link]
undirected-link-breed [blue-links blue-link]

blue-links-own [ weight ]  ;; link breeds can own variables just like turtle breeds

to setup
  clear-all
  create-ordered-turtles 10 [
    fd 5
    set color gray
  ]
  ask n-of 5 turtles [
    ;; create--with is used to make undirected links
    create-blue-link-with one-of other turtles [
      set color blue
      set weight random 10
      set label weight
    ]
  ]
  ;; different breeds can have different default shapes
  set-default-shape red-links "curved link"
  ask n-of 5 turtles [
    ;; create--to/from are used to make directed links
    create-red-link-to one-of other turtles [
      set color red
    ]
  ]
end 


; Public Domain:
; To the extent possible under law, Uri Wilensky has waived all
; copyright and related or neighboring rights to this model.

There are 10 versions of this model.

Uploaded by When Description Download
Uri Wilensky over 11 years ago Updated to NetLogo 5.0.4 Download this version
Uri Wilensky about 12 years ago Updated version tag Download this version
Uri Wilensky almost 13 years ago Updated to NetLogo 5.0 Download this version
Uri Wilensky over 14 years ago Updated from NetLogo 4.1 Download this version
Uri Wilensky over 14 years ago Updated from NetLogo 4.1 Download this version
Uri Wilensky over 14 years ago Updated from NetLogo 4.1 Download this version
Uri Wilensky over 14 years ago Updated from NetLogo 4.1 Download this version
Uri Wilensky over 14 years ago Model from NetLogo distribution Download this version
Uri Wilensky over 14 years ago Link Breeds Example Download this version
Uri Wilensky over 14 years ago Link Breeds Example Download this version

Attached files

File Type Description Last updated
Link Breeds Example.png preview Preview for 'Link Breeds Example' over 11 years ago, by Uri Wilensky Download

This model does not have any ancestors.

This model does not have any descendants.