@ac-kit/math-graph 0.0.0-stage → 0.1.0
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/CHANGELOG.md +91 -0
- package/LICENSE +28 -0
- package/README.md +92 -2
- package/dist/index.d.ts +12 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +11 -0
- package/dist/index.js.map +1 -0
- package/dist/layout/_force-forces.d.ts +103 -0
- package/dist/layout/_force-forces.d.ts.map +1 -0
- package/dist/layout/_force-forces.js +490 -0
- package/dist/layout/_force-forces.js.map +1 -0
- package/dist/layout/_hierarchy-table.d.ts +34 -0
- package/dist/layout/_hierarchy-table.d.ts.map +1 -0
- package/dist/layout/_hierarchy-table.js +131 -0
- package/dist/layout/_hierarchy-table.js.map +1 -0
- package/dist/layout/_index-graph.d.ts +32 -0
- package/dist/layout/_index-graph.d.ts.map +1 -0
- package/dist/layout/_index-graph.js +51 -0
- package/dist/layout/_index-graph.js.map +1 -0
- package/dist/layout/_layer-order.d.ts +96 -0
- package/dist/layout/_layer-order.d.ts.map +1 -0
- package/dist/layout/_layer-order.js +462 -0
- package/dist/layout/_layer-order.js.map +1 -0
- package/dist/layout/_layered-acyclic.d.ts +28 -0
- package/dist/layout/_layered-acyclic.d.ts.map +1 -0
- package/dist/layout/_layered-acyclic.js +179 -0
- package/dist/layout/_layered-acyclic.js.map +1 -0
- package/dist/layout/_layered-position.d.ts +56 -0
- package/dist/layout/_layered-position.d.ts.map +1 -0
- package/dist/layout/_layered-position.js +369 -0
- package/dist/layout/_layered-position.js.map +1 -0
- package/dist/layout/_layered-rank.d.ts +54 -0
- package/dist/layout/_layered-rank.d.ts.map +1 -0
- package/dist/layout/_layered-rank.js +436 -0
- package/dist/layout/_layered-rank.js.map +1 -0
- package/dist/layout/_tree-common.d.ts +38 -0
- package/dist/layout/_tree-common.d.ts.map +1 -0
- package/dist/layout/_tree-common.js +73 -0
- package/dist/layout/_tree-common.js.map +1 -0
- package/dist/layout/_treemap-tiling.d.ts +62 -0
- package/dist/layout/_treemap-tiling.d.ts.map +1 -0
- package/dist/layout/_treemap-tiling.js +187 -0
- package/dist/layout/_treemap-tiling.js.map +1 -0
- package/dist/layout/circular-layout.d.ts +27 -0
- package/dist/layout/circular-layout.d.ts.map +1 -0
- package/dist/layout/circular-layout.js +35 -0
- package/dist/layout/circular-layout.js.map +1 -0
- package/dist/layout/create-force-step.d.ts +112 -0
- package/dist/layout/create-force-step.d.ts.map +1 -0
- package/dist/layout/create-force-step.js +134 -0
- package/dist/layout/create-force-step.js.map +1 -0
- package/dist/layout/dendrogram-layout.d.ts +32 -0
- package/dist/layout/dendrogram-layout.d.ts.map +1 -0
- package/dist/layout/dendrogram-layout.js +110 -0
- package/dist/layout/dendrogram-layout.js.map +1 -0
- package/dist/layout/force-directed-layout.d.ts +42 -0
- package/dist/layout/force-directed-layout.d.ts.map +1 -0
- package/dist/layout/force-directed-layout.js +112 -0
- package/dist/layout/force-directed-layout.js.map +1 -0
- package/dist/layout/layered-layout.d.ts +96 -0
- package/dist/layout/layered-layout.d.ts.map +1 -0
- package/dist/layout/layered-layout.js +120 -0
- package/dist/layout/layered-layout.js.map +1 -0
- package/dist/layout/partition-layout.d.ts +31 -0
- package/dist/layout/partition-layout.d.ts.map +1 -0
- package/dist/layout/partition-layout.js +78 -0
- package/dist/layout/partition-layout.js.map +1 -0
- package/dist/layout/phyllotaxis-layout.d.ts +17 -0
- package/dist/layout/phyllotaxis-layout.d.ts.map +1 -0
- package/dist/layout/phyllotaxis-layout.js +32 -0
- package/dist/layout/phyllotaxis-layout.js.map +1 -0
- package/dist/layout/sankey-layout.d.ts +104 -0
- package/dist/layout/sankey-layout.d.ts.map +1 -0
- package/dist/layout/sankey-layout.js +636 -0
- package/dist/layout/sankey-layout.js.map +1 -0
- package/dist/layout/tidy-tree-layout.d.ts +25 -0
- package/dist/layout/tidy-tree-layout.d.ts.map +1 -0
- package/dist/layout/tidy-tree-layout.js +197 -0
- package/dist/layout/tidy-tree-layout.js.map +1 -0
- package/dist/layout/treemap-layout.d.ts +54 -0
- package/dist/layout/treemap-layout.d.ts.map +1 -0
- package/dist/layout/treemap-layout.js +121 -0
- package/dist/layout/treemap-layout.js.map +1 -0
- package/dist/layout/types.d.ts +90 -0
- package/dist/layout/types.d.ts.map +1 -0
- package/dist/layout/types.js +2 -0
- package/dist/layout/types.js.map +1 -0
- package/package.json +66 -3
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"partition-layout.js","sourceRoot":"","sources":["../../src/layout/partition-layout.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAEjD,OAAO,EAAE,yBAAyB,EAAE,MAAM,uBAAuB,CAAC;AAClE,OAAO,EAAsB,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAmBpE;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,UAAU,eAAe,CAC9B,IAAW,EACX,MAAoC,EACpC,OAAO,GAA2B,EAAE;IAEpC,MAAM,EAAE,KAAK,GAAG,CAAC,EAAE,MAAM,GAAG,CAAC,EAAE,OAAO,GAAG,CAAC,EAAE,KAAK,GAAG,KAAK,EAAE,GAAG,OAAO,CAAC;IACtE,iBAAiB,CAAC,KAAK,EAAE,wBAAwB,CAAC,CAAC;IACnD,iBAAiB,CAAC,MAAM,EAAE,yBAAyB,CAAC,CAAC;IACrD,iBAAiB,CAAC,OAAO,EAAE,0BAA0B,CAAC,CAAC;IAEvD,MAAM,KAAK,GAAG,yBAAyB,CACtC,IAAI,EACJ,MAAM,EACN,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,EAChD,iBAAiB,CACjB,CAAC;IACF,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,KAAK,CAAC;IACxC,MAAM,K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EAAE,KAAK,EAAE,CAAC;AAC5B,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export type PhyllotaxisLayoutOptions = {
|
|
2
|
+
/** Radius scale: node i sits at `spacing · √(0.5 + i)`. Default 10, ≥ 0. */
|
|
3
|
+
readonly spacing?: number;
|
|
4
|
+
};
|
|
5
|
+
/**
|
|
6
|
+
* Sunflower-seed placement (Vogel, "A better way to construct the sunflower
|
|
7
|
+
* head", Mathematical Biosciences 1979): node i at radius `spacing · √(0.5 +
|
|
8
|
+
* i)` and angle `i` golden angles, so nodes fill a disc about the origin with
|
|
9
|
+
* near-uniform density and never coincide. x, y per node.
|
|
10
|
+
*
|
|
11
|
+
* Complexity: O(n) time and memory.
|
|
12
|
+
*
|
|
13
|
+
* @throws {RangeError} `count` not a non-negative safe integer, or a negative
|
|
14
|
+
* or non-finite spacing.
|
|
15
|
+
*/
|
|
16
|
+
export declare function phyllotaxisLayout(count: number, options?: PhyllotaxisLayoutOptions): Float64Array;
|
|
17
|
+
//# sourceMappingURL=phyllotaxis-layout.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"phyllotaxis-layout.d.ts","sourceRoot":"","sources":["../../src/layout/phyllotaxis-layout.ts"],"names":[],"mappings":"AAKA,MAAM,MAAM,wBAAwB,GAAG;IACtC,4EAA4E;IAC5E,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;CAC1B,CAAC;AAEF;;;;;;;;;;GAUG;AACH,wBAAgB,iBAAiB,CAChC,KAAK,EAAE,MAAM,EACb,OAAO,GAAE,wBAA6B,GACpC,YAAY,CAgBd"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { assertInteger, assertNonNegative } from "@ac-kit/core";
|
|
2
|
+
import { polarCoordsCreate, vec2FromPolar } from "@ac-kit/math-geometry";
|
|
3
|
+
import { vec2Create } from "@ac-kit/math-linear";
|
|
4
|
+
import { GOLDEN_ANGLE } from "@ac-kit/math-scalar";
|
|
5
|
+
/**
|
|
6
|
+
* Sunflower-seed placement (Vogel, "A better way to construct the sunflower
|
|
7
|
+
* head", Mathematical Biosciences 1979): node i at radius `spacing · √(0.5 +
|
|
8
|
+
* i)` and angle `i` golden angles, so nodes fill a disc about the origin with
|
|
9
|
+
* near-uniform density and never coincide. x, y per node.
|
|
10
|
+
*
|
|
11
|
+
* Complexity: O(n) time and memory.
|
|
12
|
+
*
|
|
13
|
+
* @throws {RangeError} `count` not a non-negative safe integer, or a negative
|
|
14
|
+
* or non-finite spacing.
|
|
15
|
+
*/
|
|
16
|
+
export function phyllotaxisLayout(count, options = {}) {
|
|
17
|
+
const { spacing = 10 } = options;
|
|
18
|
+
assertInteger(count, "phyllotaxisLayout: count", 0);
|
|
19
|
+
assertNonNegative(spacing, "phyllotaxisLayout: spacing");
|
|
20
|
+
const positions = new Float64Array(count * 2);
|
|
21
|
+
const polar = polarCoordsCreate();
|
|
22
|
+
const point = vec2Create();
|
|
23
|
+
for (let index = 0; index < count; index++) {
|
|
24
|
+
polar[0] = spacing * Math.sqrt(0.5 + index);
|
|
25
|
+
polar[1] = index * GOLDEN_ANGLE;
|
|
26
|
+
vec2FromPolar(point, polar);
|
|
27
|
+
positions[index * 2] = point[0];
|
|
28
|
+
positions[index * 2 + 1] = point[1];
|
|
29
|
+
}
|
|
30
|
+
return positions;
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=phyllotaxis-layout.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"phyllotaxis-layout.js","sourceRoot":"","sources":["../../src/layout/phyllotaxis-layout.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAChE,OAAO,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACzE,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAOnD;;;;;;;;;;GAUG;AACH,MAAM,UAAU,iBAAiB,CAChC,KAAa,EACb,OAAO,GAA6B,EAAE;IAEtC,MAAM,EAAE,OAAO,GAAG,EAAE,EAAE,GAAG,OAAO,CAAC;IACjC,aAAa,CAAC,KAAK,EAAE,0BAA0B,EAAE,CAAC,CAAC,CAAC;IACpD,iBAAiB,CAAC,OAAO,EAAE,4BAA4B,CAAC,CAAC;IAEzD,MAAM,SAAS,GAAG,IAAI,YAAY,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC;IAC9C,MAAM,KAAK,GAAG,iBAAiB,EAAE,CAAC;IAClC,MAAM,KAAK,GAAG,UAAU,EAAE,CAAC;IAC3B,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,KAAK,EAAE,KAAK,EAAE,EAAE,CAAC;QAC5C,KAAK,CAAC,CAAC,CAAC,GAAG,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,GAAG,KAAK,CAAC,CAAC;QAC5C,KAAK,CAAC,CAAC,CAAC,GAAG,KAAK,GAAG,YAAY,CAAC;QAChC,aAAa,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;QAC5B,SAAS,CAAC,KAAK,GAAG,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;QAChC,SAAS,CAAC,KAAK,GAAG,CAAC,GAAG,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;IACrC,CAAC;IACD,OAAO,SAAS,CAAC;AAClB,CAAC"}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import type { Callable, WorkBudget } from "@ac-kit/core";
|
|
2
|
+
import type { AsyncLayoutOptions, NetworkTraits } from "./types.js";
|
|
3
|
+
export type SankeyTraits<TNode, TLink> = NetworkTraits<TNode, TLink> & {
|
|
4
|
+
/**
|
|
5
|
+
* Flow of a link; finite, ≥ 0. Required. Named `linkValueOf`, not `valueOf`,
|
|
6
|
+
* which every object inherits.
|
|
7
|
+
*/
|
|
8
|
+
readonly linkValueOf: Callable<[link: TLink, index: number], number>;
|
|
9
|
+
/**
|
|
10
|
+
* Fixed node value (d3-sankey's `fixedValue`); finite, ≥ 0 and at least max(Σ
|
|
11
|
+
* incoming, Σ outgoing), so the bands fit the node. `undefined`: max(Σ
|
|
12
|
+
* incoming, Σ outgoing). A value short of that flow by at most 1e-9 of it
|
|
13
|
+
* (rounding noise) is raised to the flow; a larger shortfall throws.
|
|
14
|
+
*/
|
|
15
|
+
readonly nodeValueOf?: Callable<[
|
|
16
|
+
node: TNode,
|
|
17
|
+
index: number
|
|
18
|
+
], number | undefined>;
|
|
19
|
+
};
|
|
20
|
+
export type SankeyLayoutOptions = {
|
|
21
|
+
/** The nodes and links fill `[0, width] × [0, height]`; finite, ≥ 0. */
|
|
22
|
+
readonly width: number;
|
|
23
|
+
readonly height: number;
|
|
24
|
+
/** Finite, ≥ 0, at most `width` (the nodes stay inside `[0, width]`). Default 24. */
|
|
25
|
+
readonly nodeWidth?: number;
|
|
26
|
+
/**
|
|
27
|
+
* Gap between nodes of a column, finite ≥ 0; shrunk when a column cannot fit.
|
|
28
|
+
* Default 8.
|
|
29
|
+
*/
|
|
30
|
+
readonly nodePadding?: number;
|
|
31
|
+
/**
|
|
32
|
+
* Column of each node, as d3-sankey's `sankeyJustify` (default: sinks in the
|
|
33
|
+
* last column), `sankeyLeft`, `sankeyRight` and `sankeyCenter`.
|
|
34
|
+
*/
|
|
35
|
+
readonly alignment?: "justify" | "left" | "right" | "center";
|
|
36
|
+
/**
|
|
37
|
+
* Vertical order in a column: `"relaxation"` (default: sorted by position
|
|
38
|
+
* after each relaxation step, as d3-sankey), `"input"` (node order, as
|
|
39
|
+
* `nodeSort(null)`), `"crossings"` (the barycentric sweeps of the layered
|
|
40
|
+
* layout, then kept fixed; the node order of the input is kept when it
|
|
41
|
+
* crosses no more, counting the links as straight lines between node slots).
|
|
42
|
+
*/
|
|
43
|
+
readonly ordering?: "relaxation" | "input" | "crossings";
|
|
44
|
+
/**
|
|
45
|
+
* Link order at each node: `"breadth"` (default: by the other end's position)
|
|
46
|
+
* or `"input"`. As in d3-sankey, `"breadth"` first orders the incoming bands
|
|
47
|
+
* of each column by the position of their source, and leaves the outgoing
|
|
48
|
+
* bands in input order until a relaxation pass reorders them: with
|
|
49
|
+
* `iterations: 0` they stay in input order.
|
|
50
|
+
*/
|
|
51
|
+
readonly linkOrder?: "breadth" | "input";
|
|
52
|
+
/** Relaxation passes: an integer ≥ 0. Default 6. */
|
|
53
|
+
readonly iterations?: number;
|
|
54
|
+
/** Charged V + E per pass (and per sweep of `"crossings"`). */
|
|
55
|
+
readonly budget?: WorkBudget;
|
|
56
|
+
};
|
|
57
|
+
export type SankeyLayout = {
|
|
58
|
+
/** 4 per node (`Box2` order). */
|
|
59
|
+
readonly nodeBoxes: Float64Array;
|
|
60
|
+
readonly nodeValues: Float64Array;
|
|
61
|
+
/** Column per node, 0 leftmost. */
|
|
62
|
+
readonly columns: Uint32Array;
|
|
63
|
+
/** Band thickness per link (value × scale). */
|
|
64
|
+
readonly linkWidths: Float64Array;
|
|
65
|
+
/**
|
|
66
|
+
* 4 per link: x0 (source box maxX), y0 (band centre at the source), x1
|
|
67
|
+
* (target box minX), y1.
|
|
68
|
+
*/
|
|
69
|
+
readonly linkEnds: Float64Array;
|
|
70
|
+
};
|
|
71
|
+
/**
|
|
72
|
+
* Flow diagram. Columns follow the longest path from the sources, then
|
|
73
|
+
* `alignment`; node heights are proportional to their value; the link bands are
|
|
74
|
+
* stacked at each node. The vertical positions follow the iterative relaxation
|
|
75
|
+
* that Mike Bostock's d3-sankey 0.12 applies to the layered flow diagrams of
|
|
76
|
+
* Riehmann, Hanfler and Froehlich ("Interactive Sankey Diagrams", IEEE InfoVis
|
|
77
|
+
* 2005), implemented here from that description: `iterations` passes, each
|
|
78
|
+
* moving every node, column by column from the right then from the left, to the
|
|
79
|
+
* position that would level its links (weighted by value × columns spanned,
|
|
80
|
+
* strength 0.99^pass), reordering the bands by the position of their other end,
|
|
81
|
+
* then pushing overlapping nodes apart. Isolated nodes get value 0, and the
|
|
82
|
+
* last column under `"justify"`. Where d3-sankey yields NaN, a single column
|
|
83
|
+
* starts at x = 0 and a column of zero-valued nodes takes no height. Collisions
|
|
84
|
+
* are resolved down to 1e-6 × min(1, height), so two nodes of a column may
|
|
85
|
+
* overlap by that much (d3-sankey's own cutoff for heights ≥ 1).
|
|
86
|
+
*
|
|
87
|
+
* Complexity: O(V + E) columns; each pass O(V log V + E log E + Σ d²) for the
|
|
88
|
+
* node degrees d; `"crossings"` adds the cost of the layered ordering and of
|
|
89
|
+
* comparing it with the input order, O(Σ span · log E) over the links.
|
|
90
|
+
*
|
|
91
|
+
* @throws {RangeError} A cycle or a self-loop (naming a link on it: a circular
|
|
92
|
+
* flow is not supported), a link end that is not a node index, a negative,
|
|
93
|
+
* non-finite or over-1e150 link or node value (so no sum overflows), a node
|
|
94
|
+
* value below its flow, a `nodeWidth` larger than `width`, an option out of
|
|
95
|
+
* range.
|
|
96
|
+
*/
|
|
97
|
+
export declare function sankeyLayout<TNode, TLink>(nodes: readonly TNode[], links: readonly TLink[], traits: SankeyTraits<TNode, TLink>, options: SankeyLayoutOptions): SankeyLayout;
|
|
98
|
+
/**
|
|
99
|
+
* {@link sankeyLayout} in time slices: yields to the event loop every `sliceMs`
|
|
100
|
+
* (after the columns, after each relaxation pass), and rejects with
|
|
101
|
+
* `signal.reason` once aborted. The result equals the sync form's.
|
|
102
|
+
*/
|
|
103
|
+
export declare function sankeyLayoutAsync<TNode, TLink>(nodes: readonly TNode[], links: readonly TLink[], traits: SankeyTraits<TNode, TLink>, options: SankeyLayoutOptions & AsyncLayoutOptions): Promise<SankeyLayout>;
|
|
104
|
+
//# sourceMappingURL=sankey-layout.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sankey-layout.d.ts","sourceRoot":"","sources":["../../src/layout/sankey-layout.ts"],"names":[],"mappings":"AAS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