directed-link-breed
directed-link-breed <link-breeds> <link-breed>
This keyword, like the globals and breeds keywords, can only be
used at the beginning of the Code tab, before any procedure
definitions. It defines a directed link breed. Links of a
particular breed are always all directed or all undirected The
first input defines the name of the agentset associated with the
link breed. The second input defines the name of a single member of
the breed. Directed links can be created using create-link(s)-to, and create-link(s)-from, but not create-link(s)-with
Any link of the given link breed:
- is part of the agentset named by the link breed name
- has its built-in variable
breedset to that agentset - is directed or undirected as declared by the keyword
Most often, the agentset is used in conjunction with ask to give commands to only the links of a particular breed.
directed-link-breed [streets street]
directed-link-breed [highways highway]
to setup
clear-all
crt 2
;; create a link from turtle 0 to turtle 1
ask turtle 0 [ create-street-to turtle 1 ]
;; create a link from turtle 1 to turtle 0
ask turtle 0 [ create-highway-from turtle 1 ]
end
ask turtle 0 [ show one-of my-in-links ]
;; prints (street 0 1)
ask turtle 0 [ show one-of my-out-links ]
;; prints (highway 1 0)See also breed, undirected-link-breed