select_component: Select Connected Component

View source: R/network-utils.R

select_componentR Documentation

Select Connected Component

Description

Select nodes belonging to a specific connected component.

Usage

select_component(
  x,
  which = "largest",
  ...,
  keep_edges = c("internal", "none"),
  keep_format = FALSE,
  directed = NULL
)

Arguments

x

Network input.

which

Component selection:

"largest"

(default) The largest connected component

Integer

Component by ID

Character

Component containing the named node

...

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.

Value

A cograph_network with nodes in the selected component.

See Also

select_nodes, select_neighbors

Examples

select_component(regulation_net, which = "largest")

cograph documentation built on Nov. 19, 2026, 5:07 p.m.