Skip to content

Implementation of Watts and Strogatz's algorithm for network rewiring

Notifications You must be signed in to change notification settings

andrewrch/strogatz

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

strogatz

Implementation of Watts and Strogatz's algorithm for network rewiring

Three binaries are built by typing "make".

strogatz:

strogatz takes three arguments, the graph size (N), the number of edges per node in the original graph (K), and the probability of swapping (p).

The binary then prints out the graph in dot format to stderr, so running

./strogatz 100 4 0.1 2> graph.dot

Will produce a graph with 100 nodes, and 4 connections for each node in the initial graph and then rewire them with probability.

A small bash one-liner is put inside create_svg, so running

./create_svg 100 4 0.1 graph.svg

will create a similar graph, and put it in the vector file graph.svg.

The strogatz binary also prints a few statistics about the graph and the shape of the degree distribution histogram to stdout.

print_histogram

Takes 3 arguments, N, K, and p, and prints graph statistics to stderr, and values to build a degree histogram to stdout.

A gnuplot script to build a histogram is provided in the graph directory:

graphs/histograms/histogram.plot

print_L_C_curve

Takes 4 arguments, N, K, iterations (I), and decrease factor (F).

This creates graphs of size N, with K starting nodes. For all probabilities from 1.0 to 0, it creates I graphs, calculates the normalised clustering coefficient (C) and normalised average path length (L), averages the result (By dividing by I), and prints L, C, and p to stdout. Each iteration, the probability is divided by F.

This can then be plotted on a logscale using the gnuplot script in:

graphs/path_against_clustering/path.plot

About

Implementation of Watts and Strogatz's algorithm for network rewiring

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published