interface SeparateComponentsResults { setIdsByNode: Map; setIdsByGroup: number[]; } /** * Separate components of an undirected graph into disjoint sets. * * @param groups is a set of group of vertices connected together. It is * acceptable for a group to contain only one node. Empty groups * receive special treatment (see below). * * Note that if you have a raw undirected graph, you can build * such a structure by creating a group for every vertex containing * the vertex itself and its immediate neighbours. The helper function {@link createGroups} * can be used for this. * * @returns This function returns a pair containing: * * - A mapping from every vertex to its set identifier. The set identifiers are * opaque and will not necessarily be compact. However, it is guaranteed that * they will not be greater than the number of groups. * - A mapping from every group to its set identifier, with the identifiers being * the same ones as the ones in the previous mapping. Each group corresponds to * the identifier at the same index, except for empty group whose identifier is * set to `-1`. */ export declare function separateComponents(groups: Node[][]): SeparateComponentsResults; /** * Separate components of an undirected graph into disjoint sets. * * @param groups is a set of group of vertices connected together. It is * acceptable for a group to contain only one node. * @returns This function returns a list of sets of nodes forming disjoint connected * sets. */ export declare function components(groups: Node[][]): Set[]; /** * Extract connected components from a graph. * * @param starts is a collection of vertices to be considered as start points. * @param neighbors is a function returning the neighbors of a given node. * @returns A list of groups, each as a list of nodes. This value can be given as the * `groups` parameter of the {@link separateComponents()} or {@link components()} functions. */ export declare function createGroups(starts: Node[], neighbors: (node: Node) => Iterable): Node[][]; /** * Locate vertices amongst disjoint sets. * * @param components - A list of disjoint sets. * @returns This function returns a map between every vertex and the index of * the set it belongs to in the `components` list. */ export declare function componentIndex(components: Set[]): Map; export {};