import type { SankeyLayoutLink, SankeyLayoutModel, SankeyLayoutNode } from '../types/sankey-internal.js'; /** * Id lookups for a single layout. `linksBySource` maps `sourceId` → `targetId` * → the links between that pair. That array holds a single link in the normal * case; it holds more only for parallel links (multiple links between the same * node pair), which are rare. Resolving one of those by its `linkIndex` with a * short `find` reads more simply than a third nested map and, given the array * is almost always length one, is effectively just as fast. */ export interface SankeyLayoutIndex { nodesById: Map; linksBySource: Map>; } /** * Seeds the cache with an index that `generateSankeyLayout` collected during * d3-sankey's own single pass over the graph, so the resolvers stay `O(1)` * without `buildIndex` ever re-scanning the nodes and links. */ export declare function primeLayoutIndex(layout: SankeyLayoutModel, index: SankeyLayoutIndex): void; /** * Resolves a node by id against the current layout in `O(1)`, or `undefined` * when the id is absent (e.g. after a data change dropped it). */ export declare function resolveLayoutNode(layout: SankeyLayoutModel, nodeId: string): SankeyLayoutNode | undefined; /** * Resolves a link by its source/target ids and per-layout link index against * the current layout, together with both resolved endpoint nodes. Returns * `undefined` when the link is absent or either endpoint is unresolved. The * `linkIndex` discriminant picks the right link when parallel links share the * same source and target ids; with the usual single link per pair it simply * matches that one. */ export declare function resolveLayoutLink(layout: SankeyLayoutModel, sourceId: string, targetId: string, linkIndex: number): { link: SankeyLayoutLink; source: SankeyLayoutNode; target: SankeyLayoutNode; } | undefined; //# sourceMappingURL=layout-index.d.ts.map