@kortexya/nodus 0.1.4 → 0.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/hypergraphWorker-D-ulsXRM.js +1 -0
- package/assets/layoutWorker-C9xWGcvY.js +285 -0
- package/assets/nodus_wasm-DxYJZXfN.js +1 -0
- package/nodus.src.bundle.js +4350 -6225
- package/nodus_render_wasm-C4PGMrSp.js +2617 -0
- package/nodus_wasm-PO2Iq59v.js +2883 -0
- package/package.json +1 -1
- package/types/algorithms/force/SEC.d.ts +8 -8
- package/types/geometry/index.d.ts +3 -1
- package/types/hypergraph/Hypergraph.d.ts +9 -1
- package/types/hypergraph/index.d.ts +1 -4
- package/types/hypergraph/layout/Optimizer.d.ts +33 -1
- package/types/hypergraph/render/BubbleSets.d.ts +6 -0
- package/types/hypergraph/render/Interaction.d.ts +7 -0
- package/types/hypergraph/render/PolygonRenderer.d.ts +12 -0
- package/types/hypergraph/types.d.ts +25 -5
- package/types/internals/Hypergraph.d.ts +5 -0
- package/types/internals/Tooltip.d.ts +9 -1
- package/types/internals/TooltipPrimitives.d.ts +2 -0
- package/types/internals/algorithmExports.d.ts +4 -2
- package/types/internals/algorithmHelpers.d.ts +1 -11
- package/types/internals/helpers.d.ts +0 -1
- package/types/internals/labels/helpers.d.ts +6 -2
- package/types/internals/rendering/float16.d.ts +2 -1
- package/types/internals/rendering/packing.d.ts +5 -5
- package/types/modules/ToolsAPI.d.ts +1 -0
- package/types/tools/TooltipAPI.d.ts +13 -0
- package/assets/hypergraphWorker-DV0aFI3L.js +0 -1
- package/assets/layoutWorker-DwDJwbgr.js +0 -285
- package/assets/nodus_wasm-C0vDfO5K.js +0 -1
- package/nodus_render_wasm-Bs6hlsx-.js +0 -2617
- package/nodus_wasm-DKYQVSUZ.js +0 -2789
- package/types/algorithms/hierarchical/sugiyama.d.ts +0 -144
- package/types/hypergraph/layout/Adam.d.ts +0 -12
- package/types/hypergraph/layout/Energy.d.ts +0 -55
- package/types/hypergraph/layout/LBFGS.d.ts +0 -32
|
@@ -1,144 +0,0 @@
|
|
|
1
|
-
export declare const SENTINEL: -1;
|
|
2
|
-
export declare const SENTINEL_DATA: {
|
|
3
|
-
id: string;
|
|
4
|
-
layer: number;
|
|
5
|
-
sink: boolean;
|
|
6
|
-
fixed: boolean;
|
|
7
|
-
siblingIndex: number;
|
|
8
|
-
parentIds: any[];
|
|
9
|
-
children: any[];
|
|
10
|
-
radius: number;
|
|
11
|
-
ref: any;
|
|
12
|
-
};
|
|
13
|
-
export interface SugNode {
|
|
14
|
-
id: any;
|
|
15
|
-
layer: number;
|
|
16
|
-
data: any;
|
|
17
|
-
children: SugNode[];
|
|
18
|
-
ref?: any;
|
|
19
|
-
x: number;
|
|
20
|
-
y: number;
|
|
21
|
-
}
|
|
22
|
-
export declare function makeVirtualNode(id: any, layer: number): SugNode;
|
|
23
|
-
export declare function isVirtual(n: SugNode): boolean;
|
|
24
|
-
export declare function isReal(n: SugNode): boolean;
|
|
25
|
-
declare class LNode {
|
|
26
|
-
data: any;
|
|
27
|
-
prev: LNode | null;
|
|
28
|
-
next: LNode | null;
|
|
29
|
-
constructor(data: any, prev?: LNode | null, next?: LNode | null);
|
|
30
|
-
toString(): any;
|
|
31
|
-
}
|
|
32
|
-
declare class NodeLinkedList {
|
|
33
|
-
head: LNode | null;
|
|
34
|
-
tail: LNode | null;
|
|
35
|
-
byId: {
|
|
36
|
-
[id: string]: LNode;
|
|
37
|
-
};
|
|
38
|
-
byIndex: {
|
|
39
|
-
[idx: number]: LNode;
|
|
40
|
-
};
|
|
41
|
-
length: number;
|
|
42
|
-
append(data: any, id: string | number): LNode;
|
|
43
|
-
forEach(cb: (node: LNode, idx: number) => void): void;
|
|
44
|
-
}
|
|
45
|
-
export declare function insertVirtualNodes(graph: {
|
|
46
|
-
nodes: SugNode[];
|
|
47
|
-
}): SugNode[][];
|
|
48
|
-
export declare function decrossLayers(layers: SugNode[][], shouldDecross: boolean, sortSiblings: boolean): void;
|
|
49
|
-
export declare class SugiyamaLayout {
|
|
50
|
-
edges: {
|
|
51
|
-
source: any;
|
|
52
|
-
target: any;
|
|
53
|
-
virtual: boolean;
|
|
54
|
-
id: number;
|
|
55
|
-
}[];
|
|
56
|
-
nodeMap: {
|
|
57
|
-
[id: string]: SugNode;
|
|
58
|
-
};
|
|
59
|
-
nodeIndexTopDown: {
|
|
60
|
-
[id: string]: number;
|
|
61
|
-
};
|
|
62
|
-
nodeToLayer: {
|
|
63
|
-
[id: string]: number;
|
|
64
|
-
};
|
|
65
|
-
longEdges: {
|
|
66
|
-
[id: string]: string[];
|
|
67
|
-
};
|
|
68
|
-
virt: {
|
|
69
|
-
[id: string]: boolean;
|
|
70
|
-
};
|
|
71
|
-
height: {
|
|
72
|
-
[layer: number]: number;
|
|
73
|
-
};
|
|
74
|
-
breadth: {
|
|
75
|
-
[id: string]: number;
|
|
76
|
-
};
|
|
77
|
-
first: SugNode[];
|
|
78
|
-
totalW: {
|
|
79
|
-
[id: string]: number;
|
|
80
|
-
};
|
|
81
|
-
mDist: {
|
|
82
|
-
[id: string]: number;
|
|
83
|
-
};
|
|
84
|
-
X: {
|
|
85
|
-
[id: string]: number;
|
|
86
|
-
};
|
|
87
|
-
block: {
|
|
88
|
-
[id: string]: any;
|
|
89
|
-
};
|
|
90
|
-
nodeList: NodeLinkedList;
|
|
91
|
-
nodeDistance: number;
|
|
92
|
-
layerDistance: number;
|
|
93
|
-
layers: SugNode[][];
|
|
94
|
-
N: number;
|
|
95
|
-
Y: Float32Array;
|
|
96
|
-
adjacencyList: {
|
|
97
|
-
[src: string]: any[];
|
|
98
|
-
};
|
|
99
|
-
neighbours: {
|
|
100
|
-
prev: {
|
|
101
|
-
[id: string]: any[];
|
|
102
|
-
};
|
|
103
|
-
next: {
|
|
104
|
-
[id: string]: any[];
|
|
105
|
-
};
|
|
106
|
-
};
|
|
107
|
-
constructor(layers: SugNode[][], nodeDistance: number, layerDistance: number);
|
|
108
|
-
computeMinNodeDistances(): void;
|
|
109
|
-
decrossVirtualEdges(): void;
|
|
110
|
-
placeLongEdges(): void;
|
|
111
|
-
sortLongEdges(e: string, t: number, s: {
|
|
112
|
-
[id: string]: number;
|
|
113
|
-
}, o: {
|
|
114
|
-
done: boolean;
|
|
115
|
-
dist: number;
|
|
116
|
-
}, c: {
|
|
117
|
-
[id: string]: number;
|
|
118
|
-
}, p: {
|
|
119
|
-
[id: string]: number;
|
|
120
|
-
}): boolean;
|
|
121
|
-
placeNonVirtualNodes(): void;
|
|
122
|
-
placeSequence(e: any, t: any, s: any, o: any, c: number, p?: number): void;
|
|
123
|
-
calculateBends(e: number, t: number, s: any, o: any, c: any, p: any, At: any, Tt: any): {
|
|
124
|
-
res: number;
|
|
125
|
-
bends: {
|
|
126
|
-
value: number;
|
|
127
|
-
key: number;
|
|
128
|
-
}[];
|
|
129
|
-
};
|
|
130
|
-
combineSequences(e: any, t: any, s: any, o: any, c: any, p: any, At: any, Tt: number): void;
|
|
131
|
-
placeNode(e: any, t: any, s: any, o: number, c: number): number;
|
|
132
|
-
moveLongEdge(e: SugNode, t: number, s: {
|
|
133
|
-
[id: string]: boolean;
|
|
134
|
-
}): void;
|
|
135
|
-
moveLongEdges(): void;
|
|
136
|
-
computeY(): void;
|
|
137
|
-
straightenLongEdge(e: SugNode, t: {
|
|
138
|
-
[id: string]: boolean;
|
|
139
|
-
}): void;
|
|
140
|
-
straightenEdges(): void;
|
|
141
|
-
run(): void;
|
|
142
|
-
}
|
|
143
|
-
export declare function sugiyamaCoordinates(layers: SugNode[][], nodeDistance?: number, layerDistance?: number): SugNode[][];
|
|
144
|
-
export {};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Adam optimizer fallback. Selectable when L-BFGS line search fails on
|
|
3
|
-
* a pathological dataset.
|
|
4
|
-
*/
|
|
5
|
-
import type { LBFGSOptions, ObjectiveFn, LBFGSResult } from './LBFGS';
|
|
6
|
-
export interface AdamOptions extends Pick<LBFGSOptions, 'maxIter' | 'tol' | 'mask' | 'onIter'> {
|
|
7
|
-
lr?: number;
|
|
8
|
-
beta1?: number;
|
|
9
|
-
beta2?: number;
|
|
10
|
-
eps?: number;
|
|
11
|
-
}
|
|
12
|
-
export declare function minimizeAdam(f: ObjectiveFn, x0: Float64Array, opts?: AdamOptions): LBFGSResult;
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Energy terms for the polygon-layout objective (paper §5.3, building
|
|
3
|
-
* on Qu et al. [41]). Five terms:
|
|
4
|
-
*
|
|
5
|
-
* 1. Polygon regularity E_reg
|
|
6
|
-
* 2. Polygon area E_area
|
|
7
|
-
* 3. Polygon separation E_sep
|
|
8
|
-
* 4. Regularity intersection (convexity recovery) E_int
|
|
9
|
-
* 5. Primal-dual coordination E_pd
|
|
10
|
-
*
|
|
11
|
-
* State vectors:
|
|
12
|
-
* x : Float64Array of length 2|V| (primal vertex positions)
|
|
13
|
-
* y : Float64Array of length 2|E| (dual vertex positions = primal hyperedge centroids)
|
|
14
|
-
*/
|
|
15
|
-
import type { LayoutWeights } from '../types';
|
|
16
|
-
export interface LayoutModel {
|
|
17
|
-
/** vertex id → flat index 0..|V|-1 */
|
|
18
|
-
vIndex: Map<string | number, number>;
|
|
19
|
-
/** hyperedge id → flat index 0..|E|-1 */
|
|
20
|
-
eIndex: Map<string | number, number>;
|
|
21
|
-
vCount: number;
|
|
22
|
-
eCount: number;
|
|
23
|
-
/** Per-hyperedge: list of vertex flat-indices (sorted CCW around centroid). */
|
|
24
|
-
hyperedgeVerts: number[][];
|
|
25
|
-
/** Per-hyperedge: cardinality (equal to hyperedgeVerts[i].length, cached). */
|
|
26
|
-
cardinality: number[];
|
|
27
|
-
/** Per-hyperedge: cardinality used for E_area / E_sep in the regularity
|
|
28
|
-
* phase. Paper §5.3: "we use the corresponding cardinalities saved
|
|
29
|
-
* from the original scale H_0" — for hyperedges that have absorbed
|
|
30
|
-
* others via merger, this is the sum of merged H_0 cardinalities;
|
|
31
|
-
* for hyperedges intact since H_0, this equals the H_0 cardinality. */
|
|
32
|
-
originalCardinality: number[];
|
|
33
|
-
/** Per-hyperedge: target polygon area A*(k). Computed from
|
|
34
|
-
* originalCardinality, not the current k. */
|
|
35
|
-
targetArea: number[];
|
|
36
|
-
/** Per-vertex: list of hyperedge flat-indices that contain it. */
|
|
37
|
-
vertexInHyperedges: number[][];
|
|
38
|
-
/** Buffer distance d_b for separation energy. */
|
|
39
|
-
bufferDistance: number;
|
|
40
|
-
/** Which phase the energy evaluator should use for the separation
|
|
41
|
-
* d_0 formula. 'separation' uses Eq. 3 (½ sum of current diameters
|
|
42
|
-
* + d_b); 'regularity' uses the circumradius of the regular polygon
|
|
43
|
-
* with originalCardinality and targetArea. */
|
|
44
|
-
phase: 'separation' | 'regularity';
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* Compute total energy and its gradient w.r.t. (x, y).
|
|
48
|
-
*
|
|
49
|
-
* Returns { energy, grad } where grad is a flat Float64Array of length
|
|
50
|
-
* 2*(|V| + |E|): first 2|V| entries are ∂E/∂x, next 2|E| are ∂E/∂y.
|
|
51
|
-
*/
|
|
52
|
-
export declare function evaluateEnergy(model: LayoutModel, state: Float64Array, weights: LayoutWeights): {
|
|
53
|
-
energy: number;
|
|
54
|
-
grad: Float64Array;
|
|
55
|
-
};
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Limited-memory BFGS solver. m=8 by default. Backtracking Armijo line
|
|
3
|
-
* search (sufficient for our convex-ish energy basin once separation is
|
|
4
|
-
* resolved). No external dependencies.
|
|
5
|
-
*
|
|
6
|
-
* Used by the hypergraph layout optimizer; the paper specifically cites
|
|
7
|
-
* primal-dual quasi-Newton methods because the energy Hessian is ill-
|
|
8
|
-
* conditioned (regularity term curvature ≫ coordination term curvature).
|
|
9
|
-
*/
|
|
10
|
-
export interface LBFGSOptions {
|
|
11
|
-
m?: number;
|
|
12
|
-
maxIter?: number;
|
|
13
|
-
tol?: number;
|
|
14
|
-
c1?: number;
|
|
15
|
-
alphaInit?: number;
|
|
16
|
-
alphaShrink?: number;
|
|
17
|
-
maxLineSearch?: number;
|
|
18
|
-
/** Optional mask: if mask[i] is false, gradient and step are zeroed for index i. */
|
|
19
|
-
mask?: Uint8Array;
|
|
20
|
-
onIter?: (iter: number, f: number, gnorm: number) => void;
|
|
21
|
-
}
|
|
22
|
-
export type ObjectiveFn = (x: Float64Array) => {
|
|
23
|
-
energy: number;
|
|
24
|
-
grad: Float64Array;
|
|
25
|
-
};
|
|
26
|
-
export interface LBFGSResult {
|
|
27
|
-
x: Float64Array;
|
|
28
|
-
energy: number;
|
|
29
|
-
iterations: number;
|
|
30
|
-
converged: boolean;
|
|
31
|
-
}
|
|
32
|
-
export declare function minimizeLBFGS(f: ObjectiveFn, x0: Float64Array, opts?: LBFGSOptions): LBFGSResult;
|