import { I as VisualGraph, f as Graph } from "../types-BAEQTwK_.mjs"; import { LayoutOptions } from "./index.mjs"; //#region src/layout/d3-hierarchy.d.ts interface TidyTreeLayoutOptions extends LayoutOptions { /** * Node to use as the tree root. Defaults to `graph.initialNodeId`, falling * back to the graph's zero-in-degree nodes (multiple → laid out as a * forest). */ rootId?: string; } /** * Lay out a graph as a tidy tree (Reingold–Tilford) with `d3-hierarchy` * (an optional peer dependency). Pure and synchronous: returns a new * {@link VisualGraph} with node positions/sizes. * * Root selection: `options.rootId` → `graph.initialNodeId` → the graph's * zero-in-degree nodes. Multiple zero-in-degree nodes are laid out as a * forest (side by side under an invisible synthetic root that is dropped * from the output). If no root can be found (every node has incoming edges, * i.e. the graph is cyclic), this throws — pass `rootId` to break the tie. * * Graphs that aren't strict trees are handled via a *spanning tree*: BFS * from the root over effective edge direction picks each node's tree parent * (first edge to reach it); only that spanning tree drives positions. All * edges — including the extra cross/forward/back edges — are preserved * untouched in the output. Tidy tree does not route edges (no `points`). * * @example * ```ts * import { getTidyTreeLayout } from '@statelyai/graph/layout/d3-hierarchy'; * * const laidOut = getTidyTreeLayout(graph, { direction: 'right' }); * ``` */ declare function getTidyTreeLayout(graph: Graph | VisualGraph, options?: TidyTreeLayoutOptions): VisualGraph; //#endregion export { TidyTreeLayoutOptions, getTidyTreeLayout };