Skip to content

@graphty/algorithms / index / connectedComponents

Function: connectedComponents() ​

connectedComponents(graph): NodeId[][]

Defined in: algorithms/components/connected.ts:17

Find connected components in an undirected graph using Union-Find

Parameters ​

graph ​

Graph

The input graph (must be undirected)

Returns ​

NodeId[][]

Array of connected components, each containing an array of node IDs