Watts & Strogatz Small World Model: Barış Ekdi
Watts & Strogatz Small World Model: Barış Ekdi
Watts & Strogatz Small World Model: Barış Ekdi
Barış Ekdi
5/15/2007
Barış EKDi STPS 514 – Assignment IV
by
BARIŞ EKDĐ
1
Barış EKDi STPS 514 – Assignment IV
The W&S Model is built by rewiring a regular lattice to create long-range edges or shortcuts
in the network. The model takes a single parameter “p” and interpolates between a regular
lattice and a random network as p varies; according to the following algorithm:
1. Start with order : We start with a regular ring lattice in which there are N nodes each
connected with K of its neighbors (K / 2 on each side).
This process introduces non-lattice edges which are likely to connect nodes that were distant
in the original lattice. By varying p we can interpolate between a regular lattice (p = 0) and a
random network (p = 1):
2
Barış EKDi STPS 514 – Assignment IV
The underlying lattice structure of the WS model produces a locally clustered network, and
the long-range links introduced by the randomization procedure dramatically reduce the
diameter of the network, even when very few such links are introduced.
2. THE PROGRAM
The Program is written using Microsoft Visual Basic 6.0. The startup screenshot of the
program is as follows:
Parameters Frame: A graphical user interface (GUI) is used for getting the required
parameters from the user, in order to run the simulation. However, the user can also use the
default parameters (Number of Vertices=20; Probability=0.01; Number of Turns to Run the
Simulation = 1) loaded while starting the program. As the program started, a graph is drawn
according to those values, and re-drawn whenever the user changes the number of vertices.
3
Barış EKDi STPS 514 – Assignment IV
• There are also three output windows apart from the one which is used for the graphic.
Output in Pajek Format: This window stays empty until the simulation run. The results of the
simulation are shown in Pajek format in order to check the accuracy. So, the user can save the
results and use in Pajek.
Detailed Process and Output Window: This window is used in order to inform the user about
almost each step of the process the program is executing. Therefore the user can check the
calculations and save it for further use.
Matrix View of the Network Window: Used to show the connections between the vertices. If
there is a connection between to vertices, (i.e. 3 and 5) the value at intersection of the row 3
and column 5 will be “1” otherwise it will be “0”.
RUN: Gets the parameters and starts the simulation (Explained in detail in the next subsection
of this paper: “How it Works”) and prints the results and processes onto Output in Pajek
Format Window, Detailed Process and Output Window, Matrix View of the Network Window
accordingly.
CALCULATE: Calculates the individual cliquishness of the vertices and average cliquishness
of the net. (See “How It Works” for the details.)
RESTART: Initializes the values, variables and clears the windows for another simulation.
SAVE_Pajek: Saves the output in Output in Pajek Format Window to drive C:\ in a Pajek
readable format. Date and time stamp is added to the filename with the “.NET” extension.
SAVE_Process: Saves the output in Detailed Process and Output Window to drive C:\. Date
and time stamp is added to the filename with the “.TXT” extension.
SAVE_Matrix: Saves the output in Matrix View of the Network Window to drive C:\. Date and
time stamp is added to the filename with the “.TXT” extension.
SAVE_Graph: Saves the graphic of the network to drive C:\ in bitmap format. Date and time
stamp is added to the filename with the “.BMP” extension.
4
Barış EKDi STPS 514 – Assignment IV
A simple pseudo-algorithm is given below in order to explain how the program runs:
1. Load default parameters and draw default graph when the program is started – using the
subs <INITALIZE> and <PRINT_MATRIX>
2.1. Changes the number of the vertices redraw the graph and print the new values into
relative windows; using the subs <INITALIZE> and <PRINT_MATRIX>
2.4. Hits RESTART button, clear the windows and graph; go to sub <INITALIZE> for
getting the default values and redraw and fill the windows, using subs
<PRINTMATRIX>, <DRAW_NODES>, <DRAW_EDGES>
1. <Sim_Start >
1.1. Get / check user defined parameters: the probability (ProbabSet); number of vertices
(NofNodes); number of the turns the simulation will run (NofTurns)
For each vertice (vFocused) from no.1 to the last one (NofNodes) (in clockwise
turn);
5
Barış EKDi STPS 514 – Assignment IV
End If
Next vertice
Next i
1.3. Print the results to relevant windows and draw the graph.
2. <Calculate_Cliquishness>
2.1. Calculate_NumberofNeighbours :
{ Node(i).NofNeighbours }
2.1.1.2. and record the names of each of the neighbors (j) to the property of the
node: { Node(i).Neighbours(j) }
2.2.1. For each of the node ( i =1 to NofNodes ) calculate the maximum edges
potentially available for the node and cliquishness of the node as follows:
2.2.1.1. Get the number and names of the neighbors of the node
2.2.1.3. For each of the node ( i =1 to NofNodes ) calculate the maximum edges
potentially available for the node…
6
Barış EKDi STPS 514 – Assignment IV
2.3.1. Sum the cliquishness values of the each of the nodes (i=1 to NofNodes)
{For i = 1 To NofNodes
Next i }
3. THE OUTPUT
The Output
In order to test the model and the accuracy of the
program, the program is run 14 times with;
• 30 nodes (vertices) and
• 4 initial (closest – 2 left and 2 right) links for
each node
• For 1 turns at each time (for each value of
p)
• With the parameters p={0.001, 0.009,
0.01, 0.05, 0.09, 0.1, 0.3, 0.7, 0.9}.
Then the results are also viewed in Pajek in order
to calculate the average path length.
The outputs of those simulations are as follows: Av. Path Length = 4.13793
7
Barış EKDi STPS 514 – Assignment IV
8
Barış EKDi STPS 514 – Assignment IV
9
Barış EKDi STPS 514 – Assignment IV
The results of the 14 simulations that run suggest that as the parameter “p” increases; (i) the
average cliquishness –so
so that the clustering - and (ii) the average path length in
i the network
decreases. In addition, parallel to the increase of parameter “p”, the regular network becomes
“small world” at the first instance and then turns into a random one:
10