update_module_with_random_weights: Generate small-world network structure for module

Description Usage Arguments Value Examples

View source: R/modules.R

Description

The small-world network is generated using the Watts-Strogatz method. See watts.strogatz.game for details.

Usage

1
2
3
4
5
update_module_with_random_weights(
  module,
  rdist = function(n) {     runif(n, 0.5, 1) * (-1)^rbinom(n, 1, 0.5) },
  ...
)

Arguments

module

The network_module object to modify.

rdist

A distribution function that generates random numbers. The first argument should specify the number of weights to generate. By default, weights are generated uniformly from the set (-1, -0.5)U(0.5, 1).

...

Additional parameters are ignored.

Value

An updated 'network_module' object.

Examples

1
2
3
4
5
6
# Create a random module. 
module <- random_module(1:10)
is_weighted(module)
# Add a random weight to each connection.
module <- update_module_with_random_weights(module)
is_weighted(module)

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