symMat: Symmetrize an adjacency matrix

symMatR Documentation

Symmetrize an adjacency matrix

Description

Function to symmetrize an adjacency matrix in several ways

Usage

symMat(g, rule = "weak", na.rm = TRUE)

Arguments

g

a suqare numeric matrix, need not be binary

rule

the rule used to determine how to symmetrize

  • out outgoing ties (upper triangle of the adjacency matrix) are copied exactly. What is sent is reciprocated. Technically: the upper triangle is copied over the lower triangle.

  • in ingoing ties (lower triangle of the adjacency matrix) are copied exactly. What is received is reciprocated. Technically: the lower triangle is copied over the upper triangle.

  • weak if i -> j AND/OR j -> i, the tie becomes reciprocated

  • mutual only reciprocated ties are maintained

  • average the average value of ij and ji is returned (na.rm is used)

  • max the max value of ij and ji is returned (na.rm is used)

  • min the min value of ij and ji is returned (na.rm is used)

na.rm

how to deal with missings, default is TRUE

Details

Symmetrizes a square matrix. There is a choice of several methods to do this.

Value

the symmetrized matrix

Examples

g = matrix(sample(c(0,1), 25, replace = TRUE), nrow = 5)
symMat(g, "weak")
symMat(g, "mutual")
g = matrix(runif(25), nrow = 5)
diag(g) <- 0
symMat(g, "average")


SNAnalyst/DF21 documentation built on March 21, 2022, 12:02 a.m.