# Yet another implementation of Watts and Strogatz Small World Algorithm

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

## WHAT IS IT?

It is an implementation of the Watts and Strogatz Small World Algorithm. Mainly for example and discussion purposes.

## HOW IT WORKS

First the nodes are created. Then a regular lattice of K nearest neighbours. Finally with a probability beta each link is rewired to a 'not-yet-neighbour' node with id > the current node.

See Watts and Strogatz Algorithm http://en.wikipedia.org/wiki/Watts*and*Strogatz_model

## HOW TO USE IT

Set the number of nodes. Set the parameters K and Beta. Choose the radius of the layout.

## THINGS TO NOTICE

(suggested things for the user to notice while running the model)

## THINGS TO TRY

## EXTENDING THE MODEL

You can use this code sample

## NETLOGO FEATURES

## RELATED MODELS

## CREDITS AND REFERENCES

http://en.wikipedia.org/wiki/Watts*and*Strogatz_model

## Comments and Questions

to setup clear-all ;; creates all the nodes set-default-shape turtles "circle" create-turtles nb-nodes [set size 0.5 set color gray] ;; arrange them in a circle in order by who number layout-circle (sort turtles) radius ;; create the link between the nodes with the Watts and Strogatz algorithm link-nodes ;; set the simulation time to 0 (plot things) reset-ticks ;; go end ;;to go ;; tick ;;end ;; create the links among nodes (Watts and Strogatz algorithm), add weight and color to link-nodes ;; create a regular lattice ask turtles [ let n 1 while [ n <= K ] [ ifelse who < (count turtles - K) [ ifelse (random-float 1) < beta [ random-link ] [ normal-link n ] ] [ normal-link n ] set n (n + 1) ] ] end to normal-link [n] create-link-with turtle ((who + n) mod count turtles) [ set color blue ] end ;; create a link with another 'not-yet linked' node whose id > caller id to random-link let myid who let other-node one-of other turtles with [(who > myid) and (not link-neighbor? turtle myid)] if other-node != nobody [ create-link-with other-node [ set color red ] ] end

There are 2 versions of this model.

## Attached files

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

Yet another implementation of Watts and Strogatz Small World Algorithm.png | preview | Preview for 'Yet another implementation of Watts and Strogatz Small World Algorithm' | over 9 years ago, by julien siebert | Download |

This model does not have any ancestors.

This model does not have any descendants.