Network Example 3D
Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)
WHAT IS IT?
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.
EXTENDING THE MODEL
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.)
NETLOGO FEATURES
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.
RELATED MODELS
Network Example
Owen Densmore's "Layout" model, available from the NetLogo User Community Models web page (http://ccl.northwestern.edu/netlogo/models/community/), 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
to setup ca ;; 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 ] end ;; 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 ] ] tick end to wiggle-nodes ask turtles [ fd 0.1 left random 90 tilt-up random 90 ] display end 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 ] ] end ; 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.
Attached files
File | Type | Description | Last updated | |
---|---|---|---|---|
Network Example 3D.png | preview | Preview for 'Network Example 3D' | over 11 years ago, by Uri Wilensky | Download |
This model does not have any ancestors.
This model does not have any descendants.