remove_connections_to_node.matrix: Remove connections to a node

Description Usage Arguments Value Examples

View source: R/generics.R

Description

Remove connections to a node

Usage

1
2
## S3 method for class 'matrix'
remove_connections_to_node(x, node, prob_remove, run_checks = TRUE, ...)

Arguments

x

The 'network', 'network_module', or 'matrix' object to modify.

node

The node to unwire.

prob_remove

A value between 0 and 1. Each connection to node will be removed with probability equal to prob_remove.

run_checks

If TRUE and 'x' is a matrix, then it is checked that 'x' is an adjacency matrix. This catches the case where 'x' is a weighted matrix, in which case the weights are removed and a warning is given.

...

Additional arguments.

Value

The modified adjacency matrix.

Examples

1
2
3
4
5
6
7
8
9
# Create a random network with 10 nodes. 
nw <- random_network(10)
# Remove all connections to node 1.
nw_rewired <- remove_connections_to_node(nw, 1, 1)
# Plot the two networks for comparison
g <- plot(nw)
plot(nw_rewired, g) # Pass in g to mirror the layout.
# Or plot the differential network.
plot_network_diff(nw, nw_rewired)

SeqNet documentation built on July 9, 2021, 9:08 a.m.