rewireR: Rewire graph by randomly assigning new values for a given...

Description Usage Arguments Examples

View source: R/rewireR.R

Description

Randomly rewires graphs by altering a specific number of edges using Bernoulli trials as described in "The weighted random graph model" by Garlaschelli, New Journal of Physics, 11, (2009), 073005. Only undirected, weigghted count matrices are considered here.

Usage

1
rewireR(sym.matrix, nperturb, dist)

Arguments

sym.matrix

A symmetric, sparse count matrix object.

nperturb

The number of edges to randomly alter.

dist

Option to rewire in a manner that retains overall graph weight regardless of distribution of edge weights. This option is invoked by putting any text into this field. Defaults to "NegBinom" for negative binomial.

Examples

1
rewireR(exampledata, nperturb=40, dist = "Normal")

Example output

   X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 X16 X17 X18 X19 X20 X21
1   0  0  0  0  0  0  0  0  0   0   0   0   0   0   0   0   0   0   0   0   0
2   0  0  0  0  0  0  0  0  0   0   0   0   0   0   0   0   0   0   0   0   0
3   0  0  0  0  0  0  0  0  2   0   0   0   0   0   0   0   0   0   0   0   0
4   0  0  0  0  0  0  0  0  0   0   0   0   0   2   0   0   2   0   0   0   0
5   0  0  0  0  0  0  0  0  0   0   0   0   0   0   0   0   0   0   0   0   0
6   0  0  0  0  0  0  0  0  0   0   0   0   0   0   0   0   0   0   0   0   2
7   0  0  0  0  0  0  0  2  0   0   0   0   0   0   0   0   0   0   0   0   0
8   0  0  0  0  0  0  2  0  0   0   0   0   0   0   0   0   0   0   0   0   0
9   0  0  2  0  0  0  0  0  0   0   0   0   0   0   0   0   0   0   0   0   0
10  0  0  0  0  0  0  0  0  0   0   0   0   0   0   0   0   0   0   0   0   0
11  0  0  0  0  0  0  0  0  0   0   0   0   2   0   0   0   0   0   0   0   0
12  0  0  0  0  0  0  0  0  0   0   0   0   0   0   0   0   0   2   0   0   0
13  0  0  0  0  0  0  0  0  0   0   2   0   0   0   0   0   0   0   0   0   0
14  0  0  0  2  0  0  0  0  0   0   0   0   0   0   0   0   0   0   0   0   0
15  0  0  0  0  0  0  0  0  0   0   0   0   0   0   0   0   0   0   0   0   0
16  0  0  0  0  0  0  0  0  0   0   0   0   0   0   0   0   0   0   0   2   0
17  0  0  0  2  0  0  0  0  0   0   0   0   0   0   0   0   0   0   0   0   0
18  0  0  0  0  0  0  0  0  0   0   0   2   0   0   0   0   0   0   0   0   0
19  0  0  0  0  0  0  0  0  0   0   0   0   0   0   0   0   0   0   0   0   0
20  0  0  0  0  0  0  0  0  0   0   0   0   0   0   0   2   0   0   0   0   0
21  0  0  0  0  0  2  0  0  0   0   0   0   0   0   0   0   0   0   0   0   0
22  0  0  0  0  0  0  0  0  0   0   0   0   0   0   0   0   0   0   0   0   0
23  0  0  0  0  2  0  0  2  0   0   0   0   0   0   0   0   0   0   0   0   0
24  0  1  0  0  0  0  0  0  0   2   0   0   0   0   2   0   0   0   0   0   0
25  0  0  0  0  0  0  2  0  0   0   0   0   0   0   0   0   2   0   2   0   0
   X22 X23 X24 X25
1    0   0   0   0
2    0   0   1   0
3    0   0   0   0
4    0   0   0   0
5    0   2   0   0
6    0   0   0   0
7    0   0   0   2
8    0   2   0   0
9    0   0   0   0
10   0   0   2   0
11   0   0   0   0
12   0   0   0   0
13   0   0   0   0
14   0   0   0   0
15   0   0   2   0
16   0   0   0   0
17   0   0   0   2
18   0   0   0   0
19   0   0   0   2
20   0   0   0   0
21   0   0   0   0
22   0   0   0   2
23   0   0   0   0
24   0   0   0   0
25   2   0   0   0

perturbR documentation built on May 2, 2019, 3:25 p.m.