@ac-kit/math-graph 0.0.0-stage → 0.2.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.
Files changed (88) hide show
  1. package/CHANGELOG.md +183 -0
  2. package/LICENSE +28 -0
  3. package/README.md +118 -2
  4. package/dist/index.d.ts +12 -0
  5. package/dist/index.d.ts.map +1 -0
  6. package/dist/index.js +11 -0
  7. package/dist/index.js.map +1 -0
  8. package/dist/layout/_force-forces.d.ts +227 -0
  9. package/dist/layout/_force-forces.d.ts.map +1 -0
  10. package/dist/layout/_force-forces.js +1572 -0
  11. package/dist/layout/_force-forces.js.map +1 -0
  12. package/dist/layout/_hierarchy-table.d.ts +34 -0
  13. package/dist/layout/_hierarchy-table.d.ts.map +1 -0
  14. package/dist/layout/_hierarchy-table.js +131 -0
  15. package/dist/layout/_hierarchy-table.js.map +1 -0
  16. package/dist/layout/_index-graph.d.ts +32 -0
  17. package/dist/layout/_index-graph.d.ts.map +1 -0
  18. package/dist/layout/_index-graph.js +51 -0
  19. package/dist/layout/_index-graph.js.map +1 -0
  20. package/dist/layout/_layer-order.d.ts +138 -0
  21. package/dist/layout/_layer-order.d.ts.map +1 -0
  22. package/dist/layout/_layer-order.js +954 -0
  23. package/dist/layout/_layer-order.js.map +1 -0
  24. package/dist/layout/_layered-acyclic.d.ts +28 -0
  25. package/dist/layout/_layered-acyclic.d.ts.map +1 -0
  26. package/dist/layout/_layered-acyclic.js +179 -0
  27. package/dist/layout/_layered-acyclic.js.map +1 -0
  28. package/dist/layout/_layered-position.d.ts +56 -0
  29. package/dist/layout/_layered-position.d.ts.map +1 -0
  30. package/dist/layout/_layered-position.js +369 -0
  31. package/dist/layout/_layered-position.js.map +1 -0
  32. package/dist/layout/_layered-rank.d.ts +58 -0
  33. package/dist/layout/_layered-rank.d.ts.map +1 -0
  34. package/dist/layout/_layered-rank.js +529 -0
  35. package/dist/layout/_layered-rank.js.map +1 -0
  36. package/dist/layout/_tree-common.d.ts +38 -0
  37. package/dist/layout/_tree-common.d.ts.map +1 -0
  38. package/dist/layout/_tree-common.js +73 -0
  39. package/dist/layout/_tree-common.js.map +1 -0
  40. package/dist/layout/_treemap-tiling.d.ts +73 -0
  41. package/dist/layout/_treemap-tiling.d.ts.map +1 -0
  42. package/dist/layout/_treemap-tiling.js +247 -0
  43. package/dist/layout/_treemap-tiling.js.map +1 -0
  44. package/dist/layout/circular-layout.d.ts +27 -0
  45. package/dist/layout/circular-layout.d.ts.map +1 -0
  46. package/dist/layout/circular-layout.js +35 -0
  47. package/dist/layout/circular-layout.js.map +1 -0
  48. package/dist/layout/create-force-step.d.ts +127 -0
  49. package/dist/layout/create-force-step.d.ts.map +1 -0
  50. package/dist/layout/create-force-step.js +167 -0
  51. package/dist/layout/create-force-step.js.map +1 -0
  52. package/dist/layout/dendrogram-layout.d.ts +32 -0
  53. package/dist/layout/dendrogram-layout.d.ts.map +1 -0
  54. package/dist/layout/dendrogram-layout.js +110 -0
  55. package/dist/layout/dendrogram-layout.js.map +1 -0
  56. package/dist/layout/force-directed-layout.d.ts +42 -0
  57. package/dist/layout/force-directed-layout.d.ts.map +1 -0
  58. package/dist/layout/force-directed-layout.js +112 -0
  59. package/dist/layout/force-directed-layout.js.map +1 -0
  60. package/dist/layout/layered-layout.d.ts +109 -0
  61. package/dist/layout/layered-layout.d.ts.map +1 -0
  62. package/dist/layout/layered-layout.js +124 -0
  63. package/dist/layout/layered-layout.js.map +1 -0
  64. package/dist/layout/partition-layout.d.ts +31 -0
  65. package/dist/layout/partition-layout.d.ts.map +1 -0
  66. package/dist/layout/partition-layout.js +78 -0
  67. package/dist/layout/partition-layout.js.map +1 -0
  68. package/dist/layout/phyllotaxis-layout.d.ts +17 -0
  69. package/dist/layout/phyllotaxis-layout.d.ts.map +1 -0
  70. package/dist/layout/phyllotaxis-layout.js +32 -0
  71. package/dist/layout/phyllotaxis-layout.js.map +1 -0
  72. package/dist/layout/sankey-layout.d.ts +113 -0
  73. package/dist/layout/sankey-layout.d.ts.map +1 -0
  74. package/dist/layout/sankey-layout.js +641 -0
  75. package/dist/layout/sankey-layout.js.map +1 -0
  76. package/dist/layout/tidy-tree-layout.d.ts +25 -0
  77. package/dist/layout/tidy-tree-layout.d.ts.map +1 -0
  78. package/dist/layout/tidy-tree-layout.js +197 -0
  79. package/dist/layout/tidy-tree-layout.js.map +1 -0
  80. package/dist/layout/treemap-layout.d.ts +63 -0
  81. package/dist/layout/treemap-layout.d.ts.map +1 -0
  82. package/dist/layout/treemap-layout.js +126 -0
  83. package/dist/layout/treemap-layout.js.map +1 -0
  84. package/dist/layout/types.d.ts +90 -0
  85. package/dist/layout/types.d.ts.map +1 -0
  86. package/dist/layout/types.js +2 -0
  87. package/dist/layout/types.js.map +1 -0
  88. package/package.json +68 -3
