# Map represented as a network (rewiring equivalent to application of map)

Model was written in NetLogo 5.0.4
•
Viewed 444 times
•
Downloaded 28 times
•
Run 0 times

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

## Comments and Questions

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

Click to Run Model

breed [ nodes node ] ;; the turtle are called nodes nodes-own [ current-next-node new-next-node ] globals [ continue? ] ;; is it possible to apply the transformation once again to setup clear-all ;; creates all the nodes set-default-shape nodes "circle" let size-nodes ( 0.75 * max-pxcor / nb-nodes) create-nodes nb-nodes [set label who set size size-nodes ] ;; show the nodes with a circular layout layout-circle sort(turtles) radius ;; link the nodes init-links ;; set up global parameters set continue? true ;; set simulation time to 0 reset-ticks end to init-links ;; create an ordered cycle between nodes (e.g. 0 -> 1 -> 2 -> 3 ... -> (nb-nodes - 1) -> 0 ) ask nodes [ set current-next-node turtle ((who + 1) mod count nodes) link-nodes ] end to apply-transformation ;; rewire the links if continue? [ ;; we can still apply the transformation ask nodes [ ;; compute the new "next-node" set new-next-node (get-next-node nb-hop) ;; get the next n-hop node ] ;; remove the links ask links [ die ] ;; change the current pointer to the next-node by the newly computed one ask nodes [ set current-next-node new-next-node ] ;; link the nodes ask nodes [ link-nodes ] ] end to link-nodes ;; create a link between the node and its current next-node ifelse current-next-node != self [ create-link-to current-next-node [ set color [color] of end2 ] ] [ set continue? false ] end to-report get-next-node [ n ] ;; return the n-hop node (recursive function) let result nobody ifelse n = 0 [ report self ] [ set n n - 1 ask current-next-node [ set result get-next-node n ] ] report result end

There is only one version of this model, created over 9 years ago by julien siebert.

## Attached files

File | Type | Description | Last updated | |
---|---|---|---|---|

Map represented as a network (rewiring equivalent to application of map).png | preview | Preview for 'Map represented as a network (rewiring equivalent to application of map)' | over 9 years ago, by julien siebert | Download |

This model does not have any ancestors.

This model does not have any descendants.