Skip to contents

A graph does not have to look random to behave randomly: rewiring a percent or two of a regular lattice leaves the clustering intact while the average path length falls to near its random-graph value.

Usage

Watstro(n, k, p, seed = 1)

Arguments

n

Nodes.

k

Even; nearest neighbours each node starts joined to.

p

Rewiring probability.

seed

Seed for the shared generator.

Value

List with A, estimate, n_rewired, n_edges, n.

Details

Determinism: edges visited in a fixed order, rewiring draws from the shared Lehmer minstd stream, so a seed gives the same graph in both arms.

Formula: ring where each node joins its k nearest neighbours, then rewire each edge with probability p, refusing self-loops and duplicates.

References

Watts, D. J. & Strogatz, S. H. (1998). Nature 393:440-442.

Examples

Watstro(n = 5L, k = 5L, p = 0.5)
#> $A
#>      [,1] [,2] [,3] [,4] [,5]
#> [1,]    0    1    1    1    1
#> [2,]    1    0    1    1    1
#> [3,]    1    1    0    1    1
#> [4,]    1    1    1    0    1
#> [5,]    1    1    1    1    0
#> 
#> $estimate
#> [1] 4
#> 
#> $n_rewired
#> [1] 0
#> 
#> $n_edges
#> [1] 10
#> 
#> $n
#> [1] 5
#> 
#> $method
#> [1] "Watts-Strogatz small-world graph"
#> 
#> attr(,"class")
#> [1] "morie_rich_result" "list"