View source: R/wrangle-weights.R
| symmetrize | R Documentation |
Combines each pair of opposite arcs into one undirected edge. The result is an undirected network, so measures that branch on directedness see the change.
symmetrize(
x,
method = c("max", "min", "mean", "sum", "mutual", "upper", "lower"),
keep_format = FALSE,
directed = NULL
)
x |
Network input. |
method |
How to combine
|
keep_format |
Logical. Return the input format when TRUE. |
directed |
Logical or NULL. Directedness to read the input with; the result is always undirected. |
"max", "min", "mean" and "sum" combine two
values only where both arcs exist; an unreciprocated edge keeps its own
weight rather than being compared against the zero that stands for the
missing arc. That distinction matters for signed networks, where comparing
a negative weight against a structural zero would delete the edge. Use
"mutual" when an edge should survive only if it was reciprocated.
An undirected cograph_network, or the input format when
keep_format = TRUE. The weight matrix satisfies
isSymmetric(). Zero is how this representation stores "no edge", so
any pair whose combined weight is exactly zero disappears: every
unreciprocated arc under method = "mutual", and a cancelling pair
under "sum". A cograph_edges_dropped warning says how many.
Butts, C. T. (2008). Social network analysis with sna. Journal of Statistical Software, 24(6), 1–51.
to_undirected, normalize_weights
adj <- matrix(c(0, .5, 0,
.2, 0, .7,
0, .1, 0), 3, 3, byrow = TRUE)
rownames(adj) <- colnames(adj) <- c("A", "B", "C")
symmetrize(adj, method = "max")
symmetrize(adj, method = "mean")
symmetrize(adj, method = "mutual")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.