8 network: Managing Relational Data in R
network has default print and summary methods, as well as low-level operators for assignment
and related operations. These do not show much in the above case, since the network in
question caries little information. To create a network along with a specified set of edges,
the preferred high-level constructor is the eponymous network. Like network.initialize,
this function returns a newly allocated network object having specified properties. Unlike
the former, however, network may be called with adjacency and/or attribute information.
Adjacency information may be passed by using a full or bipartite adjacency matrix, incidence
matrix, or edgelist as the function’s first argument. These input types are defined as follows:
Adjacency matrix: This must consist of a square matrix or two-dimensional array, whose
i, jth cell contains the value of the edge from i to j; as such, adjacency matrices
may only be used to specify dyadic networks. By default, edges are assumed to ex-
ist for all non-zero matrix values, and are constructed accordingly. Edge values may
be retained by passing ignore.eval = FALSE, as described in the manual page for
the network.adjacency constructor. The matrix.type for an adjacency matrix is
"adjacency".
Bipartite adjacency matrix: This must consist of a rectangular matrix or two-dimensional
array whose row and column elements reflect vertices belonging to the lower and up-
per sets of a bipartition (r espectively). Otherwise, the matrix is interpreted as per a
standard adjacency matrix. (Thus, a bipartite adjacency matrix is simply the upper
off-diagonal block of the full adjacency matrix for a bipartite graph, where vertices
have been ordered by partition membership. See also
Doreian, et al. (2005).) The
matrix.type for a bipartite adjacency matrix is "bipartite".
Incidence matrix: This must consist of a rectangular matrix or two-dimensional array
whose row elements represent vertices, and whose column elements represent edges. A
non-zero value is placed in the i, jth cell if vertex i is an endpoint of edge j. In the
directed case, negative values signify membership in the tail set of the corresponding
edge, while positive values signify membership in the edge’s head set. Unlike adjacency
matrices, incidence matrices can thus be used to describe hypergraphic edges (directed
or otherwise). Note, however, that an undirected hypergraph composed of two-endpoint
edges is not the same as a simple graph, since the edges of the former are necessarily
loop-like. When loops, hyper, and directed are all FALSE, therefore, the two positive
row-elements of an incidence matrix for each column are taken to signify the head and
tail elements of a dyadic edge. (This is without loss of generality, since such an incidence
matrix would otherwise be inadmissible.) When specifying that an incidence matrix is
to be used, matrix.type should be set to "incidence".
Edge list: This must consist of a rectangular matrix or two-dimensional array whose row
elements represent edges. The i, 1st cell of this structure is taken to be the ID of the
tail vertex for the edge with ID i, with the i, 2st cell containing the ID of the edge’s
head vertex. (Only dyadic networks may be input in this fashion.) Additional columns,
if present, are taken to contain edge attribute values. The matrix.type for an edge list
is "edgelist".
As one might suspect, the network function actually operates by first calling
network.initialize to create the required object, and then calling an appropriate edge