Network Example 3D

Network Example 3D preview image

1 collaborator

Uri_dolphin3 Uri Wilensky (Author)


(This model has yet to be categorized with any tags)
Model group CCL | Visible to everyone | Changeable by group members (CCL)
Model was written in NetLogo 3D 4.1pre7 • Viewed 374 times • Downloaded 25 times • Run 0 times
Download the 'Network Example 3D' modelDownload this modelEmbed this model

Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)


This is a 3D version of the 2D model Network Example. The only significant difference from the 2D code is that we spread the nodes around the world in 3D space.

This example demonstrates how to make a network in NetLogo. The network consists of a collection of nodes, some of which are connected by edges.

This example doesn't do anything in particular with the nodes and edges. You can use it as the basis for your own model that actually does something with them.


Position the nodes in a circle, instead of randomly.

Use the turtle variable LABEL to label the nodes and/or edges with some information.

Try calculating some statistics about the network that forms, for example the average degree.

Try other rules for connecting nodes besides totally randomly. For example, you could:

- Connect every node to every other node.

- Make sure each node has at least one edge going in or out.

- Only connect nodes that are spatially close to each other.

- Make some nodes into "hubs" (with lots of edges).

And so on.

Make two kinds of nodes, differentiated by color, then only allow edges to connect two nodes that are different colors. This makes the network "bipartite." (You might position the two kinds of nodes in two straight lines.)


In the GO button, the "Force display update after each iteration" checkbox is turned off. This makes the model run a lot faster, since we don't need to see each edge appear and disappear individually.


Network Example

Owen Densmore's "Layout" model, available from the NetLogo User Community Models web page (, shows how to make the nodes and edges automatically reposition themselves into a pleasing-looking layout. It also shows how to generate a network with "hubs", where the distribution of the number of edges the nodes have follows a power law.

Comments and Questions

Please start the discussion about this model! (You'll first need to log in.)

Click to Run Model

to setup
  ;; These shapes were drawn using the Shapes Editor, on
  ;; the Tools menu.
  set-default-shape turtles "circle"
  create-turtles number-of-nodes
    ;; Initially, my-nodes have no connecting edges.  So we set
    ;; out-edges and in-edges to the empty list.
    set shape "circle"
    set color blue
    set size 3
    set pitch random 360
    fd max-pxcor - 5

;; This procedure demos the creation and deletion of edges.
;; Here we create and delete edges totally at random, except that
;; we never go below 10 edges.

to go
  ask one-of turtles
    [ form-random-edge ]
  if count links > number-of-edges
    [ ask one-of links
        [ die ] ]

to wiggle-nodes
  ask turtles [ fd 0.1 left random 90 tilt-up random 90 ]

to form-random-edge ;; node procedure
  ;; pick a random other node
  let other-node one-of other turtles
  ;; make sure we got another node, and that we aren't connected
  ;; to it, and that it isn't connected to us
  if (other-node != nobody) and link-with other-node = nobody
     create-link-with other-node [ set color green ]

; Copyright 2004 Uri Wilensky. This code may be freely copied, distributed,
; altered, or otherwise used by anyone for any legal purpose.

There are 3 versions of this model.

Uploaded by When Description Download
Uri Wilensky over 12 years ago Updated from NetLogo 4.1 Download this version
Uri Wilensky over 12 years ago Model from NetLogo distribution Download this version
Uri Wilensky over 12 years ago Network Example 3D Download this version

Attached files

File Type Description Last updated
Network Example 3D.png preview Preview for 'Network Example 3D' almost 10 years ago, by Uri Wilensky Download

This model does not have any ancestors.

This model does not have any descendants.