@@ -0,0 +1,73 @@
1
+ import { assertPositive, describeValue } from "@ac-kit/core";
2
+ /** Siblings 1 apart, other neighbours 2 (the Reingold–Tilford convention). */
3
+ export function defaultSeparation(a, b, table) {
4
+ return table.parentIndices[a] === table.parentIndices[b] ? 1 : 2;
5
+ }
6
+ /**
7
+ * `traits.separationOf` (or the default) wrapped to refuse a result that is not
8
+ * finite and > 0, naming the two rows.
9
+ */
10
+ export function createCheckedSeparation(table, separationOf, functionName) {
11
+ const read = separationOf ?? defaultSeparation;
12
+ return (a, b) => {
13
+ const separation = read(a, b, table);
14
+ if (!(Number.isFinite(separation) && separation > 0)) {
15
+ throw new RangeError(`${functionName}: separation of rows ${a} and ${b} must be finite and positive, got ${describeValue(separation)}`);
16
+ }
17
+ return separation;
18
+ };
19
+ }
20
+ /**
21
+ * Reads the box or per-node spacing of a tree layout.
22
+ *
23
+ * @throws {RangeError} A size that is not finite and > 0, a box mixed with a
24
+ * spacing, or only one of `nodeWidth` and `nodeHeight`.
25
+ */
26
+ export function resolveTreeSize(options, functionName) {
27
+ const { width, height, nodeWidth, nodeHeight } = options;
28
+ if (nodeWidth !== undefined || nodeHeight !== undefined) {
29
+ if (width !== undefined || height !== undefined) {
30
+ throw new RangeError(`${functionName}: width/height and nodeWidth/nodeHeight are mutually exclusive`);
31
+ }
32
+ if (nodeWidth === undefined || nodeHeight === undefined) {
33
+ throw new RangeError(`${functionName}: nodeWidth and nodeHeight go together`);
34
+ }
35
+ assertPositive(nodeWidth, `${functionName}: nodeWidth`);
36
+ assertPositive(nodeHeight, `${functionName}: nodeHeight`);
37
+ return { isPerNode: true, horizontal: nodeWidth, vertical: nodeHeight };
38
+ }
39
+ const resolvedWidth = width ?? 1;
40
+ const resolvedHeight = height ?? 1;
41
+ assertPositive(resolvedWidth, `${functionName}: width`);
42
+ assertPositive(resolvedHeight, `${functionName}: height`);
43
+ return {
44
+ isPerNode: false,
45
+ horizontal: resolvedWidth,
46
+ vertical: resolvedHeight,
47
+ };
48
+ }
49
+ /**
50
+ * First/last child and neighbouring siblings per row, from the pre-order parent
51
+ * column. O(n).
52
+ */
53
+ export function buildSiblingLinks(parentIndices) {
54
+ const count = parentIndices.length;
55
+ const firstChild = new Int32Array(count).fill(-1);
56
+ const lastChild = new Int32Array(count).fill(-1);
57
+ const previousSibling = new Int32Array(count).fill(-1);
58
+ const nextSibling = new Int32Array(count).fill(-1);
59
+ for (let row = 1; row < count; row++) {
60
+ const parent = parentIndices[row];
61
+ const previous = lastChild[parent];
62
+ if (previous < 0) {
63
+ firstChild[parent] = row;
64
+ }
65
+ else {
66
+ previousSibling[row] = previous;
67
+ nextSibling[previous] = row;
68
+ }
69
+ lastChild[parent] = row;
70
+ }
71
+ return { firstChild, lastChild, previousSibling, nextSibling };
72
+ }
73
+ //# sourceMappingURL=_tree-common.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"_tree-common.js","sourceRoot":"","sources":["../../src/layout/_tree-common.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAI7D,8EAA8E;AAC9E,MAAM,UAAU,iBAAiB,CAChC,CAAS,EACT,CAAS,EACT,KAA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,GAAG,CAAC,EAAE,CAAC;YAClB,UAAU,CAAC,MAAM,CAAC,GAAG,GAAG,CAAC;QAC1B,CAAC;aAAM,CAAC;YACP,eAAe,CAAC,GAAG,CAAC,GAAG,QAAQ,CAAC;YAChC,WAAW,CAAC,QAAQ,CAAC,GAAG,GAAG,CAAC;QAC7B,CAAC;QACD,SAAS,CAAC,MAAM,CAAC,GAAG,GAAG,CAAC;IACzB,CAAC;IAED,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,eAAe,EAAE,WAAW,EAAE,CAAC;AAChE,CAAC"}
@@ -0,0 +1,73 @@
1
+ import { type IndexGroups } from "@ac-kit/algo";
2
+ export type TilingContext = {
3
+ /** MinX, minY, maxX, maxY per row; the tiling writes its children's. */
4
+ readonly boxes: Float64Array;
5
+ readonly values: Float64Array;
6
+ readonly depths: Uint32Array;
7
+ /** Rows grouped by parent row, in table order. */
8
+ readonly children: IndexGroups;
9
+ /** Squarify's target aspect ratio. */
10
+ readonly aspectRatio: number;
11
+ };
12
+ /**
13
+ * Splits the box `[x0, x1] × [y0, y1]` between the children of `parentRow` (at
14
+ * least one), writing their boxes.
15
+ */
16
+ export type Tiling = (context: TilingContext, parentRow: number, x0: number, y0: number, x1: number, y1: number) => void;
17
+ /**
18
+ * Slice-and-dice (Shneiderman, "Tree visualization with tree-maps: 2-d
19
+ * space-filling approach", 1992; Johnson & Shneiderman, 1991): children side by
20
+ * side along x.
21
+ *
22
+ * Complexity: O(k) for k children.
23
+ */
24
+ export declare const tileDice: Tiling;
25
+ /** Slice-and-dice's other cut: children stacked along y. Same complexity. */
26
+ export declare const tileSlice: Tiling;
27
+ /**
28
+ * Slice-and-dice alternating the cut with depth (Shneiderman 1992): an
29
+ * even-depth parent is diced, an odd-depth one sliced.
30
+ */
31
+ export declare const tileSliceDice: Tiling;
32
+ /**
33
+ * Squarified treemap (Bruls, Huizing & van Wijk, "Squarified Treemaps",
34
+ * Eurographics/IEEE VisSym 2000, the 1999 report): children are laid in rows
35
+ * along the shorter side of the remaining rectangle; a child joins the current
36
+ * row while the row's worst aspect ratio does not get worse. The target ratio
37
+ * `aspectRatio` generalises the paper's square (ratio 1): with the remaining
38
+ * area scaled to the values, a row of sum `s`, smallest `a` and largest `b` has
39
+ * worst ratio `max(b / β, β / a)` where `β = s² · max(h/w, w/h) / (total ·
40
+ * aspectRatio)`, `w × h` being the remaining rectangle. Zero-value children
41
+ * join the next row (they take no space).
42
+ *
43
+ * Complexity: O(k) for k children.
44
+ */
45
+ export declare const tileSquarify: Tiling;
46
+ /**
47
+ * Binary-tree treemap (the BinaryTree layout of Bederson & Wattenberg, "Treemap
48
+ * Algorithms v1.0", 2001; a balanced-cut description is in Liang et al., 2015,
49
+ * doi 10.1016/j.jvlc.2015.10.009): the children, in order, are cut at the point
50
+ * that balances the two halves' values best, the box is split across its longer
51
+ * side in the same proportion, and each half is split again until one child is
52
+ * left. The cut is found by binary search over prefix sums. Iterative: the
53
+ * recursion of the description runs on an explicit stack.
54
+ *
55
+ * As in every other tiling, a parent's own value is reserved: the children are
56
+ * tiled over the share `children's sum / value` of the box, cut across its
57
+ * longer side, and the rest is left empty (at the right or bottom). Children
58
+ * whose values sum to zero get boxes of zero area. Range values come from
59
+ * prefix sums that keep each addition's rounding error (TwoSum), so a small
60
+ * child after a huge one keeps its share.
61
+ *
62
+ * Complexity: O(k log k) for k children (O(k) prefix sums, one binary search
63
+ * per split).
64
+ */
65
+ export declare const tileBinary: Tiling;
66
+ /**
67
+ * {@link tileBinary} as d3-hierarchy's `treemapBinary`: the split uses the
68
+ * parent's value, so its own value is added to the last half at every cut and
69
+ * the children cover the whole box; children whose values sum to zero leave the
70
+ * whole box to the last of them.
71
+ */
72
+ export declare const tileBinaryD3: Tiling;
73
+ //# sourceMappingURL=_treemap-tiling.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"_treemap-tiling.d.ts","sourceRoot":"","sources":["../../src/layout/_treemap-tiling.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,KAAK,WAAW,EAAE,MAAM,cAAc,CAAC;AAG9D,MAAM,MAAM,aAAa,GAAG;IAC3B,wEAAwE;IACxE,QAAQ,CAAC,KAAK,EAAE,YAAY,CAAC;IAC7B,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC;IAC9B,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC;IAC7B,kDAAkD;IAClD,QAAQ,CAAC,QAAQ,EAAE,WAAW,CAAC;IAC/B,sCAAsC;IACtC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;CAC7B,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,MAAM,GAAG,CACpB,OAAO,EAAE,aAAa,EACtB,SAAS,EAAE,MAAM,EACjB,EAAE,EAAE,MAAM,EACV,EAAE,EAAE,MAAM,EACV,EAAE,EAAE,MAAM,EACV,EAAE,EAAE,MAAM,KACN,IAAI,CAAC;AA0DV;;;;;;GAMG;AACH,eAAO,MAAM,QAAQ,EAAE,MAYtB,CAAC;AAEF,6EAA6E;AAC7E,eAAO,MAAM,SAAS,EAAE,MAYvB,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,aAAa,EAAE,MAM3B,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,YAAY,EAAE,MAmD1B,CAAC;AAEF;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,UAAU,EAAE,MAExB,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,YAAY,EAAE,MAE1B,CAAC"}
@@ -0,0 +1,247 @@
1
+ import { binarySearch } from "@ac-kit/algo";
2
+ import { twoSumError } from "@ac-kit/math-scalar";
3
+ /**
4
+ * Lays the rows `indices[from … to)`, whose values sum to `total`, side by side
5
+ * along x over the full height (Shneiderman & Johnson, "slice-and-dice", the
6
+ * vertical cut). A zero total gives zero-width boxes at `x0`.
7
+ */
8
+ function diceRange_(context, from, to, total, x0, y0, x1, y1) {
9
+ const { boxes, values } = context;
10
+ const { indices } = context.children;
11
+ const scale = total === 0 ? 0 : (x1 - x0) / total;
12
+ let x = x0;
13
+ for (let index = from; index < to; index++) {
14
+ const row = indices[index];
15
+ const offset = row * 4;
16
+ boxes[offset] = x;
17
+ boxes[offset + 1] = y0;
18
+ x += values[row] * scale;
19
+ boxes[offset + 2] = x;
20
+ boxes[offset + 3] = y1;
21
+ }
22
+ }
23
+ /** {@link diceRange_} along y: the horizontal cut. */
24
+ function sliceRange_(context, from, to, total, x0, y0, x1, y1) {
25
+ const { boxes, values } = context;
26
+ const { indices } = context.children;
27
+ const scale = total === 0 ? 0 : (y1 - y0) / total;
28
+ let y = y0;
29
+ for (let index = from; index < to; index++) {
30
+ const row = indices[index];
31
+ const offset = row * 4;
32
+ boxes[offset] = x0;
33
+ boxes[offset + 1] = y;
34
+ boxes[offset + 2] = x1;
35
+ y += values[row] * scale;
36
+ boxes[offset + 3] = y;
37
+ }
38
+ }
39
+ /**
40
+ * Slice-and-dice (Shneiderman, "Tree visualization with tree-maps: 2-d
41
+ * space-filling approach", 1992; Johnson & Shneiderman, 1991): children side by
42
+ * side along x.
43
+ *
44
+ * Complexity: O(k) for k children.
45
+ */
46
+ export const tileDice = (context, parentRow, x0, y0, x1, y1) => {
47
+ const { offsets } = context.children;
48
+ diceRange_(context, offsets[parentRow], offsets[parentRow + 1], context.values[parentRow], x0, y0, x1, y1);
49
+ };
50
+ /** Slice-and-dice's other cut: children stacked along y. Same complexity. */
51
+ export const tileSlice = (context, parentRow, x0, y0, x1, y1) => {
52
+ const { offsets } = context.children;
53
+ sliceRange_(context, offsets[parentRow], offsets[parentRow + 1], context.values[parentRow], x0, y0, x1, y1);
54
+ };
55
+ /**
56
+ * Slice-and-dice alternating the cut with depth (Shneiderman 1992): an
57
+ * even-depth parent is diced, an odd-depth one sliced.
58
+ */
59
+ export const tileSliceDice = (context, parentRow, ...box) => {
60
+ ((context.depths[parentRow] & 1) === 1 ? tileSlice : tileDice)(context, parentRow, ...box);
61
+ };
62
+ /**
63
+ * Squarified treemap (Bruls, Huizing & van Wijk, "Squarified Treemaps",
64
+ * Eurographics/IEEE VisSym 2000, the 1999 report): children are laid in rows
65
+ * along the shorter side of the remaining rectangle; a child joins the current
66
+ * row while the row's worst aspect ratio does not get worse. The target ratio
67
+ * `aspectRatio` generalises the paper's square (ratio 1): with the remaining
68
+ * area scaled to the values, a row of sum `s`, smallest `a` and largest `b` has
69
+ * worst ratio `max(b / β, β / a)` where `β = s² · max(h/w, w/h) / (total ·
70
+ * aspectRatio)`, `w × h` being the remaining rectangle. Zero-value children
71
+ * join the next row (they take no space).
72
+ *
73
+ * Complexity: O(k) for k children.
74
+ */
75
+ export const tileSquarify = (context, parentRow, x0, y0, x1, y1) => {
76
+ const { values } = context;
77
+ const { offsets, indices } = context.children;
78
+ const end = offsets[parentRow + 1];
79
+ const ratio = context.aspectRatio;
80
+ let remaining = values[parentRow];
81
+ let from = offsets[parentRow];
82
+ let to = from;
83
+ while (from < end) {
84
+ const width = x1 - x0;
85
+ const height = y1 - y0;
86
+ let sum = 0;
87
+ do {
88
+ sum = values[indices[to++]];
89
+ } while (sum === 0 && to < end);
90
+ let smallest = sum;
91
+ let largest = sum;
92
+ const alpha = Math.max(height / width, width / height) / (remaining * ratio);
93
+ let beta = sum * sum * alpha;
94
+ let worst = Math.max(largest / beta, beta / smallest);
95
+ for (; to < end; to++) {
96
+ const value = values[indices[to]];
97
+ const grown = sum + value;
98
+ const nextSmallest = value < smallest ? value : smallest;
99
+ const nextLargest = value > largest ? value : largest;
100
+ beta = grown * grown * alpha;
101
+ const nextWorst = Math.max(nextLargest / beta, beta / nextSmallest);
102
+ if (nextWorst > worst) {
103
+ break;
104
+ }
105
+ sum = grown;
106
+ smallest = nextSmallest;
107
+ largest = nextLargest;
108
+ worst = nextWorst;
109
+ }
110
+ if (width < height) {
111
+ const cut = remaining === 0 ? y1 : y0 + (height * sum) / remaining;
112
+ diceRange_(context, from, to, sum, x0, y0, x1, cut);
113
+ y0 = cut;
114
+ }
115
+ else {
116
+ const cut = remaining === 0 ? x1 : x0 + (width * sum) / remaining;
117
+ sliceRange_(context, from, to, sum, x0, y0, cut, y1);
118
+ x0 = cut;
119
+ }
120
+ remaining -= sum;
121
+ from = to;
122
+ }
123
+ };
124
+ /**
125
+ * Binary-tree treemap (the BinaryTree layout of Bederson & Wattenberg, "Treemap
126
+ * Algorithms v1.0", 2001; a balanced-cut description is in Liang et al., 2015,
127
+ * doi 10.1016/j.jvlc.2015.10.009): the children, in order, are cut at the point
128
+ * that balances the two halves' values best, the box is split across its longer
129
+ * side in the same proportion, and each half is split again until one child is
130
+ * left. The cut is found by binary search over prefix sums. Iterative: the
131
+ * recursion of the description runs on an explicit stack.
132
+ *
133
+ * As in every other tiling, a parent's own value is reserved: the children are
134
+ * tiled over the share `children's sum / value` of the box, cut across its
135
+ * longer side, and the rest is left empty (at the right or bottom). Children
136
+ * whose values sum to zero get boxes of zero area. Range values come from
137
+ * prefix sums that keep each addition's rounding error (TwoSum), so a small
138
+ * child after a huge one keeps its share.
139
+ *
140
+ * Complexity: O(k log k) for k children (O(k) prefix sums, one binary search
141
+ * per split).
142
+ */
143
+ export const tileBinary = (context, parentRow, x0, y0, x1, y1) => {
144
+ binaryRange_(context, parentRow, false, x0, y0, x1, y1);
145
+ };
146
+ /**
147
+ * {@link tileBinary} as d3-hierarchy's `treemapBinary`: the split uses the
148
+ * parent's value, so its own value is added to the last half at every cut and
149
+ * the children cover the whole box; children whose values sum to zero leave the
150
+ * whole box to the last of them.
151
+ */
152
+ export const tileBinaryD3 = (context, parentRow, x0, y0, x1, y1) => {
153
+ binaryRange_(context, parentRow, true, x0, y0, x1, y1);
154
+ };
155
+ function binaryRange_(context, parentRow, isD3, x0, y0, x1, y1) {
156
+ const { boxes, values } = context;
157
+ const { offsets, indices } = context.children;
158
+ const first = offsets[parentRow];
159
+ const count = offsets[parentRow + 1] - first;
160
+ // Prefix sums with the rounding error of each addition (TwoSum) kept apart,
161
+ // so a range's value is the difference of both: a small child after a huge
162
+ // one keeps its share. d3-hierarchy's plain prefix sums when `isD3`.
163
+ const sums = new Float64Array(count + 1);
164
+ const errors = new Float64Array(count + 1);
165
+ for (let index = 0; index < count; index++) {
166
+ const value = values[indices[first + index]];
167
+ const sum = sums[index] + value;
168
+ errors[index + 1] = isD3
169
+ ? 0
170
+ : errors[index] + twoSumError(sums[index], value, sum);
171
+ sums[index + 1] = sum;
172
+ }
173
+ const rangeValue = (from, to) => sums[to] - sums[from] + (errors[to] - errors[from]);
174
+ let total = values[parentRow];
175
+ if (!isD3) {
176
+ // The children's sum in the order the parent's value was summed (last child
177
+ // first), so it equals the parent's value exactly when it has none of its
178
+ // own.
179
+ let children = 0;
180
+ for (let index = count - 1; index >= 0; index--) {
181
+ children += values[indices[first + index]];
182
+ }
183
+ if (children === 0) {
184
+ if (x1 - x0 > y1 - y0) {
185
+ x1 = x0;
186
+ }
187
+ else {
188
+ y1 = y0;
189
+ }
190
+ total = 0;
191
+ }
192
+ else if (children < total) {
193
+ const own = total - children;
194
+ if (x1 - x0 > y1 - y0) {
195
+ x1 = (x0 * own + x1 * children) / total;
196
+ }
197
+ else {
198
+ y1 = (y0 * own + y1 * children) / total;
199
+ }
200
+ total = children;
201
+ }
202
+ }
203
+ // Each entry: range start, range end (exclusive), its value, its box.
204
+ const stack = [0, count, total, x0, y0, x1, y1];
205
+ while (stack.length > 0) {
206
+ const bottom = stack.pop();
207
+ const right = stack.pop();
208
+ const top = stack.pop();
209
+ const left = stack.pop();
210
+ const value = stack.pop();
211
+ const end = stack.pop();
212
+ const start = stack.pop();
213
+ if (end - start === 1) {
214
+ const offset = indices[first + start] * 4;
215
+ boxes[offset] = left;
216
+ boxes[offset + 1] = top;
217
+ boxes[offset + 2] = right;
218
+ boxes[offset + 3] = bottom;
219
+ continue;
220
+ }
221
+ const offset = sums[start];
222
+ const half = value / 2;
223
+ const target = half + offset;
224
+ let low = binarySearch(start + 1, end - 1, (index) => isD3 ? sums[index] < target : rangeValue(start, index) < half);
225
+ // The nearer of the two prefix sums around the target, keeping both halves
226
+ // non-empty.
227
+ if (start + 1 < low &&
228
+ (isD3
229
+ ? target - sums[low - 1] < sums[low] - target
230
+ : half - rangeValue(start, low - 1) < rangeValue(start, low) - half)) {
231
+ low--;
232
+ }
233
+ const valueLeft = isD3 ? sums[low] - offset : rangeValue(start, low);
234
+ const valueRight = isD3 ? value - valueLeft : rangeValue(low, end);
235
+ if (right - left > bottom - top) {
236
+ const cut = value === 0 ? right : (left * valueRight + right * valueLeft) / value;
237
+ stack.push(start, low, valueLeft, left, top, cut, bottom);
238
+ stack.push(low, end, valueRight, cut, top, right, bottom);
239
+ }
240
+ else {
241
+ const cut = value === 0 ? bottom : (top * valueRight + bottom * valueLeft) / value;
242
+ stack.push(start, low, valueLeft, left, top, right, cut);
243
+ stack.push(low, end, valueRight, left, cut, right, bottom);
244
+ }
245
+ }
246
+ }
247
+ //# sourceMappingURL=_treemap-tiling.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"_treemap-tiling.js","sourceRoot":"","sources":["../../src/layout/_treemap-tiling.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAoB,MAAM,cAAc,CAAC;AAC9D,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AA0BlD;;;;GAIG;AACH,SAAS,UAAU,CAClB,OAAsB,EACtB,IAAY,EACZ,EAAU,EACV,KAAa,EACb,EAAU,EACV,EAAU,EACV,EAAU,EACV,EAAU;IAEV,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;IAClC,MAAM,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,QAAQ,CAAC;IACrC,MAAM,KAAK,GAAG,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,KAAK,CAAC;IAClD,IAAI,CAAC,GAAG,EAAE,CAAC;IACX,KAAK,IAAI,KAAK,GAAG,IAAI,E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3
+ readonly centerX?: number;
4
+ /** Default 0. */
5
+ readonly centerY?: number;
6
+ /** Default 1, ≥ 0. */
7
+ readonly radius?: number;
8
+ /** Angle of node 0, radians from +x toward +y. Default −π/2 (top, y-down). */
9
+ readonly startAngle?: number;
10
+ /**
11
+ * Total sweep; negative turns the other way. Default 2π (node i at
12
+ * `startAngle + sweep · i / count`).
13
+ */
14
+ readonly sweep?: number;
15
+ };
16
+ /**
17
+ * Nodes at equal angles on a circle, in index order: x, y per node, y down.
18
+ *
19
+ * Complexity: O(n) time and memory. `startAngle` and `sweep` are meant to lie
20
+ * within [1e−150, 1e150] in magnitude (a sweep near `Number.MAX_VALUE`
21
+ * overflows to NaN).
22
+ *
23
+ * @throws {RangeError} `count` not a non-negative safe integer, a non-finite
24
+ * option, or a negative radius.
25
+ */
26
+ export declare function circularLayout(count: number, options?: CircularLayoutOptions): Float64Array;
27
+ //# sourceMappingURL=circular-layout.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"circular-layout.d.ts","sourceRoot":"","sources":["../../src/layout/circular-layout.ts"],"names":[],"mappings":"AAKA,MAAM,MAAM,qBAAqB,GAAG;IACnC,iBAAiB;IACjB,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,iBAAiB;IACjB,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,sBAAsB;IACtB,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,8EAA8E;IAC9E,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B;;;OAGG;IACH,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;CACxB,CAAC;AAEF;;;;;;;;;GASG;AACH,wBAAgB,cAAc,CAC7B,KAAK,EAAE,MAAM,EACb,OAAO,GAAE,qBAA0B,GACjC,YAAY,CA0Bd"}
@@ -0,0 +1,35 @@
1
+ import { assertFinite, 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 { TWO_PI } from "@ac-kit/math-scalar";
5
+ /**
6
+ * Nodes at equal angles on a circle, in index order: x, y per node, y down.
7
+ *
8
+ * Complexity: O(n) time and memory. `startAngle` and `sweep` are meant to lie
9
+ * within [1e−150, 1e150] in magnitude (a sweep near `Number.MAX_VALUE`
10
+ * overflows to NaN).
11
+ *
12
+ * @throws {RangeError} `count` not a non-negative safe integer, a non-finite
13
+ * option, or a negative radius.
14
+ */
15
+ export function circularLayout(count, options = {}) {
16
+ const { centerX = 0, centerY = 0, radius = 1, startAngle = -Math.PI / 2, sweep = TWO_PI, } = options;
17
+ assertInteger(count, "circularLayout: count", 0);
18
+ assertFinite(centerX, "circularLayout: centerX");
19
+ assertFinite(centerY, "circularLayout: centerY");
20
+ assertNonNegative(radius, "circularLayout: radius");
21
+ assertFinite(startAngle, "circularLayout: startAngle");
22
+ assertFinite(sweep, "circularLayout: sweep");
23
+ const positions = new Float64Array(count * 2);
24
+ const polar = polarCoordsCreate();
25
+ const point = vec2Create();
26
+ polar[0] = radius;
27
+ for (let index = 0; index < count; index++) {
28
+ polar[1] = startAngle + (sweep * index) / count;
29
+ vec2FromPolar(point, polar);
30
+ positions[index * 2] = centerX + point[0];
31
+ positions[index * 2 + 1] = centerY + point[1];
32
+ }
33
+ return positions;
34
+ }
35
+ //# sourceMappingURL=circular-layout.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"circular-layout.js","sourceRoot":"","sources":["../../src/layout/circular-layout.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAC9E,OAAO,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACzE,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,MAAM,EAAE,MAAM,qBA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C;IAC/C,CAAC;IACD,OAAO,SAAS,CAAC;AAClB,CAAC"}
@@ -0,0 +1,127 @@
1
+ import type { Callable, RandomFn } from "@ac-kit/core";
2
+ import type { NetworkTraits } from "./types.js";
3
+ export type ForceTraits<TNode, TLink> = NetworkTraits<TNode, TLink> & {
4
+ /**
5
+ * Many-body strength; negative repels (d3 `forceManyBody`). Default −30;
6
+ * finite.
7
+ */
8
+ readonly chargeOf?: Callable<[node: TNode, index: number], number>;
9
+ /** Collision radius (d3 `forceCollide`); absent: no collision force. Finite, ≥ 0. */
10
+ readonly radiusOf?: Callable<[node: TNode, index: number], number>;
11
+ /** Rest length (d3 `forceLink`). Default 30; finite, ≥ 0. */
12
+ readonly linkDistanceOf?: Callable<[link: TLink, index: number], number>;
13
+ /**
14
+ * Default 1 / min(degree(source), degree(target)), degrees counting every
15
+ * link end (d3). Finite, ≥ 0.
16
+ */
17
+ readonly linkStrengthOf?: Callable<[link: TLink, index: number], number>;
18
+ };
19
+ export type ForceOptions = {
20
+ /** Velocity kept per step is 1 − velocityDecay. Default 0.4, in [0, 1]. */
21
+ readonly velocityDecay?: number;
22
+ /**
23
+ * `"barnesHut"`: O(n log n) per step over `Quadtree`; `"exact"`: O(n²).
24
+ * Default "barnesHut".
25
+ */
26
+ readonly approximation?: "barnesHut" | "exact";
27
+ /**
28
+ * Barnes–Hut opening criterion (Barnes and Hut, "A hierarchical O(N log N)
29
+ * force-calculation algorithm", Nature 324, 1986), d3-force's form: a cell is
30
+ * summarised once width / distance < θ, the distance taken to the centre of
31
+ * its positive charges and to that of its negative ones (both must pass).
32
+ * Default 0.9; finite, > 0. A cell is never summarised while the node lies
33
+ * inside it, enlarged by 20 % (Springel, "The cosmological simulation code
34
+ * GADGET-2", MNRAS 364, 2005), so the node never feels its own charge, the
35
+ * self-interaction that Salmon and Warren ("Skeletons from the treecode
36
+ * closet", J. Comput. Phys. 111, 1994) show unbounds the plain criterion's
37
+ * error. Each sign keeps the error bound of same-sign charges, so charges of
38
+ * mixed sign are approximated as well as same-sign ones, and a cell whose
39
+ * charges sum to 0 is never skipped; the error tends to 0 with θ.
40
+ */
41
+ readonly theta?: number;
42
+ /**
43
+ * Many-body distance clamp. Defaults 1 and Infinity; 0 ≤ min, min ≤ max.
44
+ * `distanceMax` applies to each pair, in both modes: Barnes–Hut opens a cell
45
+ * that straddles it.
46
+ */
47
+ readonly distanceMin?: number;
48
+ readonly distanceMax?: number;
49
+ /**
50
+ * Centring (d3 `forceCenter`): shifts positions so that their mean moves
51
+ * `centerStrength` of the way to the centre. Defaults 0, 0 and 1; a strength
52
+ * of 0 disables it.
53
+ */
54
+ readonly centerX?: number;
55
+ readonly centerY?: number;
56
+ readonly centerStrength?: number;
57
+ /**
58
+ * Pull toward the centre on each axis (d3 `forceX`/`forceY`), keeps
59
+ * disconnected parts together. Default 0; finite, ≥ 0.
60
+ */
61
+ readonly gravity?: number;
62
+ /** Default 1, in [0, 1]. */
63
+ readonly collideStrength?: number;
64
+ /** Default 1; a positive integer. */
65
+ readonly collideIterations?: number;
66
+ /** Default 1; a positive integer. */
67
+ readonly linkIterations?: number;
68
+ /**
69
+ * `"d3-force"` reproduces d3-force 3's simulation to rounding, quirks
70
+ * included, for results that must match it: Barnes–Hut summarises a cell by
71
+ * its signed charge at the |charge|-weighted centre, even a cell holding the
72
+ * node itself, tests `distanceMax` against the cell's centre and skips a cell
73
+ * whose charges sum to 0; collision cells are bounded on the predictions made
74
+ * when a pass starts, so a node pushed into another's reach earlier in the
75
+ * same pass is missed until the next one, and only the newest node of a chain
76
+ * of coincident nodes is tested; a self-link draws a random offset every
77
+ * step. Absent (the default), none of these apply: see `theta` and
78
+ * `distanceMax`; collisions widen their pruning by how far any node has moved
79
+ * in the pass (the "skin" of Verlet's neighbour lists), and a self-link
80
+ * exerts no force (it still counts in the degrees the default strengths
81
+ * read).
82
+ */
83
+ readonly compatibility?: "d3-force";
84
+ /**
85
+ * Separates coincident nodes with offsets of ±5e-7; a seeded generator
86
+ * (`mulberry32(seed)`) keeps runs reproducible. Called in a fixed order, so
87
+ * the same seed gives the same layout.
88
+ */
89
+ readonly random: RandomFn;
90
+ };
91
+ /**
92
+ * One velocity-Verlet step at cooling `alpha` ∈ [0, 1]: forces in the order
93
+ * link → many-body → collide → gravity → centre, then v ← v·(1 −
94
+ * velocityDecay), x ← x + v; an axis with a finite `fixedPositions` entry is
95
+ * pinned there with zero velocity (d3 `fx`/`fy`; NaN means free). Mutates
96
+ * `positions` and `velocities` (2 per node); both must hold finite numbers, and
97
+ * stay finite for any finite inputs and options: every difference, sum, mean,
98
+ * square and product on the way is scaled by powers of two where it would leave
99
+ * the doubles, and a position or velocity whose exact value lies beyond them
100
+ * saturates at ±`Number.MAX_VALUE`. 0 B per call after the first calls. @throws
101
+ * {RangeError} wrong lengths; alpha outside [0, 1]; a `fixedPositions` entry
102
+ * that is ±Infinity; a non-finite position when the many-body or collision
103
+ * force reads it.
104
+ */
105
+ export type ForceStep = Callable<[
106
+ positions: Float64Array,
107
+ velocities: Float64Array,
108
+ alpha: number,
109
+ fixedPositions?: Float64Array
110
+ ]>;
111
+ /**
112
+ * Reads traits once (degrees, biases, strengths, distances, charges, radii into
113
+ * typed arrays) and returns the step for this graph. The simulation's state —
114
+ * positions, velocities, alpha schedule, pins — stays with the caller (an
115
+ * animation loop); the step owns only derived constants and scratch (one
116
+ * `Quadtree` per force, aggregate buffers).
117
+ *
118
+ * Complexity: O(n + m) to create; per step O(n log n + m) Barnes–Hut (O(n²)
119
+ * exact many-body), collision O(n log n) expected, O(n²) when the discs overlap
120
+ * everywhere.
121
+ *
122
+ * @throws {RangeError} A link index outside `[0, nodes.length)` or not an
123
+ * integer, a non-finite or negative trait value naming its row, an option out
124
+ * of range.
125
+ */
126
+ export declare function createForceStep<TNode, TLink>(nodes: readonly TNode[], links: readonly TLink[], traits: ForceTraits<TNode, TLink>, options: ForceOptions): ForceStep;
127
+ //# sourceMappingURL=create-force-step.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3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