nw:generate-small-world
nw:generate-small-world turtle-breed link-breed row-count column-count clustering-exponent is-toroidal optional-command-block
Generates a new small-world network using the Kleinberg Model. Note that nw:generate-watts-strogatz
generates a more traditional small-world network.
The algorithm proceeds by generating a lattice of the given number of rows and columns (the lattice will wrap around itself if is-toroidal is true
). The “small world effect” is created by adding additional links between the nodes in the lattice. The higher the clustering-exponent, the more the algorithm will favor already close-by nodes when adding new links. A clustering exponent of 2.0
is typically used.
If you specify an optional-command-block, it is executed for each turtle in the newly created network. For example:
nw:generate-small-world turtles links 10 10 2.0 false [ set color red ]
The turtles are generated in the order that they appear in the lattice. So, for instance, to generate a kleinberg lattice accross the entire world, and lay it out accordingly, try the following:
nw:generate-small-world turtles links world-width world-height 2.0 false
(foreach (sort turtles) (sort patches) [ [t p] -> ask t [ move-to p ] ])
Take me to the full Networks Extension Dictionary