permute_graph: Permute the values of a matrix

View source: R/rewire.r

permute_graphR Documentation

Permute the values of a matrix

Description

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.

Usage

permute_graph(graph, self = FALSE, multiple = FALSE)

rewire_permute(graph, self = FALSE, multiple = FALSE)

rewire_qap(graph)

Arguments

graph

Any class of accepted graph format (see netdiffuseR-graphs).

self

Logical scalar. When TRUE autolinks (loops, self edges) are allowed (see details).

multiple

Logical scalar. When TRUE allows multiple edges.

Value

A permuted version of graph.

Author(s)

George G. Vega Yon

References

Anderson, B. S., Butts, C., & Carley, K. (1999). The interaction of size and density with graph-level indices. Social Networks, 21(3), 239–267. \Sexpr[results=rd]{tools:::Rd_expr_doi("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.

See Also

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()

Examples

# Simple example ------------------------------------------------------------
set.seed(1231)
g <- rgraph_ba(t=9)
g

# These preserve the density
permute_graph(g)
permute_graph(g)

# These are isomorphic to g
rewire_qap(g)
rewire_qap(g)


srdyal/diffusiontest documentation built on Oct. 2, 2024, 5:18 a.m.