UNPKG

@loken/hierarchies

Version:

Library for working with hierarchies of identifiers and identifiable objects.

27 lines 963 B
import { type Some, type Predicate } from '@loken/utilities'; import type { NextNodes, TraversalType } from './graph.types.ts'; /** * Search a graph of nodes by traversing the provided `roots` according to the options. * * The search will stop when the first node matching the `search` predicate is found. */ export declare const searchGraph: <TNode>(options: { roots: Some<TNode>; next: NextNodes<TNode>; search: Predicate<TNode>; type?: TraversalType; detectCycles?: boolean; }) => TNode | undefined; /** * Search a graph of nodes by traversing the provided `roots` according to the options. * * The search is exhaustive and will return all nodes matching the `search` predicate. */ export declare const searchGraphMany: <TNode>(options: { roots: Some<TNode>; next: NextNodes<TNode>; search: Predicate<TNode>; type?: TraversalType; detectCycles?: boolean; }) => TNode[]; //# sourceMappingURL=graph-search.d.ts.map