dagre-d3-es
Version:
<p align="center"> <a href="https://tbo47.github.io/" ><img src="https://img.shields.io/badge/created_by-tbo47-blue.svg" alt="Created by tbo47"></a> <a href="https://www.npmjs.com/dagre-d3-es"><img src="https://img.shields.io/npm/v/dagre-d3-es.svg?log
27 lines (26 loc) • 843 B
TypeScript
/**
* Finds all [connected components][] in a graph and returns an array of these
* components. Each component is itself an array that contains the ids of nodes
* in the component.
*
* [connected components]: http://en.wikipedia.org/wiki/Connected_component_(graph_theory)
*
* @example
*
* 
*
* ```js
* graphlib.alg.components(g);
* // => [ [ 'A', 'B', 'C', 'D' ],
* // [ 'E', 'F', 'G' ],
* // [ 'H', 'I' ] ]
* ```
*
* @param {Graph} g - The graph to find components in.
* @returns {NodeID[][]} An array of components, each of which is an array of node IDs.
*
* @remarks This function takes `O(|V|)` time.
*/
export function components(g: Graph): NodeID[][];
import type { Graph } from '../graph.js';
import type { NodeID } from '../graph.js';