View source: R/wrangle-structure.R
| spanning_tree | R Documentation |
Computes a spanning tree with Prim's algorithm on each connected component,
so a disconnected network yields a spanning forest. A directed network is
symmetrized first, each pair taking the larger of its two arc weights.
Self-loops are ignored. Missing or infinite weights raise a
cograph_bad_selection error.
spanning_tree(
x,
weights = c("weight", "none"),
maximum = FALSE,
keep_format = FALSE,
directed = NULL
)
x |
Network input. |
weights |
|
maximum |
Logical. Find the maximum spanning tree instead of the minimum. Default FALSE. Set TRUE when the weights are similarities. |
keep_format |
Logical. If TRUE, a matrix, igraph, statnet network or
tna input is returned in its own format. An edge-list data frame or a
qgraph object is returned as a |
directed |
Logical or NULL. Directedness used to read the input. NULL (default) detects it from the input. The tree itself is undirected. |
An undirected cograph_network holding the spanning tree (or
forest), or the input format when keep_format = TRUE. Every node is
kept.
Prim, R. C. (1957). Shortest connection networks and some generalizations. Bell System Technical Journal, 36(6), 1389–1401.
disparity_filter, threshold_edges
spanning_tree(regulation_net, maximum = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.