create-<breed>-to create-<breeds>-to create-<breed>-from create-<breeds>-from create-<breed>-with create-<breeds>-with create-link-to4.0 create-links-to4.0 create-link-from4.0 create-links-from4.0 create-link-with4.0 create-links-with4.0

create-<breed>-to turtle create-<breed>-to turtle [ commands ] create-<breed>-from turtle create-<breed>-from turtle [ commands ] create-<breed>-with turtle create-<breed>-with turtle [ commands ] create-<breeds>-to turtleset create-<breeds>-to turtleset [ commands ] create-<breeds>-from turtleset create-<breeds>-from turtleset [ commands ] create-<breeds>-with turtleset create-<breeds>-with turtleset [ commands ] create-link-to turtle create-link-to turtle [ commands ] create-link-from turtle create-link-from turtle [ commands ] create-link-with turtle create-link-with turtle [ commands ] create-links-to turtleset create-links-to turtleset [ commands ] create-links-from turtleset create-links-from turtleset [ commands ] create-links-with turtleset create-links-with turtleset [ commands ] Turtle Command

Used for creating breeded and unbreeded links between turtles.

create-link-with creates an undirected link between the caller and agent. create-link-to creates a directed link from the caller to agent. create-link-from creates a directed link from agent to the caller.

When the plural form of the breed name is used, an agentset is expected instead of an agent and links are created between the caller and all agents in the agentset.

The optional command block is the set of commands each newly formed link runs. (The links are created all at once then run one at a time, in random order.)

A node cannot be linked to itself. Also, you cannot have more than one undirected link of the same breed between the same two nodes, nor can you have more than one directed link of the same breed going in the same direction between two nodes.

If you try to create a link where one (of the same breed) already exists, nothing happens. If you try to create a link from a turtle to itself you get a runtime error.

to setup
  clear-all
  create-turtles 5
  ;; turtle 1 creates links with all other turtles
  ;; the link between the turtle and itself is ignored
  ask turtle 0 [ create-links-with other turtles ]
  show count links ;; shows 4
  ;; this does nothing since the link already exists
  ask turtle 0 [ create-link-with turtle 1 ]
  show count links ;; shows 4 since the previous link already existed
  ask turtle 2 [ create-link-with turtle 1 ]
  show count links ;; shows 5
end
directed-link-breed [red-links red-link]
undirected-link-breed [blue-links blue-link]

to setup
  clear-all
  create-turtles 5
  ;; create links in both directions between turtle 0
  ;; and all other turtles
  ask turtle 0 [ create-red-links-to other turtles ]
  ask turtle 0 [ create-red-links-from other turtles ]
  show count links ;; shows 8
  ;; now create undirected links between turtle 0 and other turtles
  ask turtle 0 [ create-blue-links-with other turtles ]
  show count links ;; shows 12
end

Take me to the full NetLogo Dictionary