Search code examples
rgraph-theoryigraphstatistics-bootstrapnetwork-analysis

Rewire in igraph for R meaning of niter parameter


For a network g (as below), what is the practical meaning of the niter parameter in the igraph::rewire function

library(igraph)
library(dplyr)

g <- sample_smallworld(1, 10, 3, 0.05)

For example if I would run:

g1 <- g %>%
     rewire(keeping_degseq(niter = 20))

g2 <- g %>%
     rewire(keeping_degseq(niter = 100))

I do see differences between the two networks on a network property level (e.g. betweenness centrality), but I'm not sure which value is the most appropriate if I want to do bootstrapping on my network for example. The reason why I don't know which value to choose comes as well as I don't really understand what does the niter parameter do.


Solution

  • This function will randomly switch edges like this:

    enter image description here                enter image description here

    The switch is performed only if it wouldn't result in multi-edges.

    niter specifies the number of trials. Some of the trials will not be successful.

    Thus @CPak's statement in the comment that niter edges will be swapped is not correct. Actually, niter attempts will be made.

    This is explained in the documentation:

    http://igraph.org/r/doc/keeping_degseq.html
    http://igraph.org/c/doc/igraph-Generators.html#igraph_rewire