update_module_with_random_weights: Generate small-world network structure for module
Description
The small-world network is generated using the Watts-Strogatz method.
See watts.strogatz.game
for details.
Usage
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
Run this code# NOT RUN {
# 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)
# }
Run the code above in your browser using DataLab