/** * A {@link LayeringTopological} that assigns each node a unique layer. * * @packageDocumentation */ import type { Rank } from "../../graph"; import { type U } from "../../utils"; import type { Layering } from "."; /** topological operators */ export interface LayeringTopologicalOps { /** rank operator */ rank: Rank; } /** the node datum of a set of operators */ type OpsNodeDatum = Ops extends LayeringTopologicalOps ? N : never; /** the link datum of a set of operators */ type OpsLinkDatum = Ops extends LayeringTopologicalOps ? L : never; /** * a layering that assigns every node a distinct layer * * This combined with topological coordinate assignment can be thought of as an * alternative to {@link zherebko}. The latter generally produces more pleasing * layouts, but both are options. This layering is very fast, but it may make * other steps take longer due to the many created dummy nodes. * * Create with {@link layeringTopological}. */ export interface LayeringTopological extends Layering, OpsLinkDatum> { /** * set the {@link Rank} * * Nodes will first be in rank order, and then in topological order * attempting to minimize edge inversions. */ rank(newRank: NewRank): LayeringTopological>; /** * get the current {@link Rank}. */ rank(): Ops["rank"]; /** @internal flag indicating that this is built in to d3dag and shouldn't error in specific instances */ readonly d3dagBuiltin: true; } /** default topological operator */ export type DefaultLayeringTopological = LayeringTopological<{ /** unconstrained rank */ rank: Rank; }>; /** * create a default {@link LayeringTopological} * * This is a layering that assigns every node to a distinct layer. * * @example * * ```ts * const layout = sugiyama().layering(layeringTopological()); * ``` */ export declare function layeringTopological(...args: never[]): DefaultLayeringTopological; export {};