UNPKG

d3-dag

Version:

Layout algorithms for visualizing directed acylic graphs.

21 lines (20 loc) 1.09 kB
import type { GraphNode } from "../graph"; import type { NodeLength } from "../layout"; /** * A separation function that indicates how far apart nodes should be the layering / height assignment. * * * @remarks upper and lower are historic, since arbitrary graphs are handled, * there is no longer a notion of upper or lower and separation should return * the correct separation independent of nodes relations in the graph. */ export type Separation<in NodeDatum = never, in LinkDatum = never> = (first: GraphNode<NodeDatum, LinkDatum> | undefined, second: GraphNode<NodeDatum, LinkDatum> | undefined) => number; /** * A separation derived from a length and a gap * * This is the separation function if each node has size `len` and between two * nodes there's an extra `gap`. */ export declare function sizedSeparation<NodeDatum, LinkDatum>(len: NodeLength<NodeDatum, LinkDatum>, gap: number): Separation<NodeDatum, LinkDatum>; /** compute the number of crossings in a layered sugi node */ export declare function crossings(layers: readonly (readonly GraphNode[])[]): number;