|
This function randomly resuffles a weighted edgelist. It takes four options: - edgelist: the weighted edgelist that is being reshuffled
- option:
- weights (default): randomly assigns the weights to the edges
- degree: maintain the degree distribution, but changes the contacts randomly
- directed: logical, is the network directed or undirected. Default is NULL, which means that the function determines whether the edgelist is directed
- seed: if you want to make a reproducable random network (i.e. for publication), you need to set this equal to an integer.
Example: Sample data ## Load tnet library(tnet) ## Define sample data sampledata<-rbind( c(1,2,4), c(1,3,2), c(2,1,4), c(2,3,4), c(2,4,1), c(2,5,2), c(3,1,2), c(3,2,4), c(4,2,1), c(5,2,2), c(5,6,1), c(6,5,1));
## Run programme
rg_reshuffling_w(sampledata, option=weights, directed=FALSE) i j w [1,] 1 2 1 [2,] 1 3 2 [3,] 2 1 1 [4,] 2 3 2 [5,] 2 4 1 [6,] 2 5 4 [7,] 3 1 2 [8,] 3 2 2 [9,] 4 2 1 [10,] 5 2 4 [11,] 5 6 4 [12,] 6 5 4 rg_reshuffling_w(sampledata, method=weights, directed=FALSE)
i j w [1,] 1 2 2 [2,] 1 3 1 [3,] 2 1 2 [4,] 2 3 2 [5,] 2 4 4 [6,] 2 5 4 [7,] 3 1 1 [8,] 3 2 2 [9,] 4 2 4 [10,] 5 2 4 [11,] 5 6 1 [12,] 6 5 1 As you can see, the edges stay the same; however, the weights are reshuffled among them.
|