BBAE16502
Research Methods and Simulation
研究方法與仿真
Lecturer:
Helmond Io Hio Nam (姚曉南)
hnio@must.edu.mo
Week#9
Network
• Nodes: Represent basic object (turtles)
• Edges: Represent types of relationships (link)
Edges
• Undirected
• Imply a symmetric relationship
• Siblings, roommates, co-authors
• Directed
• Imply a non-symmetric relationship
• In love with, trusts, supervises
Link
• A turtle can create a link with another turtle: ask turtle 0 [create-link-to turtle 1]
ask turtle 0 [create-link-to turtle 1 [ tie ] ]
ask turtles [create-link-with one-of other turtles]
• Inspect link
• To untie a link
ask link 0 1 [untie] / Tie-mode: none
Link
• Some link primitives that turtles can use:
• my-links ;; returns set of my links
• link-neighbors ;; returns turtles I am linked to
• Example
• ask my-links [die]
• ask link-neighbors with [color = red] [die]
• count my-links of link-neighbors
Edges
• 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 ]
“in” and “out”
• my-in-links ;; set of links directed “in” to me
• my-out-links ;; set of links directed “out” to me
• in-link-neighbors ;; return my in link neighbors
• out-link-neighbors ;; return my out link neighbors