random_module_structure: Create a random network structure for a module

Description Usage Arguments Value Examples

View source: R/modules.R

Description

A single, connected graph is created. The graph is initialized as a ring lattice, and edges are randomly rewired and/or removed. The procedure is similar to the Watts-Strogatz method, but the sampling of edges to modify can be based on the degree of each node.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
random_module_structure(
  size,
  prob_rewire = 1,
  prob_remove = 0.5,
  weights = NULL,
  neig_size = 3,
  alpha = 100,
  beta = 1,
  epsilon = 10^-5,
  ...
)

Arguments

size

The number of nodes to include in the graph.

prob_rewire

The probability of rewiring an edge.

prob_remove

The probability of removing an edge.

weights

(Optional) Weights used for sampling nodes. See rewire_connections_to_node and remove_connections_to_node for details.

neig_size

The neighborhood size within which the nodes of the ring lattice are connected. The initial degree of each node is 2 * neig_size, so long as size >= (1 + 2 * neig_size).

alpha

A positive value used to parameterize the Beta distribution.

beta

A positive value used to parameterize the Beta distribution.

epsilon

A small constant added to the sampling probability of each node.

...

Additional arguments are ignored.

Value

An adjacency matrix representing the network structure.

Examples

1
2
3
4
5
# Create a random module structure (an adjacency matrix) for 10 nodes.
adj_mat <- random_module_structure(10)
# A network object can be created using this structure.
module <- create_module_from_adjacency_matrix(adj_mat)
nw <- create_network_from_modules(10, module)

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