forked from dagrejs/dagre
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.d.ts
More file actions
105 lines (91 loc) · 3 KB
/
Copy pathindex.d.ts
File metadata and controls
105 lines (91 loc) · 3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
import { Graph as ImportedGraph, Node as GraphNode, Edge as GraphEdge } from '@dagrejs/graphlib';
// --- Graphlib Exports (Public API of dagre.graphlib) ---
export namespace graphlib {
export { ImportedGraph as Graph };
export namespace json {
function read(graph: any): Graph;
function write(graph: Graph): any;
}
export namespace alg {
function components(graph: Graph): string[][];
function dijkstra(graph: Graph, source: string, weightFn?: WeightFn, edgeFn?: EdgeFn): any;
function dijkstraAll(graph: Graph, weightFn?: WeightFn, edgeFn?: EdgeFn): any;
function findCycles(graph: Graph): string[][];
function floydWarshall(graph: Graph, weightFn?: WeightFn, edgeFn?: EdgeFn): any;
function isAcyclic(graph: Graph): boolean;
function postorder(graph: Graph, nodeNames: string | string[]): string[];
function preorder(graph: Graph, nodeNames: string | string[]): string[];
function prim<T>(graph: Graph<T>, weightFn?: WeightFn): Graph<T>;
function tarjam(graph: Graph): string[][];
function topsort(graph: Graph): string[];
}
}
export interface Label {
label?: string;
width?: number;
height?: number;
minRank?: number;
maxRank?: number;
borderLeft?: string[];
borderRight?: string[];
[key: string]: any;
}
export type WeightFn = (edge: Edge) => number;
export type EdgeFn = (outNodeName: string) => GraphEdge[];
export interface GraphLabel {
width?: number | undefined;
height?: number | undefined;
compound?: boolean | undefined;
rankdir?: string | undefined;
align?: string | undefined;
nodesep?: number | undefined;
edgesep?: number | undefined;
ranksep?: number | undefined;
marginx?: number | undefined;
marginy?: number | undefined;
acyclicer?: string | undefined;
ranker?: string | undefined;
rankalign?: 'top' | 'center' | 'bottom' | undefined;
}
export interface NodeConfig {
width?: number | undefined;
height?: number | undefined;
}
export interface EdgeConfig {
minlen?: number | undefined;
weight?: number | undefined;
width?: number | undefined;
height?: number | undefined;
labelpos?: 'l' | 'c' | 'r' | undefined;
labeloffest?: number | undefined;
}
export interface LayoutConfig {
customOrder?: (graph: graphlib.Graph, order: (graph: graphlib.Graph, opts: configUnion) => void) => void;
disableOptimalOrderHeuristic?: boolean;
}
type configUnion = GraphLabel & NodeConfig & EdgeConfig & LayoutConfig;
export function layout(graph: graphlib.Graph, layout?: configUnion): void;
export interface Edge {
v: string;
w: string;
name?: string | undefined;
}
export interface GraphEdge {
points: Array<{ x: number; y: number }>;
[key: string]: any;
}
export type Node<T = {}> = T & {
x: number;
y: number;
width: number;
height: number;
class?: string | undefined;
label?: string | undefined;
padding?: number | undefined;
paddingX?: number | undefined;
paddingY?: number | undefined;
rank?: number | undefined;
rx?: number | undefined;
ry?: number | undefined;
shape?: string | undefined;
};