View source: R/wrangle-structure.R
| contract_nodes | R Documentation |
Replaces each group of nodes with a single node whose edges aggregate the
edges of its members. The operation corresponds to igraph::contract()
and tidygraph's to_contracted(), and it is the network form of the
aggregation computed by summarize_clusters().
contract_nodes(
x,
groups,
weight = c("sum", "mean", "max", "min"),
loops = FALSE,
keep_format = FALSE,
directed = NULL
)
x |
Network input. |
groups |
Group assignment. Either a vector with one entry per node, in
node order, or a named list mapping each group name to node labels. A list
must assign every node. Malformed input raises a
|
weight |
How to aggregate the weights of the edges that fall between
two groups. One of |
loops |
Logical. Keep the within-group edges as self-loops on the contracted node. Default FALSE. |
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. |
A cograph_network with one node per group, labeled by group
name, or the input format when keep_format = TRUE. The groups
follow the factor levels of a vector (sorted for a character vector) or
the order of a list.
summarize_clusters, detect_communities,
split_components
contract_nodes(regulation_net, groups = rep(c("Plan", "Act"), each = 5))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.