d3-dag
Version:
Layout algorithms for visualizing directed acylic graphs.
23 lines (22 loc) • 1.42 kB
TypeScript
import { GraphNode } from "../../graph";
import { SugiNode, SugiSeparation } from "../sugify";
/** solve for node positions */
export declare function solve(Q: number[][], c: number[], A: number[][], b: number[], meq?: number): number[];
/** compute indices used to index arrays */
export declare function indices<N, L>(layers: SugiNode<N, L>[][]): Map<SugiNode<N, L>, number>;
/** Compute constraint arrays for layer separation */
export declare function init<N, L>(layers: SugiNode<N, L>[][], inds: Map<SugiNode, number>, sep: SugiSeparation<N, L>, compress?: number): [number[][], number[], number[][], number[]];
/** update Q that minimizes edge distance squared */
export declare function minDist(Q: number[][], pind: number, cind: number, coef: number): void;
/**
* update Q that minimizes curve of edges through a node where curve is
* calculates as the squared distance of the middle node from the midpoint of
* the first and last, multiplied by four for some reason
*/
export declare function minBend(Q: number[][], pind: number, nind: number, cind: number, pcoef: number, ccoef: number): void;
/**
* Assign nodes x based off of solution, and return the width of the final
* layout.
*/
export declare function layout<N, L>(layers: SugiNode<N, L>[][], sep: SugiSeparation<N, L>, inds: Map<SugiNode, number>, solution: number[]): number;
export declare function avgHeight(nodes: Iterable<GraphNode>): number;