The turtles that are connected by links in link-set but not included in turtle-set are placed in a circle layout with the given radius. There should be at least 3 agents in this agentset.
The turtles in turtle-set are then laid out in the following manner: Each turtle is placed at centroid (or barycenter) of the polygon formed by its linked neighbors. (The centroid is like a 2-dimensional average of the coordinates of the neighbors.)
(The purpose of the circle of "anchor agents" is to prevent all the turtles from collapsing down to one point.)
After a few iterations of this, the layout will stabilize.
This layout is named after the mathematician William Thomas Tutte, who proposed it as a method for graph layout.
to make-a-tree set-default-shape turtles "circle" crt 8 ask turtle 0 [ create-link-with turtle 1 create-link-with turtle 2 create-link-with turtle 3 ] ask turtle 1 [ create-link-with turtle 4 create-link-with turtle 5 create-link-with turtle 6 create-link-with turtle 7 ] ; place all the turtles with just one ; neighbor on the perimeter of a circle ; and then place the remaining turtles inside ; this circle, spread between their neighbors. repeat 10 [ layout-tutte (turtles with [count link-neighbors > 1]) links 8 ] end
Take me to the full NetLogo Dictionary