View source: R/network-utils.R
| select_top_edges | R Documentation |
Select the top N edges ranked by weight or another metric.
select_top_edges(
x,
n,
by = "weight",
...,
.keep_isolates = FALSE,
keep_format = FALSE,
directed = NULL
)
x |
Network input. |
n |
Integer. Number of top edges to select. |
by |
Character. Metric for ranking. One of:
|
... |
Additional filter expressions. |
.keep_isolates |
Keep nodes with no edges? Default FALSE. |
keep_format |
Keep input format? Default FALSE. |
directed |
Auto-detect if NULL. |
A cograph_network with the top N edges.
select_edges, select_top
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")
# Top 3 edges by weight
select_top_edges(adj, n = 3)
# Top 2 by edge betweenness
select_top_edges(adj, n = 2, by = "edge_betweenness")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.