as.symmetricAdjacencyMatrix: convert to a symmetric adjacency matrix

Description Usage Arguments Details Value Examples


as.symmetricAdjacencyMatrix convert an edgelist or a raw matrix to a symmetric adjacency matrix.


as.symmetricAdjacencyMatrix(Data, weighted = FALSE, rule = "weak")



either a dataframe or a matrix, representing raw interactions using either an edgelist or a matrix. Frequency of interactions for each dyad can be represented either by multiple occurrences of the dyad for a 2-column edgelist, or by a third column specifying the frequency of the interaction for a 3-column edgelist.


If the edgelist is a 3-column edgelist in which weight was specified by frequency, use weighted = TRUE.


a character vector of length 1, being one of "weak", "strong", "upper", or "lower". Ways of symmetrizing the matrix. See details for more information.


There are ways of symmetrizing a matrix. The "weak" rule symmetrize the matrix by building an edge between nodes [i, j] and [j, i] if there is an edge either from i to j OR from j to i. The "strong" rule symmetrize the matrix by building an edge between nodes [i, j] and [j, i] if there is an edge BOTH from i to j AND from j to i. The "upper" and the "lower" rule symmetrize the matrix by using the "upper" or the "lower" triangle respectively.

Note, when using a 3-column edgelist (e.g. a weighted edgelist) to represent raw interactions, each dyad must be unique. If more than one rows are found with the same Initiator and recipient, sum of the frequencies will be taken to represent the freqency of interactions between this unique dyad. A warning message will prompt your attention to the accuracy of your raw data when duplicated dyads were found in a three-column edgelist.


a named matrix with the [i,j]th entry equal to the number of times i grooms j.


symmetricMatrix <- as.symmetricAdjacencyMatrix(monkeyGrooming, weighted = TRUE, rule = "weak")

DCG documentation built on May 2, 2019, 6:12 a.m.