Learn R Programming

netdiffuseR (version 1.16.2)

rewire_graph: Rewires a graph

Description

By changing the endpoints of the edges, this is the workhorse of the function rgraph_ws.

Usage

rewire_graph(graph, p, both.ends = FALSE, self = FALSE, multiple = FALSE,
  undirected = getOption("diffnet.undirected"))

Arguments

graph
Any class of accepted graph format (see netdiffuseR-graphs)
p
Numeric scalar. Set the probability of changing an edge.
both.ends
Logical scalar. When TRUE rewires both ends.
self
Logical scalar. When TRUE, allows loops (self edges).
multiple
Logical scalar. When TRUE allows multiple edges.
undirected
Logical scalar. TRUE when the graph is undirected.

Details

Rewiring assumes a weighted network, hence $G(i,j) = k = G(i',j')$, where $i',j'$ are the new end points of the edge and $k$ may not be equal to one.

See Also

Other simulation functions: rdiffnet, rgraph_ba, rgraph_er, rgraph_ws