keeping_degseq | R Documentation |
This function can be used together with rewire()
to
randomly rewire the edges while preserving the original graph's degree
distribution.
keeping_degseq(loops = FALSE, niter = 100)
loops |
Whether to allow destroying and creating loop edges. |
niter |
Number of rewiring trials to perform. |
The rewiring algorithm chooses two arbitrary edges in each step ((a,b) and (c,d)) and substitutes them with (a,d) and (c,b), if they not already exists in the graph. The algorithm does not create multiple edges.
Tamas Nepusz ntamas@gmail.com and Gabor Csardi csardi.gabor@gmail.com
sample_degseq()
Other rewiring functions:
each_edge()
,
rewire()
g <- make_ring(10)
g %>%
rewire(keeping_degseq(niter = 20)) %>%
degree()
print_all(rewire(g, with = keeping_degseq(niter = vcount(g) * 10)))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.