permute_graph
Shuffles the values of a matrix either considering
loops and multiple links (which are processed as cell values
different than 1/0). rewire_qap
generates a new graph graph
\('\)
that is isomorphic to graph
.
permute_graph(graph, self = FALSE, multiple = FALSE) rewire_permute(graph, self = FALSE, multiple = FALSE) rewire_qap(graph)
graph | Any class of accepted graph format (see |
---|---|
self | Logical scalar. When |
multiple | Logical scalar. When |
A permuted version of graph
.
Anderson, B. S., Butts, C., & Carley, K. (1999). The interaction of size and density with graph-level indices. Social Networks, 21(3), 239–267. http://dx.doi.org/10.1016/S0378-8733(99)00011-8
Mantel, N. (1967). The detection of disease clustering and a generalized regression approach. Cancer Research, 27(2), 209–20. http://cancerres.aacrjournals.org/content/27/2_Part_1/209
This function can be used as null distribution in struct_test
Other simulation functions:
rdiffnet()
,
rewire_graph()
,
rgraph_ba()
,
rgraph_er()
,
rgraph_ws()
,
ring_lattice()
# Simple example ------------------------------------------------------------ set.seed(1231) g <- rgraph_ba(t=9) g#> 10 x 10 sparse Matrix of class "dgCMatrix"#>#> #> 1 1 . . . . . . . . . #> 2 1 . . . . . . . . . #> 3 1 . . . . . . . . . #> 4 . . 1 . . . . . . . #> 5 1 . . . . . . . . . #> 6 1 . . . . . . . . . #> 7 1 . . . . . . . . . #> 8 . . 1 . . . . . . . #> 9 . . . 1 . . . . . . #> 10 . . . . . . . . . 1# These preserve the density permute_graph(g)#> 10 x 10 sparse Matrix of class "dgCMatrix" #> #> [1,] . . . . . . . . . . #> [2,] . . 1 1 1 1 . . . . #> [3,] . . . . 1 . . . 1 . #> [4,] . . . . . . . 1 . . #> [5,] . . . . . . . . . . #> [6,] . . . . . . . . 1 . #> [7,] . . . . . . . . . . #> [8,] . . . . . . . . . 1 #> [9,] . . . . . . . 1 . . #> [10,] . . . . . . . . . .permute_graph(g)#> 10 x 10 sparse Matrix of class "dgCMatrix" #> #> [1,] . . . . . . . . . . #> [2,] . . . . . . . . . . #> [3,] . . . . 1 . . . . . #> [4,] 1 . . . 1 . . . . 1 #> [5,] . 1 . . . . . . . . #> [6,] . . . . . . . . . . #> [7,] . . . . . 1 . 1 . . #> [8,] . . . 1 . 1 . . . 1 #> [9,] . . . . . . . . . . #> [10,] . . . . . . . . . .# These are isomorphic to g rewire_qap(g)#> 10 x 10 sparse Matrix of class "dgCMatrix"#>#> #> 2 . . . . . . . . 1 . #> 9 . . . . . . . 1 . . #> 8 . . . . . . . . . 1 #> 10 . . . 1 . . . . . . #> 6 . . . . . . . . 1 . #> 7 . . . . . . . . 1 . #> 5 . . . . . . . . 1 . #> 4 . . . . . . . . . 1 #> 1 . . . . . . . . 1 . #> 3 . . . . . . . . 1 .rewire_qap(g)#> 10 x 10 sparse Matrix of class "dgCMatrix"#>#> #> 5 . . . . 1 . . . . . #> 7 . . . . 1 . . . . . #> 9 . . . . . 1 . . . . #> 6 . . . . 1 . . . . . #> 1 . . . . 1 . . . . . #> 4 . . . . . . . . 1 . #> 10 . . . . . . 1 . . . #> 8 . . . . . . . . 1 . #> 3 . . . . 1 . . . . . #> 2 . . . . 1 . . . . .