View source: R/wrangle-weights.R
| invert_weights | R Documentation |
Turns strong ties into short distances, which is what path-based measures need when the weights are similarities rather than costs.
invert_weights(
x,
method = c("reciprocal", "max_minus", "reflect"),
keep_format = FALSE,
directed = NULL
)
x |
Network input. |
method |
How to invert:
|
keep_format |
Logical. Return the input format when TRUE. |
directed |
Logical or NULL. If NULL (default), auto-detect. |
A cograph_network with inverted weights, or the input format
when keep_format = TRUE.
normalize_weights, shortest_paths
adj <- matrix(c(0, .5, .8, 0,
.5, 0, .3, .6,
.8, .3, 0, .4,
0, .6, .4, 0), 4, 4, byrow = TRUE)
rownames(adj) <- colnames(adj) <- c("A", "B", "C", "D")
invert_weights(adj)
invert_weights(adj, method = "reflect")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.