| edge_centrality | R Documentation |
Computes centrality measures for edges in a network and returns a tidy data frame. Unlike node centrality, these measures describe edge importance.
edge_centrality(
x,
measures = "all",
weighted = TRUE,
directed = NULL,
cutoff = -1,
invert_weights = NULL,
alpha = 1,
digits = NULL,
sort_by = NULL,
...
)
edge_betweenness(x, ...)
x |
Network input (matrix, igraph, network, cograph_network, tna object) |
measures |
Which measures to calculate. Default "all" calculates all available edge measures. Options: "betweenness", "weight", "overlap", "simmelian", "reciprocity". |
weighted |
Logical. Use edge weights if available. Default TRUE. |
directed |
Logical or NULL. If NULL (default), auto-detect from matrix symmetry. Set TRUE to force directed, FALSE to force undirected. |
cutoff |
Maximum path length for betweenness. Default -1 (no limit). |
invert_weights |
Logical or NULL. Invert weights for path-based measures? Default NULL (auto-detect: TRUE for tna objects, FALSE otherwise). |
alpha |
Numeric. Exponent for weight inversion. Default 1. |
digits |
Integer or NULL. Round numeric columns. Default NULL. |
sort_by |
Character or NULL. Column to sort by (descending). Default NULL. |
... |
Additional arguments passed to |
Edge measures available:
Number of shortest paths passing through the edge.
Original edge weight.
Jaccard neighborhood overlap of edge endpoints.
Number of triangles the edge participates in.
Whether the reverse edge exists (directed only).
Adds columns: reciprocated, reverse_weight,
weight_ratio.
A data frame with columns from, to, and one column
per requested measure.
Named numeric vector of edge betweenness values (named by
"from->to").
# Create test network
mat <- matrix(c(0,1,1,0, 1,0,1,1, 1,1,0,0, 0,1,0,0), 4, 4)
rownames(mat) <- colnames(mat) <- c("A", "B", "C", "D")
# All edge measures
edge_centrality(mat)
# Just betweenness
edge_centrality(mat, measures = "betweenness")
# Sort by betweenness to find bridge edges
edge_centrality(mat, sort_by = "betweenness")
mat <- matrix(c(0,1,1,0, 1,0,1,1, 1,1,0,0, 0,1,0,0), 4, 4)
rownames(mat) <- colnames(mat) <- c("A", "B", "C", "D")
edge_betweenness(mat)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.