connectedComponents: Find the connected components of a graph represented as a...

View source: R/geometry.R

connectedComponentsR Documentation

Find the connected components of a graph represented as a data frame

Description

This function finds the connected components of a graph represented as a data frame.

Usage

connectedComponents(df, colName = "component")

Arguments

df

A data frame with two categorical columns representing the edges of a graph.

colName

Name of the connected components column to be added.

Value

A data frame with a column indicating the connected component of each edge.

Examples

df <- data.frame(
gene1 = paste0('G', c(1, 2, 6, 7, 8, 9,
11, 25, 32, 17, 18)),
gene2 = paste0('G', c(2, 8, 8, 8, 1, 25,
32, 24, 24, 26, 26))
)
connectedComponents(df)


henna documentation built on Feb. 17, 2026, 9:08 a.m.