View source: R/network-utils.R
| select_component | R Documentation |
Select nodes belonging to a specific connected component.
select_component(
x,
which = "largest",
...,
.keep_edges = c("internal", "none"),
keep_format = FALSE,
directed = NULL
)
x |
Network input. |
which |
Component selection:
|
... |
Additional filter expressions to apply after component selection. |
.keep_edges |
How to handle edges. Default "internal". |
keep_format |
Logical. Keep input format? Default FALSE. |
directed |
Logical or NULL. Auto-detect if NULL. |
A cograph_network with nodes in the selected component.
select_nodes, select_neighbors
# Create disconnected network
adj <- matrix(0, 6, 6)
adj[1, 2] <- adj[2, 1] <- 1
adj[1, 3] <- adj[3, 1] <- 1
adj[4, 5] <- adj[5, 4] <- 1
adj[5, 6] <- adj[6, 5] <- 1
adj[4, 6] <- adj[6, 4] <- 1
rownames(adj) <- colnames(adj) <- LETTERS[1:6]
# Largest component
select_component(adj, which = "largest")
# Component containing node "A"
select_component(adj, which = "A")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.