The function defines a network object either from a nodeset or from a matrix (sociomatrix or adjacency matrix). If a matrix is used as input, defineNetwork() returns a network filled with the same values as the ones present in the provided network. If the nodeset is the only argument, defineNetwork() returns an empty network with the number of columns and rows corresponding to the size of the nodeset. These networks are static, but they can be turned into dynamic networks by linking dynamic events to the network objectw using linkEvents().

defineNetwork(
  matrix = NULL,
  nodes,
  nodes2 = NULL,
  directed = TRUE,
  envir = environment()
)

Arguments

matrix

An initial matrix (optional), and object of class matrix.

nodes

A node-set (see defineNodes()).

nodes2

A second optional node-set for the definition of two-mode networks.

directed

A logical value indicating whether the network is directed.

envir

An environment object where the nodes-set objects are defined. The default value is environment().

Value

an object with additional class network.goldfish with attributes:

nodes

a character vector with the names of the nodes set objects used during the definition. nodes and nodes2 arguments.

directed

Logical value indicating whether the network is directed. directed argument

events

An empty character vector. linkEvents() is used to link event data frames.

The object can be modified using methods for matrix.

Details

If a matrix is used as input, its dimension names must be a subset of the nodes in the nodeset as defined with the defineNodes() and the order of the labels in rows and columns must correspond to the order of node labels in the nodeset. The matrix can be directed or undirected (as specified with the directed argument).

If the network is updated over time (e.g., a new wave of friendship data is collected), these changes can be added with the linkEvents() - similar to link changing attribute events to a nodeset. This time, the user needs to provide the network and the associated nodeset. If no matrix is provided, goldfish only considers the nodeset and assumes the initial state to be empty (i.e., a matrix containing only 0s).

Examples

# If no intial matrix is provided
data("Social_Evolution")
callNetwork <- defineNetwork(nodes = actors)

# If a initial matrix is provided
data("Fisheries_Treaties_6070")
bilatnet <- defineNetwork(bilatnet, nodes = states, directed = FALSE)