Home Download Help Forum Resources Extensions FAQ NetLogo Publications Contact Us Donate Models: Library Community Modeling Commons Beginners Interactive NetLogo Dictionary (BIND) NetLogo Dictionary User Manuals: Web Printable Chinese Czech Farsi / Persian Japanese Spanish
|
NetLogo Models Library: |
If you download the NetLogo application, this model is included. You can also Try running it in NetLogo Web |
This example shows how to construct a regular lattice or mesh of links. Two kinds of lattice are demonstrated, a square lattice (where each node has four neighbors) and a hex lattice (where each node has six neighbors).
The current code creates undirected links. To modify setup-square
to create a fully connected lattice of directed links, use create-links-to
instead of create-links-with
. (Making the same change to the hex lattice code is only a little trickier.)
If you turn off wrapping at one or both world boundaries, the lattice will be bounded. You don't need to change the square lattice code in that case, because the neighbors4
primitive returns fewer than four neighbors for patches on the world edges. (Making the same change to the hex lattice code is only a little trickier.)
The square lattice can be modified to include diagonal links by changing neighbors4
to neighbors
.
(back to the NetLogo Models Library)