Utility functions for NetSim network objects

Share:

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

1
2
	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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
 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)