
rewire.edges(graph, prob, loops=FALSE, multiple=FALSE)
# Some random shortcuts shorten the distances on a lattice
g <- graph.lattice( length=100, dim=1, nei=5 )
average.path.length(g)
g <- rewire.edges( g, prob=0.05 )
average.path.length(g)
Run the code above in your browser using DataLab