perturb_network {SeqNet} | R Documentation |
Perturbs the connections in a network
Description
The network is perturbed by removing connections from hubs and/or rewiring
other nodes in the network. By default, one hub is turned off (i.e. its
connections are removed each with probability rewire_hub_prob = 0.5
), and
no other nodes are changed. Hub nodes are defined as those having degree
above three standard deviations from the average degree, and nodes are
sampled from these to be turned off; if there are no hub nodes, then
those with the largest degree are turned off.
Usage
perturb_network(
network,
n_hubs = 1,
n_nodes = 0,
rewire_hub_prob = 0.5,
rewire_other_prob = 0.5,
...
)
Arguments
network |
The network to modify. |
n_hubs |
The number of hub nodes to turn off. |
n_nodes |
The number of non-hub nodes to rewire. When rewiring, the degree of the node is unchanged. |
rewire_hub_prob |
The probability that a connection is removed from
a hub that is selected to be turned off. If |
rewire_other_prob |
The probability that a connection is rewired from
a non-hub that is selected for rewiring. If |
... |
Additional arguments passed to
|
Value
The modified network.
Examples
# Create a random network, perturb the network, then plot the differential network.
set.seed(12345)
nw <- random_network(100)
# Rewire 2 random hub genes and 10 other random genes:
nw_diff <- perturb_network(nw, n_hubs = 2, n_nodes = 10)
plot_network_diff(nw, nw_diff)