Longitudinal Data StructureNetworks evolve as a result of the joining and leaving of nodes, and the creating, reinforcing, weakening, and severing of ties. For example, one network that is currently receiving a great deal of attention in the literature is the network of commercial airports (the nodes) that are tied together by scheduled flights. This network grows when new airports open and shrinks when old ones close down. Ties are created when new routes are started and reinforced if the capacity of an existing route is increased. Weakening of a tie occurs when airlines cut capacity, which ultimately results in the severing of the tie if all airlines terminate flights on the route. Yet, the evolution of networks is typically not recorded. This implies that the dependency structure among ties is unknown.
Longitudinal networks should be represented by a four-column edgelist to be analysed in tnet. The columns correspond to (1) the timing using a character string the following format surrounded by quotes: “YYYY-MM-DD HH:MM:SS”, (2) the sender or originator of the tie, (3) the receiver or target node of the tie, and (4) the tie weight. Note that the tie weight-column is not the cumulative tie weight, but the change in tie weight. As such, a negative value signal a weakening of the tie.
Node joining and leaving data is directly incorporated in the edgelist by the inclusion of a self-loop (i.e., a tie from a node to itself). The tie weight of the self-loops differentiates node joining (weight=1) and leaving (weight=-1). If the data do not contain node joining information, the as.tnet-function will include nodes right before the creation of the tie. See the code below.
The network in the animated diagram above should be represented as follows in R (note that the first column is a character string, while the others are integer or numeric).
[,1] [,2] [,3] [,4] [1,] 2007-09-12 13:45:00 1 1 1 [2,] 2007-09-12 13:45:00 2 2 1 [3,] 2007-09-12 13:45:00 1 2 1 [4,] 2007-09-12 13:46:31 1 2 1 [5,] 2007-09-12 13:47:54 1 2 1 [6,] 2007-09-12 13:48:21 1 2 1 [7,] 2007-09-12 13:49:27 1 2 1 [8,] 2007-09-12 13:51:14 1 2 -1 [9,] 2007-09-12 13:52:17 3 3 1 [10,] 2007-09-12 13:52:17 1 3 1 [11,] 2007-09-12 13:56:59 1 3 1
Loading Your Network
The most common way of loading a network is to read a text file with the network. The
read.table-function is the standard method for reading text files. This function works by giving it a filename or link, and a character for separating the values into columns (e.g., a tab). It is important to not just read, but also assign the read file to an object. To illustrate this procedure, the above network can be loaded into the object
net using these commands (note that this file is on the web, and hence, the link instead of a filename).
# Read the network net <- read.table("http://opsahl.co.uk/tnet/datasets/longitudinal-network.txt", sep="\t")
Ensure that the network conforms to the tnet standard
To ensure that the network conforms to the tnet standard, the
as.tnet-function can be used. This function is run automatically by the functions if it has not been run on the network manually. This function takes two parameters: the network and a character string specifying the type of network. If the type parameter is not set, an object will be assumed to be a longitudinal edgelist if it has four columns. Below is the code for testing the network above.
# Load tnet library(tnet) # Read the network net <- read.table("http://opsahl.co.uk/tnet/datasets/longitudinal-network.txt", sep="\t") # Check that it confirms to the tnet standard for weighted one-mode networks net <- as.tnet(net, type="longitudinal tnet")