Skip to content

@graphty/algorithms / index / connectedComponentsDFS

Function: connectedComponentsDFS() ​

connectedComponentsDFS(graph): NodeId[][]

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

Find connected components using DFS (alternative implementation)

Parameters ​

graph ​

Graph

The input graph (must be undirected)

Returns ​

NodeId[][]

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