View source: R/wrangle-structure.R
| split_components | R Documentation |
Split a Network into Its Connected Components
split_components(x, min_size = 1L, keep_format = FALSE, directed = NULL)
x |
Network input. |
min_size |
Integer. Drop components smaller than this. Default 1 (keep all, including isolated nodes). |
keep_format |
Logical. Return each component in the input format. |
directed |
Logical or NULL. If NULL (default), auto-detect. |
A list of cograph_network objects, one per component, ordered
from largest to smallest and named "component_1",
"component_2", and so on. Components are weakly connected, matching
igraph::components(mode = "weak").
select_component, remove_isolates
adj <- matrix(0, 5, 5, dimnames = list(LETTERS[1:5], LETTERS[1:5]))
adj["A", "B"] <- adj["B", "A"] <- 1
adj["C", "D"] <- adj["D", "C"] <- 1
parts <- split_components(adj)
length(parts)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.