watts.strogatz.game(dim, size, nei, p)
dim
, size
and
nei
arguments. Then the edges of the lattice are rewired
uniformly randomly with probability p
. Note that this function might create graphs with loops and/or multiple
edges. You can use simplify
to get rid of these.
graph.lattice
, rewire.edges
g <- watts.strogatz.game(1, 100, 5, 0.05)
average.path.length(g)
transitivity(g, type="average")
Run the code above in your browser using DataLab