Learn R Programming

NetSim (version 0.9)

network_utils: Utility functions for NetSim network objects

Description

Utility functions to quickly change macro features of NetSim network objects. The first function adds random ties to a network, the second function creates a ring lattice structure to a network.

Usage

add_random_ties_to_network(network, probability = 0.5) add_ring_lattice_to_network(network, nReciprocalTies)

Arguments

network
A NetSim network object
probability
Bernoulli probability of a non-existing tie to be set to 1.
nReciprocalTies
The number of reciprocal ties one node has in the ring lattice structure.

See Also

create_network

Examples

Run this code
 nActors <- 5
 network <- create_network(matrix(0, nActors, nActors))
 
 add_random_ties_to_network(network, probability = 0.5)
 add_random_ties_to_network(network, probability = 1)
 
 # reset network to an empty network
 network <- create_network(matrix(0, nActors, nActors))
 add_ring_lattice_to_network(network, nReciprocalTies = 2)
 ## Not run: 
#  add_ring_lattice_to_network(network, nReciprocalTies = 0) # throws an error message
#   ## End(Not run)

Run the code above in your browser using DataLab