View source: R/wrangle-structure.R
| reorder_nodes | R Documentation |
Changes the order the nodes are stored in, which is the order plotting functions lay them out in. The network itself is unchanged.
reorder_nodes(x, order, keep_format = FALSE, directed = NULL)
x |
Network input. |
order |
Node labels or indices, in the wanted order, or one of
|
keep_format |
Logical. Return the input format when TRUE. |
directed |
Logical or NULL. If NULL (default), auto-detect. |
A cograph_network with the nodes in the requested order and
edge indices remapped, or the input format when keep_format = TRUE.
rename_nodes, select_nodes
adj <- matrix(c(0, 1, 1, 1,
1, 0, 1, 0,
1, 1, 0, 0,
1, 0, 0, 0), 4, 4, byrow = TRUE)
rownames(adj) <- colnames(adj) <- c("A", "B", "C", "D")
get_labels(reorder_nodes(adj, order = "degree"))
get_labels(reorder_nodes(adj, order = c("D", "C", "B", "A")))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.