@reicek/neataptic-ts 0.1.24 → 0.1.26
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/.github/copilot-instructions.md +11 -0
- package/.github/skills/trace-analyzer-extension/SKILL.md +3 -3
- package/.github/skills/trace-analyzer-extension/assets/extension-checklist.md +1 -1
- package/.github/skills/trace-analyzer-extension/references/analyzer-extension-workflow.md +1 -1
- package/.github/skills/trace-audit-reporting/SKILL.md +3 -3
- package/.github/skills/trace-audit-reporting/references/trace-analysis-workflow.md +1 -1
- package/.github/workflows/ci.yml +3 -3
- package/.github/workflows/deploy-pages.yml +6 -6
- package/.github/workflows/manual_release_pipeline.yml +3 -3
- package/.github/workflows/publish.yml +18 -19
- package/.github/workflows/release_dispatch.yml +3 -3
- package/package.json +26 -20
- package/plans/Flappy_Bird_Folder_Documentation_Pass.md +4 -4
- package/plans/README.md +24 -0
- package/plans/Roadmap.md +62 -40
- package/plans/analyze-trace-solid-split.plans.md +66 -0
- package/plans/architecture-solid-split.plans.md +9 -15
- package/plans/asciiMaze-typescript-repair.plans.md +1 -1
- package/plans/generate-docs-solid-split.plans.md +87 -0
- package/plans/methods-docs.plans.md +25 -1
- package/plans/methods-solid-split.plans.md +14 -14
- package/plans/neat-docs.plans.md +9 -1
- package/plans/neat-test-surface-repair.plans.md +1 -1
- package/plans/render-docs-html-solid-split.plans.md +68 -0
- package/plans/src-no-explicit-any-cleanup.plans.md +1 -1
- package/plans/utils-docs.plans.md +6 -1
- package/scripts/analyze-trace/analyze-trace.analysis.ts +479 -0
- package/scripts/analyze-trace/analyze-trace.constants.ts +35 -0
- package/scripts/analyze-trace/analyze-trace.io.ts +69 -0
- package/scripts/analyze-trace/analyze-trace.report.ts +100 -0
- package/scripts/analyze-trace/analyze-trace.shared.ts +116 -0
- package/scripts/analyze-trace/analyze-trace.ts +45 -0
- package/scripts/analyze-trace/analyze-trace.types.ts +72 -0
- package/scripts/assets/theme.css +80 -23
- package/scripts/copy-examples.ts +239 -0
- package/scripts/export-onnx.ts +223 -0
- package/scripts/generate-bench-tables.ts +378 -37
- package/scripts/generate-docs/generate-docs.constants.ts +107 -0
- package/scripts/generate-docs/generate-docs.order.ts +355 -0
- package/scripts/generate-docs/generate-docs.state.ts +31 -0
- package/scripts/generate-docs/generate-docs.targets.ts +165 -0
- package/scripts/generate-docs/generate-docs.ts +63 -0
- package/scripts/generate-docs/generate-docs.types.ts +112 -0
- package/scripts/generate-docs/output/generate-docs.output.folder-index.utils.ts +167 -0
- package/scripts/generate-docs/output/generate-docs.output.ordering.utils.ts +353 -0
- package/scripts/generate-docs/output/generate-docs.output.readme.utils.ts +420 -0
- package/scripts/generate-docs/output/generate-docs.output.ts +123 -0
- package/scripts/generate-docs/output/generate-docs.output.warnings.utils.ts +219 -0
- package/scripts/generate-docs/symbols/generate-docs.symbols.collection.utils.ts +365 -0
- package/scripts/generate-docs/symbols/generate-docs.symbols.jsdoc.utils.ts +373 -0
- package/scripts/generate-docs/symbols/generate-docs.symbols.normalize.utils.ts +155 -0
- package/scripts/generate-docs/symbols/generate-docs.symbols.render.utils.ts +149 -0
- package/scripts/generate-docs/symbols/generate-docs.symbols.signature.utils.ts +289 -0
- package/scripts/generate-docs/symbols/generate-docs.symbols.ts +11 -0
- package/scripts/mermaid-cli.mjs +102 -22
- package/scripts/mermaid-cli.ts +736 -0
- package/scripts/render-docs-html/render-docs-html.assets.ts +54 -0
- package/scripts/render-docs-html/render-docs-html.mermaid.ts +245 -0
- package/scripts/{render-docs-html.sidebar.ts → render-docs-html/render-docs-html.navigation.ts} +141 -144
- package/scripts/render-docs-html/render-docs-html.pages.ts +333 -0
- package/scripts/render-docs-html/render-docs-html.shared.ts +333 -0
- package/scripts/render-docs-html/render-docs-html.types.ts +42 -0
- package/scripts/render-docs-html.ts +23 -587
- package/scripts/run-docs.ts +238 -0
- package/scripts/write-dist-docs-pkg.ts +40 -0
- package/src/README.md +75 -75
- package/src/architecture/connection/README.md +5 -5
- package/src/architecture/layer/README.md +508 -508
- package/src/architecture/network/README.md +1458 -1458
- package/src/architecture/network/activate/README.md +694 -694
- package/src/architecture/network/bootstrap/README.md +77 -77
- package/src/architecture/network/connect/README.md +74 -74
- package/src/architecture/network/deterministic/README.md +135 -135
- package/src/architecture/network/evolve/README.md +364 -364
- package/src/architecture/network/gating/README.md +130 -130
- package/src/architecture/network/genetic/README.md +399 -399
- package/src/architecture/network/mutate/README.md +897 -897
- package/src/architecture/network/onnx/README.md +720 -720
- package/src/architecture/network/onnx/export/README.md +728 -728
- package/src/architecture/network/onnx/export/layers/README.md +450 -450
- package/src/architecture/network/onnx/import/README.md +618 -618
- package/src/architecture/network/onnx/schema/README.md +32 -32
- package/src/architecture/network/prune/README.md +245 -245
- package/src/architecture/network/remove/README.md +135 -135
- package/src/architecture/network/runtime/README.md +106 -106
- package/src/architecture/network/serialize/README.md +542 -542
- package/src/architecture/network/slab/README.md +608 -608
- package/src/architecture/network/standalone/README.md +212 -212
- package/src/architecture/network/stats/README.md +84 -84
- package/src/architecture/network/topology/README.md +465 -465
- package/src/architecture/network/training/README.md +200 -200
- package/src/architecture/node/README.md +5 -5
- package/src/architecture/nodePool/README.md +14 -14
- package/src/methods/README.md +99 -99
- package/src/methods/activation/README.md +189 -189
- package/src/methods/cost/README.md +131 -131
- package/src/methods/rate/README.md +86 -86
- package/src/multithreading/README.md +77 -77
- package/src/multithreading/workers/browser/README.md +8 -8
- package/src/multithreading/workers/node/README.md +8 -8
- package/src/neat/README.md +148 -148
- package/src/neat/adaptive/README.md +120 -120
- package/src/neat/adaptive/acceptance/README.md +40 -40
- package/src/neat/adaptive/complexity/README.md +137 -137
- package/src/neat/adaptive/core/README.md +197 -197
- package/src/neat/adaptive/lineage/README.md +90 -90
- package/src/neat/adaptive/mutation/README.md +284 -284
- package/src/neat/compat/README.md +43 -43
- package/src/neat/compat/core/README.md +90 -90
- package/src/neat/diversity/README.md +35 -35
- package/src/neat/diversity/core/README.md +88 -88
- package/src/neat/evaluate/README.md +85 -85
- package/src/neat/evaluate/auto-distance/README.md +75 -75
- package/src/neat/evaluate/entropy-compat/README.md +37 -37
- package/src/neat/evaluate/entropy-sharing/README.md +43 -43
- package/src/neat/evaluate/fitness/README.md +23 -23
- package/src/neat/evaluate/novelty/README.md +120 -120
- package/src/neat/evaluate/objectives/README.md +17 -17
- package/src/neat/evaluate/shared/README.md +94 -94
- package/src/neat/evolve/README.md +96 -96
- package/src/neat/evolve/adaptive/README.md +60 -60
- package/src/neat/evolve/objectives/README.md +63 -63
- package/src/neat/evolve/offspring/README.md +56 -56
- package/src/neat/evolve/population/README.md +171 -171
- package/src/neat/evolve/runtime/README.md +79 -79
- package/src/neat/evolve/speciation/README.md +74 -74
- package/src/neat/evolve/warnings/README.md +10 -10
- package/src/neat/export/README.md +114 -114
- package/src/neat/helpers/README.md +50 -50
- package/src/neat/init/README.md +9 -9
- package/src/neat/lineage/core/README.md +101 -101
- package/src/neat/multiobjective/category/README.md +74 -74
- package/src/neat/multiobjective/crowding/README.md +272 -272
- package/src/neat/multiobjective/dominance/README.md +171 -171
- package/src/neat/multiobjective/fronts/README.md +68 -68
- package/src/neat/multiobjective/metrics/README.md +43 -43
- package/src/neat/multiobjective/objectives/README.md +31 -31
- package/src/neat/multiobjective/shared/README.md +27 -27
- package/src/neat/mutation/README.md +97 -97
- package/src/neat/mutation/add-conn/README.md +115 -115
- package/src/neat/mutation/add-node/README.md +126 -126
- package/src/neat/mutation/flow/README.md +149 -149
- package/src/neat/mutation/repair/README.md +185 -185
- package/src/neat/mutation/select/README.md +117 -117
- package/src/neat/mutation/shared/README.md +32 -32
- package/src/neat/objectives/README.md +25 -25
- package/src/neat/objectives/core/README.md +67 -67
- package/src/neat/pruning/README.md +40 -40
- package/src/neat/pruning/core/README.md +171 -171
- package/src/neat/pruning/facade/README.md +32 -32
- package/src/neat/rng/README.md +104 -104
- package/src/neat/rng/core/README.md +137 -137
- package/src/neat/rng/facade/README.md +50 -50
- package/src/neat/selection/README.md +111 -111
- package/src/neat/selection/core/README.md +227 -227
- package/src/neat/selection/facade/README.md +61 -61
- package/src/neat/shared/README.md +163 -163
- package/src/neat/speciation/README.md +31 -31
- package/src/neat/speciation/threshold/README.md +35 -35
- package/src/neat/species/README.md +25 -25
- package/src/neat/species/core/README.md +20 -20
- package/src/neat/species/core/shared/README.md +18 -18
- package/src/neat/species/history/context/README.md +22 -22
- package/src/neat/telemetry/accessors/README.md +58 -58
- package/src/neat/telemetry/exports/README.md +233 -233
- package/src/neat/telemetry/facade/README.md +252 -252
- package/src/neat/telemetry/facade/archive/README.md +57 -57
- package/src/neat/telemetry/facade/buffer/README.md +43 -43
- package/src/neat/telemetry/facade/lineage/README.md +12 -12
- package/src/neat/telemetry/facade/objectives/README.md +44 -44
- package/src/neat/telemetry/facade/runtime/README.md +26 -26
- package/src/neat/telemetry/facade/species/README.md +27 -27
- package/src/neat/telemetry/metrics/README.md +696 -696
- package/src/neat/telemetry/recorder/README.md +57 -57
- package/src/neat/telemetry/types/README.md +32 -32
- package/src/neat/topology-intent/README.md +75 -75
- package/src/utils/README.md +193 -193
- package/test/examples/asciiMaze/browser-entry/README.md +92 -92
- package/test/examples/asciiMaze/dashboardManager/README.md +109 -109
- package/test/examples/asciiMaze/dashboardManager/telemetry/README.md +28 -28
- package/test/examples/asciiMaze/evolutionEngine/README.md +1527 -1527
- package/test/examples/asciiMaze/mazeMovement/README.md +105 -105
- package/test/examples/asciiMaze/mazeMovement/finalization/README.md +16 -16
- package/test/examples/asciiMaze/mazeMovement/policy/README.md +57 -57
- package/test/examples/asciiMaze/mazeMovement/runtime/README.md +52 -52
- package/test/examples/asciiMaze/mazeMovement/shaping/README.md +46 -46
- package/test/examples/flappy_bird/browser-entry/README.md +508 -508
- package/test/examples/flappy_bird/browser-entry/host/README.md +101 -101
- package/test/examples/flappy_bird/browser-entry/host/resize/README.md +144 -144
- package/test/examples/flappy_bird/browser-entry/network-view/README.md +194 -194
- package/test/examples/flappy_bird/browser-entry/playback/README.md +278 -278
- package/test/examples/flappy_bird/browser-entry/playback/background/README.md +129 -129
- package/test/examples/flappy_bird/browser-entry/playback/background/ground-grid/README.md +502 -502
- package/test/examples/flappy_bird/browser-entry/playback/frame-render/README.md +139 -139
- package/test/examples/flappy_bird/browser-entry/playback/snapshot/README.md +10 -10
- package/test/examples/flappy_bird/browser-entry/playback/trail/README.md +43 -43
- package/test/examples/flappy_bird/browser-entry/playback/worker-channel/README.md +30 -30
- package/test/examples/flappy_bird/browser-entry/runtime/README.md +59 -59
- package/test/examples/flappy_bird/browser-entry/visualization/README.md +276 -276
- package/test/examples/flappy_bird/browser-entry/worker-channel/README.md +16 -16
- package/test/examples/flappy_bird/constants/README.md +1070 -1070
- package/test/examples/flappy_bird/environment/README.md +22 -22
- package/test/examples/flappy_bird/evaluation/README.md +32 -32
- package/test/examples/flappy_bird/evaluation/rollout/README.md +141 -141
- package/test/examples/flappy_bird/flappy-evolution-worker/README.md +425 -425
- package/test/examples/flappy_bird/simulation-shared/README.md +170 -170
- package/test/examples/flappy_bird/simulation-shared/observation/README.md +109 -109
- package/test/examples/flappy_bird/trainer/README.md +325 -325
- package/test/examples/flappy_bird/trainer/evaluation/README.md +74 -74
- package/scripts/analyze-trace.ts +0 -590
- package/scripts/copy-examples.mjs +0 -114
- package/scripts/export-onnx.mjs +0 -86
- package/scripts/generate-bench-tables.mjs +0 -182
- package/scripts/generate-docs.ts +0 -2900
- package/scripts/write-dist-docs-pkg.mjs +0 -16
|
@@ -18,38 +18,38 @@ Design Notes:
|
|
|
18
18
|
|
|
19
19
|
## architecture/network/topology/network.topology.utils.types.ts
|
|
20
20
|
|
|
21
|
-
### INPUT_NODE_TYPE
|
|
22
|
-
|
|
23
|
-
Input node-type discriminator used for queue seeding.
|
|
24
|
-
|
|
25
|
-
### ZERO_COUNT
|
|
26
|
-
|
|
27
|
-
Zero baseline used for degree counts and empty-size checks.
|
|
28
|
-
|
|
29
21
|
### IN_DEGREE_DECREMENT
|
|
30
22
|
|
|
31
23
|
Unit decrement/increment used for in-degree tally updates.
|
|
32
24
|
|
|
33
|
-
###
|
|
34
|
-
|
|
35
|
-
Internal topology state view carried across helper groups.
|
|
36
|
-
|
|
37
|
-
### TopologyBuildContext
|
|
25
|
+
### INPUT_NODE_TYPE
|
|
38
26
|
|
|
39
|
-
|
|
27
|
+
Input node-type discriminator used for queue seeding.
|
|
40
28
|
|
|
41
29
|
### PathSearchContext
|
|
42
30
|
|
|
43
31
|
Mutable context used while running iterative DFS reachability checks.
|
|
44
32
|
|
|
33
|
+
### TopologyBuildContext
|
|
34
|
+
|
|
35
|
+
Mutable context used while building Kahn topological order.
|
|
36
|
+
|
|
45
37
|
### TopologyNetwork
|
|
46
38
|
|
|
47
39
|
Network instance type used by topology helpers.
|
|
48
40
|
|
|
41
|
+
### TopologyNetworkProps
|
|
42
|
+
|
|
43
|
+
Internal topology state view carried across helper groups.
|
|
44
|
+
|
|
49
45
|
### TopologyNode
|
|
50
46
|
|
|
51
47
|
Node instance type used by topology helpers.
|
|
52
48
|
|
|
49
|
+
### ZERO_COUNT
|
|
50
|
+
|
|
51
|
+
Zero baseline used for degree counts and empty-size checks.
|
|
52
|
+
|
|
53
53
|
## architecture/network/topology/network.topology.utils.ts
|
|
54
54
|
|
|
55
55
|
### computeTopoOrder
|
|
@@ -62,16 +62,25 @@ Compute a topological ordering (Kahn's algorithm) for the current directed acycl
|
|
|
62
62
|
If cycles are detected (order shorter than node count) we fall back to raw node order to avoid breaking callers.
|
|
63
63
|
In non-acyclic mode we simply clear cached order to signal use of sequential node array.
|
|
64
64
|
|
|
65
|
-
###
|
|
65
|
+
### createMLP
|
|
66
66
|
|
|
67
67
|
```ts
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
68
|
+
createMLP(
|
|
69
|
+
inputCount: number,
|
|
70
|
+
hiddenCounts: number[],
|
|
71
|
+
outputCount: number,
|
|
72
|
+
): default
|
|
72
73
|
```
|
|
73
74
|
|
|
74
|
-
|
|
75
|
+
Build a strictly layered and fully connected MLP network.
|
|
76
|
+
|
|
77
|
+
Parameters:
|
|
78
|
+
- `this` - Network constructor.
|
|
79
|
+
- `inputCount` - Number of input nodes.
|
|
80
|
+
- `hiddenCounts` - Hidden-layer node counts.
|
|
81
|
+
- `outputCount` - Number of output nodes.
|
|
82
|
+
|
|
83
|
+
Returns: Newly created MLP network.
|
|
75
84
|
|
|
76
85
|
### getTopologyIntent
|
|
77
86
|
|
|
@@ -90,6 +99,30 @@ Parameters:
|
|
|
90
99
|
|
|
91
100
|
Returns: Current topology intent.
|
|
92
101
|
|
|
102
|
+
### hasPath
|
|
103
|
+
|
|
104
|
+
```ts
|
|
105
|
+
hasPath(
|
|
106
|
+
from: default,
|
|
107
|
+
to: default,
|
|
108
|
+
): boolean
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
Depth-first reachability test (avoids infinite loops via visited set).
|
|
112
|
+
|
|
113
|
+
### rebuildConnections
|
|
114
|
+
|
|
115
|
+
```ts
|
|
116
|
+
rebuildConnections(
|
|
117
|
+
networkInstance: default,
|
|
118
|
+
): void
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
Rebuild the canonical connection array from per-node outgoing lists.
|
|
122
|
+
|
|
123
|
+
Parameters:
|
|
124
|
+
- `networkInstance` - Target network.
|
|
125
|
+
|
|
93
126
|
### setEnforceAcyclic
|
|
94
127
|
|
|
95
128
|
```ts
|
|
@@ -128,87 +161,58 @@ Parameters:
|
|
|
128
161
|
|
|
129
162
|
Returns: Nothing.
|
|
130
163
|
|
|
131
|
-
### createMLP
|
|
132
|
-
|
|
133
|
-
```ts
|
|
134
|
-
createMLP(
|
|
135
|
-
inputCount: number,
|
|
136
|
-
hiddenCounts: number[],
|
|
137
|
-
outputCount: number,
|
|
138
|
-
): default
|
|
139
|
-
```
|
|
140
|
-
|
|
141
|
-
Build a strictly layered and fully connected MLP network.
|
|
142
|
-
|
|
143
|
-
Parameters:
|
|
144
|
-
- `this` - Network constructor.
|
|
145
|
-
- `inputCount` - Number of input nodes.
|
|
146
|
-
- `hiddenCounts` - Hidden-layer node counts.
|
|
147
|
-
- `outputCount` - Number of output nodes.
|
|
148
|
-
|
|
149
|
-
Returns: Newly created MLP network.
|
|
150
|
-
|
|
151
|
-
### rebuildConnections
|
|
152
|
-
|
|
153
|
-
```ts
|
|
154
|
-
rebuildConnections(
|
|
155
|
-
networkInstance: default,
|
|
156
|
-
): void
|
|
157
|
-
```
|
|
158
|
-
|
|
159
|
-
Rebuild the canonical connection array from per-node outgoing lists.
|
|
160
|
-
|
|
161
|
-
Parameters:
|
|
162
|
-
- `networkInstance` - Target network.
|
|
163
|
-
|
|
164
164
|
## architecture/network/topology/network.topology.loop.utils.ts
|
|
165
165
|
|
|
166
|
-
###
|
|
166
|
+
### appendTopoNode
|
|
167
167
|
|
|
168
168
|
```ts
|
|
169
|
-
|
|
170
|
-
|
|
169
|
+
appendTopoNode(
|
|
170
|
+
topoOrder: default[],
|
|
171
|
+
node: default,
|
|
171
172
|
): void
|
|
172
173
|
```
|
|
173
174
|
|
|
174
|
-
|
|
175
|
+
Append one node to topological order output.
|
|
175
176
|
|
|
176
177
|
Parameters:
|
|
177
|
-
- `
|
|
178
|
+
- `topoOrder` - Accumulated topological order.
|
|
179
|
+
- `node` - Node to append.
|
|
178
180
|
|
|
179
181
|
Returns: Void.
|
|
180
182
|
|
|
181
|
-
###
|
|
183
|
+
### decrementNodeInDegree
|
|
182
184
|
|
|
183
185
|
```ts
|
|
184
|
-
|
|
186
|
+
decrementNodeInDegree(
|
|
185
187
|
buildContext: TopologyBuildContext,
|
|
186
|
-
|
|
188
|
+
node: default,
|
|
189
|
+
): number
|
|
187
190
|
```
|
|
188
191
|
|
|
189
|
-
|
|
192
|
+
Decrement node in-degree and return remaining value.
|
|
190
193
|
|
|
191
194
|
Parameters:
|
|
192
195
|
- `buildContext` - Mutable build context.
|
|
196
|
+
- `node` - Target node.
|
|
193
197
|
|
|
194
|
-
Returns:
|
|
198
|
+
Returns: Remaining in-degree after decrement.
|
|
195
199
|
|
|
196
|
-
###
|
|
200
|
+
### getInDegree
|
|
197
201
|
|
|
198
202
|
```ts
|
|
199
|
-
|
|
200
|
-
node: default,
|
|
203
|
+
getInDegree(
|
|
201
204
|
buildContext: TopologyBuildContext,
|
|
202
|
-
|
|
205
|
+
node: default,
|
|
206
|
+
): number
|
|
203
207
|
```
|
|
204
208
|
|
|
205
|
-
|
|
209
|
+
Read in-degree for a node with zero fallback.
|
|
206
210
|
|
|
207
211
|
Parameters:
|
|
208
|
-
- `node` - Candidate node.
|
|
209
212
|
- `buildContext` - Mutable build context.
|
|
213
|
+
- `node` - Candidate node.
|
|
210
214
|
|
|
211
|
-
Returns:
|
|
215
|
+
Returns: In-degree value.
|
|
212
216
|
|
|
213
217
|
### isInputNode
|
|
214
218
|
|
|
@@ -225,52 +229,52 @@ Parameters:
|
|
|
225
229
|
|
|
226
230
|
Returns: True when node type is input.
|
|
227
231
|
|
|
228
|
-
###
|
|
232
|
+
### isQueueSeedNode
|
|
229
233
|
|
|
230
234
|
```ts
|
|
231
|
-
|
|
232
|
-
buildContext: TopologyBuildContext,
|
|
235
|
+
isQueueSeedNode(
|
|
233
236
|
node: default,
|
|
234
|
-
|
|
237
|
+
buildContext: TopologyBuildContext,
|
|
238
|
+
): boolean
|
|
235
239
|
```
|
|
236
240
|
|
|
237
|
-
|
|
241
|
+
Determine whether a node belongs in the initial queue.
|
|
238
242
|
|
|
239
243
|
Parameters:
|
|
240
|
-
- `buildContext` - Mutable build context.
|
|
241
244
|
- `node` - Candidate node.
|
|
245
|
+
- `buildContext` - Mutable build context.
|
|
242
246
|
|
|
243
|
-
Returns:
|
|
247
|
+
Returns: True when node is input-type or has zero in-degree.
|
|
244
248
|
|
|
245
|
-
###
|
|
249
|
+
### isSelfConnection
|
|
246
250
|
|
|
247
251
|
```ts
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
252
|
+
isSelfConnection(
|
|
253
|
+
from: default,
|
|
254
|
+
to: default,
|
|
255
|
+
): boolean
|
|
251
256
|
```
|
|
252
257
|
|
|
253
|
-
|
|
258
|
+
Test whether a connection is a self-loop.
|
|
254
259
|
|
|
255
260
|
Parameters:
|
|
256
|
-
- `
|
|
261
|
+
- `from` - Source node.
|
|
262
|
+
- `to` - Target node.
|
|
257
263
|
|
|
258
|
-
Returns:
|
|
264
|
+
Returns: True when source and target are the same node.
|
|
259
265
|
|
|
260
|
-
###
|
|
266
|
+
### processKahnQueue
|
|
261
267
|
|
|
262
268
|
```ts
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
node: default,
|
|
269
|
+
processKahnQueue(
|
|
270
|
+
buildContext: TopologyBuildContext,
|
|
266
271
|
): void
|
|
267
272
|
```
|
|
268
273
|
|
|
269
|
-
|
|
274
|
+
Process queue until all available nodes are emitted.
|
|
270
275
|
|
|
271
276
|
Parameters:
|
|
272
|
-
- `
|
|
273
|
-
- `node` - Node to append.
|
|
277
|
+
- `buildContext` - Mutable build context.
|
|
274
278
|
|
|
275
279
|
Returns: Void.
|
|
276
280
|
|
|
@@ -291,39 +295,35 @@ Parameters:
|
|
|
291
295
|
|
|
292
296
|
Returns: Void.
|
|
293
297
|
|
|
294
|
-
###
|
|
298
|
+
### seedProcessingQueue
|
|
295
299
|
|
|
296
300
|
```ts
|
|
297
|
-
|
|
301
|
+
seedProcessingQueue(
|
|
298
302
|
buildContext: TopologyBuildContext,
|
|
299
|
-
|
|
300
|
-
): number
|
|
303
|
+
): void
|
|
301
304
|
```
|
|
302
305
|
|
|
303
|
-
|
|
306
|
+
Seed Kahn queue with input nodes and zero in-degree nodes.
|
|
304
307
|
|
|
305
308
|
Parameters:
|
|
306
309
|
- `buildContext` - Mutable build context.
|
|
307
|
-
- `node` - Target node.
|
|
308
310
|
|
|
309
|
-
Returns:
|
|
311
|
+
Returns: Void.
|
|
310
312
|
|
|
311
|
-
###
|
|
313
|
+
### takeNextQueueNode
|
|
312
314
|
|
|
313
315
|
```ts
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
): boolean
|
|
316
|
+
takeNextQueueNode(
|
|
317
|
+
processingQueue: default[],
|
|
318
|
+
): default
|
|
318
319
|
```
|
|
319
320
|
|
|
320
|
-
|
|
321
|
+
Shift and return the next queue node.
|
|
321
322
|
|
|
322
323
|
Parameters:
|
|
323
|
-
- `
|
|
324
|
-
- `to` - Target node.
|
|
324
|
+
- `processingQueue` - Queue of pending nodes.
|
|
325
325
|
|
|
326
|
-
Returns:
|
|
326
|
+
Returns: Next node.
|
|
327
327
|
|
|
328
328
|
## architecture/network/topology/network.topology.path.utils.ts
|
|
329
329
|
|
|
@@ -344,20 +344,22 @@ Parameters:
|
|
|
344
344
|
|
|
345
345
|
Returns: Initialized path-search context.
|
|
346
346
|
|
|
347
|
-
###
|
|
347
|
+
### hasVisitedNode
|
|
348
348
|
|
|
349
349
|
```ts
|
|
350
|
-
|
|
351
|
-
|
|
350
|
+
hasVisitedNode(
|
|
351
|
+
visitedNodes: Set<default>,
|
|
352
|
+
node: default,
|
|
352
353
|
): boolean
|
|
353
354
|
```
|
|
354
355
|
|
|
355
|
-
|
|
356
|
+
Test whether a node has already been visited.
|
|
356
357
|
|
|
357
358
|
Parameters:
|
|
358
|
-
- `
|
|
359
|
+
- `visitedNodes` - Visited-node set.
|
|
360
|
+
- `node` - Candidate node.
|
|
359
361
|
|
|
360
|
-
Returns: True when
|
|
362
|
+
Returns: True when node is already visited.
|
|
361
363
|
|
|
362
364
|
### isSameNode
|
|
363
365
|
|
|
@@ -376,120 +378,118 @@ Parameters:
|
|
|
376
378
|
|
|
377
379
|
Returns: True when references are identical.
|
|
378
380
|
|
|
379
|
-
###
|
|
381
|
+
### isSelfConnection
|
|
380
382
|
|
|
381
383
|
```ts
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
384
|
+
isSelfConnection(
|
|
385
|
+
from: default,
|
|
386
|
+
to: default,
|
|
387
|
+
): boolean
|
|
385
388
|
```
|
|
386
389
|
|
|
387
|
-
|
|
390
|
+
Test whether a connection is a self-loop.
|
|
388
391
|
|
|
389
392
|
Parameters:
|
|
390
|
-
- `
|
|
393
|
+
- `from` - Source node.
|
|
394
|
+
- `to` - Target node.
|
|
391
395
|
|
|
392
|
-
Returns:
|
|
396
|
+
Returns: True when source and target are the same node.
|
|
393
397
|
|
|
394
|
-
###
|
|
398
|
+
### markVisited
|
|
395
399
|
|
|
396
400
|
```ts
|
|
397
|
-
|
|
401
|
+
markVisited(
|
|
398
402
|
visitedNodes: Set<default>,
|
|
399
403
|
node: default,
|
|
400
|
-
):
|
|
404
|
+
): void
|
|
401
405
|
```
|
|
402
406
|
|
|
403
|
-
|
|
407
|
+
Mark a node as visited.
|
|
404
408
|
|
|
405
409
|
Parameters:
|
|
406
410
|
- `visitedNodes` - Visited-node set.
|
|
407
|
-
- `node` -
|
|
411
|
+
- `node` - Node to mark.
|
|
408
412
|
|
|
409
|
-
Returns:
|
|
413
|
+
Returns: Void.
|
|
410
414
|
|
|
411
|
-
###
|
|
415
|
+
### pushOutgoingTargets
|
|
412
416
|
|
|
413
417
|
```ts
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
418
|
+
pushOutgoingTargets(
|
|
419
|
+
nodesToVisitStack: default[],
|
|
420
|
+
currentNode: default,
|
|
417
421
|
): void
|
|
418
422
|
```
|
|
419
423
|
|
|
420
|
-
|
|
424
|
+
Push non-self outgoing targets to DFS stack.
|
|
421
425
|
|
|
422
426
|
Parameters:
|
|
423
|
-
- `
|
|
424
|
-
- `
|
|
427
|
+
- `nodesToVisitStack` - DFS stack.
|
|
428
|
+
- `currentNode` - Current expanded node.
|
|
425
429
|
|
|
426
430
|
Returns: Void.
|
|
427
431
|
|
|
428
|
-
###
|
|
432
|
+
### takeNextStackNode
|
|
429
433
|
|
|
430
434
|
```ts
|
|
431
|
-
|
|
435
|
+
takeNextStackNode(
|
|
432
436
|
nodesToVisitStack: default[],
|
|
433
|
-
|
|
434
|
-
): void
|
|
437
|
+
): default
|
|
435
438
|
```
|
|
436
439
|
|
|
437
|
-
|
|
440
|
+
Pop and return next DFS stack node.
|
|
438
441
|
|
|
439
442
|
Parameters:
|
|
440
443
|
- `nodesToVisitStack` - DFS stack.
|
|
441
|
-
- `currentNode` - Current expanded node.
|
|
442
444
|
|
|
443
|
-
Returns:
|
|
445
|
+
Returns: Next node to process.
|
|
444
446
|
|
|
445
|
-
###
|
|
447
|
+
### traversePathSearch
|
|
446
448
|
|
|
447
449
|
```ts
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
to: default,
|
|
450
|
+
traversePathSearch(
|
|
451
|
+
searchContext: PathSearchContext,
|
|
451
452
|
): boolean
|
|
452
453
|
```
|
|
453
454
|
|
|
454
|
-
|
|
455
|
+
Traverse DFS search stack and test reachability.
|
|
455
456
|
|
|
456
457
|
Parameters:
|
|
457
|
-
- `
|
|
458
|
-
- `to` - Target node.
|
|
458
|
+
- `searchContext` - Mutable search context.
|
|
459
459
|
|
|
460
|
-
Returns: True when
|
|
460
|
+
Returns: True when target node is reachable.
|
|
461
461
|
|
|
462
462
|
## architecture/network/topology/network.topology.setup.utils.ts
|
|
463
463
|
|
|
464
|
-
###
|
|
464
|
+
### applyIncomingEdgeCounts
|
|
465
465
|
|
|
466
466
|
```ts
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
):
|
|
467
|
+
applyIncomingEdgeCounts(
|
|
468
|
+
buildContext: TopologyBuildContext,
|
|
469
|
+
): void
|
|
470
470
|
```
|
|
471
471
|
|
|
472
|
-
|
|
472
|
+
Apply in-degree increments from non-self connections.
|
|
473
473
|
|
|
474
474
|
Parameters:
|
|
475
|
-
- `
|
|
475
|
+
- `buildContext` - Mutable build context.
|
|
476
476
|
|
|
477
|
-
Returns:
|
|
477
|
+
Returns: Void.
|
|
478
478
|
|
|
479
|
-
###
|
|
479
|
+
### asTopologyProps
|
|
480
480
|
|
|
481
481
|
```ts
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
):
|
|
482
|
+
asTopologyProps(
|
|
483
|
+
network: default,
|
|
484
|
+
): TopologyNetworkProps
|
|
485
485
|
```
|
|
486
486
|
|
|
487
|
-
|
|
487
|
+
Cast network to internal topology props view.
|
|
488
488
|
|
|
489
489
|
Parameters:
|
|
490
|
-
- `
|
|
490
|
+
- `network` - Network instance.
|
|
491
491
|
|
|
492
|
-
Returns:
|
|
492
|
+
Returns: Internal topology props view.
|
|
493
493
|
|
|
494
494
|
### clearCachedTopoOrder
|
|
495
495
|
|
|
@@ -523,66 +523,53 @@ Parameters:
|
|
|
523
523
|
|
|
524
524
|
Returns: Initialized build context.
|
|
525
525
|
|
|
526
|
-
###
|
|
526
|
+
### finalizeTopoOrder
|
|
527
527
|
|
|
528
528
|
```ts
|
|
529
|
-
|
|
529
|
+
finalizeTopoOrder(
|
|
530
530
|
buildContext: TopologyBuildContext,
|
|
531
531
|
): void
|
|
532
532
|
```
|
|
533
533
|
|
|
534
|
-
|
|
534
|
+
Finalize cached order, falling back to raw node order on cycle detection.
|
|
535
535
|
|
|
536
536
|
Parameters:
|
|
537
537
|
- `buildContext` - Mutable build context.
|
|
538
538
|
|
|
539
539
|
Returns: Void.
|
|
540
540
|
|
|
541
|
-
###
|
|
541
|
+
### incrementNodeInDegree
|
|
542
542
|
|
|
543
543
|
```ts
|
|
544
|
-
|
|
544
|
+
incrementNodeInDegree(
|
|
545
545
|
buildContext: TopologyBuildContext,
|
|
546
|
+
node: default,
|
|
546
547
|
): void
|
|
547
548
|
```
|
|
548
549
|
|
|
549
|
-
|
|
550
|
+
Increment in-degree for a node in the tally map.
|
|
550
551
|
|
|
551
552
|
Parameters:
|
|
552
553
|
- `buildContext` - Mutable build context.
|
|
554
|
+
- `node` - Target node.
|
|
553
555
|
|
|
554
556
|
Returns: Void.
|
|
555
557
|
|
|
556
|
-
###
|
|
558
|
+
### initializeAllNodeInDegreeCounts
|
|
557
559
|
|
|
558
560
|
```ts
|
|
559
|
-
|
|
561
|
+
initializeAllNodeInDegreeCounts(
|
|
560
562
|
buildContext: TopologyBuildContext,
|
|
561
563
|
): void
|
|
562
564
|
```
|
|
563
565
|
|
|
564
|
-
|
|
566
|
+
Initialize all nodes with zero in-degree.
|
|
565
567
|
|
|
566
568
|
Parameters:
|
|
567
569
|
- `buildContext` - Mutable build context.
|
|
568
570
|
|
|
569
571
|
Returns: Void.
|
|
570
572
|
|
|
571
|
-
### resolveFinalOrder
|
|
572
|
-
|
|
573
|
-
```ts
|
|
574
|
-
resolveFinalOrder(
|
|
575
|
-
buildContext: TopologyBuildContext,
|
|
576
|
-
): default[]
|
|
577
|
-
```
|
|
578
|
-
|
|
579
|
-
Resolve final topological order with cycle fallback.
|
|
580
|
-
|
|
581
|
-
Parameters:
|
|
582
|
-
- `buildContext` - Mutable build context.
|
|
583
|
-
|
|
584
|
-
Returns: Fully valid topological order or raw node order fallback.
|
|
585
|
-
|
|
586
573
|
### isSelfConnection
|
|
587
574
|
|
|
588
575
|
```ts
|
|
@@ -600,127 +587,125 @@ Parameters:
|
|
|
600
587
|
|
|
601
588
|
Returns: True when source and target are the same node.
|
|
602
589
|
|
|
603
|
-
###
|
|
590
|
+
### resolveFinalOrder
|
|
604
591
|
|
|
605
592
|
```ts
|
|
606
|
-
|
|
593
|
+
resolveFinalOrder(
|
|
607
594
|
buildContext: TopologyBuildContext,
|
|
608
|
-
|
|
609
|
-
): void
|
|
595
|
+
): default[]
|
|
610
596
|
```
|
|
611
597
|
|
|
612
|
-
|
|
598
|
+
Resolve final topological order with cycle fallback.
|
|
613
599
|
|
|
614
600
|
Parameters:
|
|
615
601
|
- `buildContext` - Mutable build context.
|
|
616
|
-
- `node` - Target node.
|
|
617
602
|
|
|
618
|
-
Returns:
|
|
603
|
+
Returns: Fully valid topological order or raw node order fallback.
|
|
604
|
+
|
|
605
|
+
### shouldUseRawNodeOrder
|
|
606
|
+
|
|
607
|
+
```ts
|
|
608
|
+
shouldUseRawNodeOrder(
|
|
609
|
+
internalTopologyProps: TopologyNetworkProps,
|
|
610
|
+
): boolean
|
|
611
|
+
```
|
|
612
|
+
|
|
613
|
+
Determine whether topological order should be bypassed.
|
|
614
|
+
|
|
615
|
+
Parameters:
|
|
616
|
+
- `internalTopologyProps` - Internal topology props view.
|
|
617
|
+
|
|
618
|
+
Returns: True when acyclic mode is disabled.
|
|
619
619
|
|
|
620
620
|
## architecture/network/topology/network.topology.factory.utils.ts
|
|
621
621
|
|
|
622
|
-
###
|
|
622
|
+
### addOutgoingConnectionsToSet
|
|
623
623
|
|
|
624
624
|
```ts
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
): default
|
|
625
|
+
addOutgoingConnectionsToSet(
|
|
626
|
+
outgoingConnections: default[],
|
|
627
|
+
allConnections: Set<default>,
|
|
628
|
+
): void
|
|
630
629
|
```
|
|
631
630
|
|
|
632
|
-
|
|
631
|
+
Add all outgoing connections to a deduplication set.
|
|
633
632
|
|
|
634
633
|
Parameters:
|
|
635
|
-
- `
|
|
636
|
-
- `
|
|
637
|
-
- `hiddenCounts` - Hidden-layer node counts.
|
|
638
|
-
- `outputCount` - Number of output nodes.
|
|
639
|
-
|
|
640
|
-
Returns: Newly created MLP network.
|
|
634
|
+
- `outgoingConnections` - Outgoing connections from one node.
|
|
635
|
+
- `allConnections` - Deduplication set for network connections.
|
|
641
636
|
|
|
642
|
-
###
|
|
637
|
+
### assignNetworkNodes
|
|
643
638
|
|
|
644
639
|
```ts
|
|
645
|
-
|
|
640
|
+
assignNetworkNodes(
|
|
646
641
|
networkInstance: default,
|
|
642
|
+
mlpNodeLayers: MlpNodeLayers,
|
|
647
643
|
): void
|
|
648
644
|
```
|
|
649
645
|
|
|
650
|
-
|
|
646
|
+
Assign ordered nodes to the network instance.
|
|
651
647
|
|
|
652
648
|
Parameters:
|
|
653
649
|
- `networkInstance` - Target network.
|
|
650
|
+
- `mlpNodeLayers` - Grouped node layers for this MLP.
|
|
654
651
|
|
|
655
|
-
###
|
|
652
|
+
### collectUniqueOutgoingConnections
|
|
656
653
|
|
|
657
654
|
```ts
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
outputCount: number,
|
|
662
|
-
): MlpNodeLayers
|
|
655
|
+
collectUniqueOutgoingConnections(
|
|
656
|
+
networkInstance: default,
|
|
657
|
+
): Set<default>
|
|
663
658
|
```
|
|
664
659
|
|
|
665
|
-
|
|
660
|
+
Collect unique outgoing connections across all network nodes.
|
|
666
661
|
|
|
667
662
|
Parameters:
|
|
668
|
-
- `
|
|
669
|
-
- `hiddenCounts` - Hidden-layer node counts.
|
|
670
|
-
- `outputCount` - Number of output nodes.
|
|
663
|
+
- `networkInstance` - Target network.
|
|
671
664
|
|
|
672
|
-
Returns:
|
|
665
|
+
Returns: Set of unique outgoing connections.
|
|
673
666
|
|
|
674
|
-
###
|
|
667
|
+
### connectLayerPair
|
|
675
668
|
|
|
676
669
|
```ts
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
): default
|
|
670
|
+
connectLayerPair(
|
|
671
|
+
sourceLayer: default[],
|
|
672
|
+
targetLayer: default[],
|
|
673
|
+
): void
|
|
682
674
|
```
|
|
683
675
|
|
|
684
|
-
|
|
676
|
+
Fully connect every source node to every target node.
|
|
685
677
|
|
|
686
678
|
Parameters:
|
|
687
|
-
- `
|
|
688
|
-
- `
|
|
689
|
-
- `outputCount` - Number of output nodes.
|
|
690
|
-
|
|
691
|
-
Returns: Newly instantiated network.
|
|
679
|
+
- `sourceLayer` - Source layer.
|
|
680
|
+
- `targetLayer` - Target layer.
|
|
692
681
|
|
|
693
|
-
###
|
|
682
|
+
### connectMlpLayers
|
|
694
683
|
|
|
695
684
|
```ts
|
|
696
|
-
|
|
697
|
-
networkInstance: default,
|
|
685
|
+
connectMlpLayers(
|
|
698
686
|
mlpNodeLayers: MlpNodeLayers,
|
|
699
687
|
): void
|
|
700
688
|
```
|
|
701
689
|
|
|
702
|
-
|
|
690
|
+
Fully connect each adjacent layer in MLP order.
|
|
703
691
|
|
|
704
692
|
Parameters:
|
|
705
|
-
- `networkInstance` - Target network.
|
|
706
693
|
- `mlpNodeLayers` - Grouped node layers for this MLP.
|
|
707
694
|
|
|
708
|
-
###
|
|
695
|
+
### convertConnectionSetToArray
|
|
709
696
|
|
|
710
697
|
```ts
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
nodeType: "input" | "output" | "hidden",
|
|
698
|
+
convertConnectionSetToArray(
|
|
699
|
+
uniqueConnections: Set<default>,
|
|
714
700
|
): default[]
|
|
715
701
|
```
|
|
716
702
|
|
|
717
|
-
|
|
703
|
+
Convert a connection set into the canonical array format.
|
|
718
704
|
|
|
719
705
|
Parameters:
|
|
720
|
-
- `
|
|
721
|
-
- `nodeType` - Node type identifier.
|
|
706
|
+
- `uniqueConnections` - Unique network connections.
|
|
722
707
|
|
|
723
|
-
Returns:
|
|
708
|
+
Returns: Array of network connections.
|
|
724
709
|
|
|
725
710
|
### createHiddenLayers
|
|
726
711
|
|
|
@@ -737,121 +722,136 @@ Parameters:
|
|
|
737
722
|
|
|
738
723
|
Returns: Hidden layers in forward order.
|
|
739
724
|
|
|
740
|
-
###
|
|
725
|
+
### createMLP
|
|
741
726
|
|
|
742
727
|
```ts
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
728
|
+
createMLP(
|
|
729
|
+
inputCount: number,
|
|
730
|
+
hiddenCounts: number[],
|
|
731
|
+
outputCount: number,
|
|
732
|
+
): default
|
|
746
733
|
```
|
|
747
734
|
|
|
748
|
-
Build
|
|
735
|
+
Build a strictly layered and fully connected MLP network.
|
|
749
736
|
|
|
750
737
|
Parameters:
|
|
751
|
-
- `
|
|
738
|
+
- `this` - Network constructor.
|
|
739
|
+
- `inputCount` - Number of input nodes.
|
|
740
|
+
- `hiddenCounts` - Hidden-layer node counts.
|
|
741
|
+
- `outputCount` - Number of output nodes.
|
|
752
742
|
|
|
753
|
-
Returns:
|
|
743
|
+
Returns: Newly created MLP network.
|
|
754
744
|
|
|
755
|
-
###
|
|
745
|
+
### createMlpNodeLayers
|
|
756
746
|
|
|
757
747
|
```ts
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
748
|
+
createMlpNodeLayers(
|
|
749
|
+
inputCount: number,
|
|
750
|
+
hiddenCounts: number[],
|
|
751
|
+
outputCount: number,
|
|
752
|
+
): MlpNodeLayers
|
|
761
753
|
```
|
|
762
754
|
|
|
763
|
-
|
|
755
|
+
Build input, hidden, and output node layers for an MLP topology.
|
|
764
756
|
|
|
765
757
|
Parameters:
|
|
766
|
-
- `
|
|
758
|
+
- `inputCount` - Number of input nodes.
|
|
759
|
+
- `hiddenCounts` - Hidden-layer node counts.
|
|
760
|
+
- `outputCount` - Number of output nodes.
|
|
767
761
|
|
|
768
|
-
Returns:
|
|
762
|
+
Returns: Grouped node layers for MLP assembly.
|
|
769
763
|
|
|
770
|
-
###
|
|
764
|
+
### createNodesOfType
|
|
771
765
|
|
|
772
766
|
```ts
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
767
|
+
createNodesOfType(
|
|
768
|
+
nodeCount: number,
|
|
769
|
+
nodeType: "input" | "output" | "hidden",
|
|
770
|
+
): default[]
|
|
776
771
|
```
|
|
777
772
|
|
|
778
|
-
|
|
773
|
+
Create all nodes for a single fixed node type.
|
|
779
774
|
|
|
780
775
|
Parameters:
|
|
781
|
-
- `
|
|
776
|
+
- `nodeCount` - Number of nodes to create.
|
|
777
|
+
- `nodeType` - Node type identifier.
|
|
782
778
|
|
|
783
|
-
|
|
779
|
+
Returns: Node list of the requested type.
|
|
780
|
+
|
|
781
|
+
### createOrderedNodeList
|
|
784
782
|
|
|
785
783
|
```ts
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
): void
|
|
784
|
+
createOrderedNodeList(
|
|
785
|
+
mlpNodeLayers: MlpNodeLayers,
|
|
786
|
+
): default[]
|
|
790
787
|
```
|
|
791
788
|
|
|
792
|
-
|
|
789
|
+
Build the canonical ordered node list used by the network.
|
|
793
790
|
|
|
794
791
|
Parameters:
|
|
795
|
-
- `
|
|
796
|
-
- `targetLayer` - Target layer.
|
|
792
|
+
- `mlpNodeLayers` - Grouped node layers for this MLP.
|
|
797
793
|
|
|
798
|
-
|
|
794
|
+
Returns: Ordered node list: input, hidden, then output.
|
|
795
|
+
|
|
796
|
+
### flattenNodeLayers
|
|
799
797
|
|
|
800
798
|
```ts
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
):
|
|
799
|
+
flattenNodeLayers(
|
|
800
|
+
nodeLayers: default[][],
|
|
801
|
+
): default[]
|
|
804
802
|
```
|
|
805
803
|
|
|
806
|
-
|
|
804
|
+
Flatten layered node collections into a single ordered list.
|
|
807
805
|
|
|
808
806
|
Parameters:
|
|
809
|
-
- `
|
|
807
|
+
- `nodeLayers` - Layered node collections.
|
|
810
808
|
|
|
811
|
-
|
|
809
|
+
Returns: Flattened node list.
|
|
810
|
+
|
|
811
|
+
### instantiateNetwork
|
|
812
812
|
|
|
813
813
|
```ts
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
814
|
+
instantiateNetwork(
|
|
815
|
+
networkFactory: NetworkConstructor,
|
|
816
|
+
inputCount: number,
|
|
817
|
+
outputCount: number,
|
|
818
|
+
): default
|
|
817
819
|
```
|
|
818
820
|
|
|
819
|
-
|
|
821
|
+
Instantiate a new network using the runtime constructor.
|
|
820
822
|
|
|
821
823
|
Parameters:
|
|
822
|
-
- `
|
|
824
|
+
- `networkFactory` - Network constructor function.
|
|
825
|
+
- `inputCount` - Number of input nodes.
|
|
826
|
+
- `outputCount` - Number of output nodes.
|
|
823
827
|
|
|
824
|
-
Returns:
|
|
828
|
+
Returns: Newly instantiated network.
|
|
825
829
|
|
|
826
|
-
###
|
|
830
|
+
### markTopologyDirty
|
|
827
831
|
|
|
828
832
|
```ts
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
allConnections: Set<default>,
|
|
833
|
+
markTopologyDirty(
|
|
834
|
+
networkInstance: default,
|
|
832
835
|
): void
|
|
833
836
|
```
|
|
834
837
|
|
|
835
|
-
|
|
838
|
+
Mark a network topology as dirty after structural edits.
|
|
836
839
|
|
|
837
840
|
Parameters:
|
|
838
|
-
- `
|
|
839
|
-
- `allConnections` - Deduplication set for network connections.
|
|
841
|
+
- `networkInstance` - Network instance to mark.
|
|
840
842
|
|
|
841
|
-
###
|
|
843
|
+
### rebuildConnections
|
|
842
844
|
|
|
843
845
|
```ts
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
):
|
|
846
|
+
rebuildConnections(
|
|
847
|
+
networkInstance: default,
|
|
848
|
+
): void
|
|
847
849
|
```
|
|
848
850
|
|
|
849
|
-
|
|
851
|
+
Rebuild the canonical connection array from per-node outgoing lists.
|
|
850
852
|
|
|
851
853
|
Parameters:
|
|
852
|
-
- `
|
|
853
|
-
|
|
854
|
-
Returns: Array of network connections.
|
|
854
|
+
- `networkInstance` - Target network.
|
|
855
855
|
|
|
856
856
|
## architecture/network/topology/network.topology.contract.utils.ts
|
|
857
857
|
|
|
@@ -872,25 +872,6 @@ Parameters:
|
|
|
872
872
|
|
|
873
873
|
Returns: Current topology intent.
|
|
874
874
|
|
|
875
|
-
### setTopologyIntent
|
|
876
|
-
|
|
877
|
-
```ts
|
|
878
|
-
setTopologyIntent(
|
|
879
|
-
topologyIntent: NetworkTopologyIntent,
|
|
880
|
-
): void
|
|
881
|
-
```
|
|
882
|
-
|
|
883
|
-
Set the public topology intent and synchronize low-level runtime flags.
|
|
884
|
-
|
|
885
|
-
Updating the semantic contract also updates acyclic enforcement and marks the
|
|
886
|
-
topological cache dirty so later activation paths rebuild consistent state.
|
|
887
|
-
|
|
888
|
-
Parameters:
|
|
889
|
-
- `this` - Target network instance.
|
|
890
|
-
- `topologyIntent` - Desired topology intent.
|
|
891
|
-
|
|
892
|
-
Returns: Nothing.
|
|
893
|
-
|
|
894
875
|
### setEnforceAcyclic
|
|
895
876
|
|
|
896
877
|
```ts
|
|
@@ -910,77 +891,26 @@ Parameters:
|
|
|
910
891
|
|
|
911
892
|
Returns: Nothing.
|
|
912
893
|
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
### describeArchitecture
|
|
916
|
-
|
|
917
|
-
```ts
|
|
918
|
-
describeArchitecture(
|
|
919
|
-
network: default,
|
|
920
|
-
): NetworkArchitectureDescriptor
|
|
921
|
-
```
|
|
922
|
-
|
|
923
|
-
Describes network architecture for diagnostics, telemetry, and UI rendering.
|
|
924
|
-
|
|
925
|
-
This function prefers factual sources over heuristics so downstream tooling
|
|
926
|
-
can rely on the descriptor while still receiving useful output for partially
|
|
927
|
-
specified runtime graphs.
|
|
928
|
-
|
|
929
|
-
Resolution priority is intentionally explicit:
|
|
930
|
-
1) node `layer` metadata (factual when present)
|
|
931
|
-
2) graph-derived feed-forward depth layering (factual for acyclic graphs)
|
|
932
|
-
3) hidden-node count fallback (heuristic inference)
|
|
933
|
-
|
|
934
|
-
Parameters:
|
|
935
|
-
- `network` - - Runtime network instance.
|
|
936
|
-
|
|
937
|
-
Returns: Stable architecture descriptor.
|
|
938
|
-
|
|
939
|
-
Example:
|
|
940
|
-
|
|
941
|
-
```ts
|
|
942
|
-
const descriptor = describeArchitecture(network);
|
|
943
|
-
// descriptor.hiddenLayerSizes -> [8, 4]
|
|
944
|
-
// descriptor.source -> 'layer-metadata' | 'graph-topology' | 'inferred'
|
|
945
|
-
```
|
|
946
|
-
|
|
947
|
-
### resolveArchitectureDescriptor
|
|
894
|
+
### setTopologyIntent
|
|
948
895
|
|
|
949
896
|
```ts
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
):
|
|
897
|
+
setTopologyIntent(
|
|
898
|
+
topologyIntent: NetworkTopologyIntent,
|
|
899
|
+
): void
|
|
953
900
|
```
|
|
954
901
|
|
|
955
|
-
|
|
956
|
-
falling back to hydrated serialization metadata only when the live result is
|
|
957
|
-
still purely inferred.
|
|
902
|
+
Set the public topology intent and synchronize low-level runtime flags.
|
|
958
903
|
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
descriptor that remains safe to reuse when the runtime graph shape matches.
|
|
904
|
+
Updating the semantic contract also updates acyclic enforcement and marks the
|
|
905
|
+
topological cache dirty so later activation paths rebuild consistent state.
|
|
962
906
|
|
|
963
907
|
Parameters:
|
|
964
|
-
- `
|
|
965
|
-
|
|
966
|
-
Returns: Public architecture descriptor for telemetry and UI consumers.
|
|
967
|
-
|
|
968
|
-
### isHydratedDescriptorCompatible
|
|
969
|
-
|
|
970
|
-
```ts
|
|
971
|
-
isHydratedDescriptorCompatible(
|
|
972
|
-
network: default,
|
|
973
|
-
hydratedDescriptor: NetworkArchitectureDescriptor | undefined,
|
|
974
|
-
): boolean
|
|
975
|
-
```
|
|
976
|
-
|
|
977
|
-
Check whether hydrated descriptor metadata still matches the current graph shape.
|
|
908
|
+
- `this` - Target network instance.
|
|
909
|
+
- `topologyIntent` - Desired topology intent.
|
|
978
910
|
|
|
979
|
-
|
|
980
|
-
- `network` - Runtime network instance.
|
|
981
|
-
- `hydratedDescriptor` - Optional hydrated descriptor candidate.
|
|
911
|
+
Returns: Nothing.
|
|
982
912
|
|
|
983
|
-
|
|
913
|
+
## architecture/network/topology/network.topology.architecture.utils.ts
|
|
984
914
|
|
|
985
915
|
### createArchitectureDescriptor
|
|
986
916
|
|
|
@@ -1015,112 +945,152 @@ const descriptor = createArchitectureDescriptor([6, 3], false, 'graph-topology',
|
|
|
1015
945
|
// descriptor.totalNodes === 14
|
|
1016
946
|
```
|
|
1017
947
|
|
|
1018
|
-
###
|
|
948
|
+
### createDirectedEdgeList
|
|
1019
949
|
|
|
1020
950
|
```ts
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
951
|
+
createDirectedEdgeList(
|
|
952
|
+
runtimeConnections: RuntimeConnectionLike[],
|
|
953
|
+
nodeByIndex: Map<number, RuntimeNodeLike>,
|
|
954
|
+
): { fromIndex: number; toIndex: number; }[]
|
|
1024
955
|
```
|
|
1025
956
|
|
|
1026
|
-
|
|
957
|
+
Produces a validated list of enabled directed edges.
|
|
1027
958
|
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
topological reconstruction.
|
|
959
|
+
Invalid references, disabled connections, and self-loops are removed so the
|
|
960
|
+
remaining edge list can be consumed safely by cycle and depth algorithms.
|
|
1031
961
|
|
|
1032
962
|
Parameters:
|
|
1033
|
-
- `
|
|
963
|
+
- `runtimeConnections` - - Runtime connections.
|
|
964
|
+
- `nodeByIndex` - - Indexed nodes.
|
|
1034
965
|
|
|
1035
|
-
Returns:
|
|
966
|
+
Returns: Valid directed edges.
|
|
1036
967
|
|
|
1037
968
|
Example:
|
|
1038
969
|
|
|
1039
970
|
```ts
|
|
1040
|
-
|
|
1041
|
-
|
|
971
|
+
const edges = createDirectedEdgeList(runtimeConnections, nodeByIndex);
|
|
972
|
+
// edges -> [{ fromIndex: 0, toIndex: 3 }, ...]
|
|
1042
973
|
```
|
|
1043
974
|
|
|
1044
|
-
###
|
|
975
|
+
### createNodeIndexMap
|
|
1045
976
|
|
|
1046
977
|
```ts
|
|
1047
|
-
|
|
978
|
+
createNodeIndexMap(
|
|
1048
979
|
runtimeNodes: RuntimeNodeLike[],
|
|
1049
|
-
|
|
1050
|
-
): { hiddenLayerSizes: number[]; hasCycles: boolean; }
|
|
980
|
+
): Map<number, RuntimeNodeLike>
|
|
1051
981
|
```
|
|
1052
982
|
|
|
1053
|
-
|
|
1054
|
-
metadata is available.
|
|
983
|
+
Builds a node lookup table keyed by stable index.
|
|
1055
984
|
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
is not well-defined in recurrent loops.
|
|
985
|
+
Runtime objects may omit `index`; in that case the current array position is
|
|
986
|
+
used as a deterministic fallback to keep downstream graph logic total.
|
|
1059
987
|
|
|
1060
988
|
Parameters:
|
|
1061
989
|
- `runtimeNodes` - - Runtime nodes.
|
|
1062
|
-
- `runtimeConnections` - - Runtime connections.
|
|
1063
990
|
|
|
1064
|
-
Returns:
|
|
991
|
+
Returns: Node map keyed by stable node index.
|
|
1065
992
|
|
|
1066
993
|
Example:
|
|
1067
994
|
|
|
1068
995
|
```ts
|
|
1069
|
-
const
|
|
996
|
+
const nodeByIndex = createNodeIndexMap(nodes);
|
|
997
|
+
// nodeByIndex.get(0) -> first node or node with explicit index 0
|
|
1070
998
|
```
|
|
1071
999
|
|
|
1072
|
-
###
|
|
1000
|
+
### describeArchitecture
|
|
1073
1001
|
|
|
1074
1002
|
```ts
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
):
|
|
1003
|
+
describeArchitecture(
|
|
1004
|
+
network: default,
|
|
1005
|
+
): NetworkArchitectureDescriptor
|
|
1078
1006
|
```
|
|
1079
1007
|
|
|
1080
|
-
|
|
1008
|
+
Describes network architecture for diagnostics, telemetry, and UI rendering.
|
|
1081
1009
|
|
|
1082
|
-
|
|
1083
|
-
|
|
1010
|
+
This function prefers factual sources over heuristics so downstream tooling
|
|
1011
|
+
can rely on the descriptor while still receiving useful output for partially
|
|
1012
|
+
specified runtime graphs.
|
|
1013
|
+
|
|
1014
|
+
Resolution priority is intentionally explicit:
|
|
1015
|
+
1) node `layer` metadata (factual when present)
|
|
1016
|
+
2) graph-derived feed-forward depth layering (factual for acyclic graphs)
|
|
1017
|
+
3) hidden-node count fallback (heuristic inference)
|
|
1084
1018
|
|
|
1085
1019
|
Parameters:
|
|
1086
|
-
- `
|
|
1020
|
+
- `network` - - Runtime network instance.
|
|
1087
1021
|
|
|
1088
|
-
Returns:
|
|
1022
|
+
Returns: Stable architecture descriptor.
|
|
1089
1023
|
|
|
1090
1024
|
Example:
|
|
1091
1025
|
|
|
1092
1026
|
```ts
|
|
1093
|
-
const
|
|
1094
|
-
//
|
|
1027
|
+
const descriptor = describeArchitecture(network);
|
|
1028
|
+
// descriptor.hiddenLayerSizes -> [8, 4]
|
|
1029
|
+
// descriptor.source -> 'layer-metadata' | 'graph-topology' | 'inferred'
|
|
1095
1030
|
```
|
|
1096
1031
|
|
|
1097
|
-
###
|
|
1032
|
+
### isHiddenNode
|
|
1098
1033
|
|
|
1099
1034
|
```ts
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
): { fromIndex: number; toIndex: number; }[]
|
|
1035
|
+
isHiddenNode(
|
|
1036
|
+
runtimeNode: RuntimeNodeLike,
|
|
1037
|
+
): boolean
|
|
1104
1038
|
```
|
|
1105
1039
|
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
Invalid references, disabled connections, and self-loops are removed so the
|
|
1109
|
-
remaining edge list can be consumed safely by cycle and depth algorithms.
|
|
1040
|
+
Identifies whether a runtime node should be treated as hidden for topology
|
|
1041
|
+
reconstruction and fallback inference.
|
|
1110
1042
|
|
|
1111
1043
|
Parameters:
|
|
1112
|
-
- `
|
|
1113
|
-
- `nodeByIndex` - - Indexed nodes.
|
|
1044
|
+
- `runtimeNode` - - Candidate node.
|
|
1114
1045
|
|
|
1115
|
-
Returns:
|
|
1046
|
+
Returns: True when node type is hidden.
|
|
1116
1047
|
|
|
1117
1048
|
Example:
|
|
1118
1049
|
|
|
1119
1050
|
```ts
|
|
1120
|
-
|
|
1121
|
-
//
|
|
1051
|
+
if (isHiddenNode(node)) {
|
|
1052
|
+
// Include in hidden-layer counting
|
|
1053
|
+
}
|
|
1054
|
+
```
|
|
1055
|
+
|
|
1056
|
+
### isHydratedDescriptorCompatible
|
|
1057
|
+
|
|
1058
|
+
```ts
|
|
1059
|
+
isHydratedDescriptorCompatible(
|
|
1060
|
+
network: default,
|
|
1061
|
+
hydratedDescriptor: NetworkArchitectureDescriptor | undefined,
|
|
1062
|
+
): boolean
|
|
1063
|
+
```
|
|
1064
|
+
|
|
1065
|
+
Check whether hydrated descriptor metadata still matches the current graph shape.
|
|
1066
|
+
|
|
1067
|
+
Parameters:
|
|
1068
|
+
- `network` - Runtime network instance.
|
|
1069
|
+
- `hydratedDescriptor` - Optional hydrated descriptor candidate.
|
|
1070
|
+
|
|
1071
|
+
Returns: True when hydrated descriptor can safely stand in for the inferred result.
|
|
1072
|
+
|
|
1073
|
+
### resolveArchitectureDescriptor
|
|
1074
|
+
|
|
1075
|
+
```ts
|
|
1076
|
+
resolveArchitectureDescriptor(
|
|
1077
|
+
network: default,
|
|
1078
|
+
): NetworkArchitectureDescriptor
|
|
1122
1079
|
```
|
|
1123
1080
|
|
|
1081
|
+
Resolve the public architecture descriptor, preferring live graph facts and
|
|
1082
|
+
falling back to hydrated serialization metadata only when the live result is
|
|
1083
|
+
still purely inferred.
|
|
1084
|
+
|
|
1085
|
+
This helper keeps the descriptor ownership story in one chapter: topology
|
|
1086
|
+
owns the live analysis while serialization can optionally hydrate a cached
|
|
1087
|
+
descriptor that remains safe to reuse when the runtime graph shape matches.
|
|
1088
|
+
|
|
1089
|
+
Parameters:
|
|
1090
|
+
- `network` - Runtime network instance.
|
|
1091
|
+
|
|
1092
|
+
Returns: Public architecture descriptor for telemetry and UI consumers.
|
|
1093
|
+
|
|
1124
1094
|
### resolveCycleStateAndTopoOrder
|
|
1125
1095
|
|
|
1126
1096
|
```ts
|
|
@@ -1148,80 +1118,110 @@ Example:
|
|
|
1148
1118
|
const { topologicalOrder, hasCycles } = resolveCycleStateAndTopoOrder(nodeByIndex, edges);
|
|
1149
1119
|
```
|
|
1150
1120
|
|
|
1151
|
-
###
|
|
1121
|
+
### resolveHiddenCountsByDepth
|
|
1152
1122
|
|
|
1153
1123
|
```ts
|
|
1154
|
-
|
|
1124
|
+
resolveHiddenCountsByDepth(
|
|
1155
1125
|
nodeByIndex: Map<number, RuntimeNodeLike>,
|
|
1156
|
-
|
|
1157
|
-
topologicalOrder: number[],
|
|
1126
|
+
depthByNodeIndex: Map<number, number>,
|
|
1158
1127
|
): Map<number, number>
|
|
1159
1128
|
```
|
|
1160
1129
|
|
|
1161
|
-
|
|
1130
|
+
Aggregates hidden-node counts per derived depth.
|
|
1162
1131
|
|
|
1163
|
-
|
|
1164
|
-
|
|
1132
|
+
This is the final transformation before emitting architecture widths:
|
|
1133
|
+
hidden nodes are grouped by depth and counted in insertion-safe maps.
|
|
1165
1134
|
|
|
1166
1135
|
Parameters:
|
|
1167
1136
|
- `nodeByIndex` - - Indexed nodes.
|
|
1168
|
-
- `
|
|
1169
|
-
- `topologicalOrder` - - Acyclic topological order.
|
|
1137
|
+
- `depthByNodeIndex` - - Derived depths.
|
|
1170
1138
|
|
|
1171
|
-
Returns:
|
|
1139
|
+
Returns: Hidden-node counts by depth.
|
|
1172
1140
|
|
|
1173
1141
|
Example:
|
|
1174
1142
|
|
|
1175
1143
|
```ts
|
|
1176
|
-
const
|
|
1144
|
+
const hiddenCountsByDepth = resolveHiddenCountsByDepth(nodeByIndex, depthByNodeIndex);
|
|
1177
1145
|
```
|
|
1178
1146
|
|
|
1179
|
-
###
|
|
1147
|
+
### resolveHiddenLayerSizesFromGraphTopology
|
|
1180
1148
|
|
|
1181
1149
|
```ts
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
):
|
|
1150
|
+
resolveHiddenLayerSizesFromGraphTopology(
|
|
1151
|
+
runtimeNodes: RuntimeNodeLike[],
|
|
1152
|
+
runtimeConnections: RuntimeConnectionLike[],
|
|
1153
|
+
): { hiddenLayerSizes: number[]; hasCycles: boolean; }
|
|
1186
1154
|
```
|
|
1187
1155
|
|
|
1188
|
-
|
|
1156
|
+
Derives hidden-layer widths from graph topology when no explicit layer
|
|
1157
|
+
metadata is available.
|
|
1189
1158
|
|
|
1190
|
-
|
|
1191
|
-
|
|
1159
|
+
The method computes a topological depth model for acyclic graphs; cyclic
|
|
1160
|
+
graphs are flagged and intentionally return no width inference because depth
|
|
1161
|
+
is not well-defined in recurrent loops.
|
|
1192
1162
|
|
|
1193
1163
|
Parameters:
|
|
1194
|
-
- `
|
|
1195
|
-
- `
|
|
1164
|
+
- `runtimeNodes` - - Runtime nodes.
|
|
1165
|
+
- `runtimeConnections` - - Runtime connections.
|
|
1196
1166
|
|
|
1197
|
-
Returns: Hidden-
|
|
1167
|
+
Returns: Hidden-layer widths derived from acyclic topology and cycle flag.
|
|
1198
1168
|
|
|
1199
1169
|
Example:
|
|
1200
1170
|
|
|
1201
1171
|
```ts
|
|
1202
|
-
const
|
|
1172
|
+
const { hiddenLayerSizes, hasCycles } = resolveHiddenLayerSizesFromGraphTopology(nodes, edges);
|
|
1203
1173
|
```
|
|
1204
1174
|
|
|
1205
|
-
###
|
|
1175
|
+
### resolveHiddenLayerSizesFromLayerMetadata
|
|
1206
1176
|
|
|
1207
1177
|
```ts
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
):
|
|
1178
|
+
resolveHiddenLayerSizesFromLayerMetadata(
|
|
1179
|
+
runtimeNodes: RuntimeNodeLike[],
|
|
1180
|
+
): number[]
|
|
1211
1181
|
```
|
|
1212
1182
|
|
|
1213
|
-
|
|
1214
|
-
|
|
1183
|
+
Resolves hidden-layer widths from explicit `node.layer` metadata.
|
|
1184
|
+
|
|
1185
|
+
This is treated as the most trustworthy source because layer assignment is
|
|
1186
|
+
usually produced by architecture-aware builders and does not depend on
|
|
1187
|
+
topological reconstruction.
|
|
1215
1188
|
|
|
1216
1189
|
Parameters:
|
|
1217
|
-
- `
|
|
1190
|
+
- `runtimeNodes` - - Runtime nodes.
|
|
1218
1191
|
|
|
1219
|
-
Returns:
|
|
1192
|
+
Returns: Hidden-layer widths from explicit node.layer metadata.
|
|
1220
1193
|
|
|
1221
1194
|
Example:
|
|
1222
1195
|
|
|
1223
1196
|
```ts
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1197
|
+
// Hidden nodes in layers 1, 1, and 2 -> [2, 1]
|
|
1198
|
+
const sizes = resolveHiddenLayerSizesFromLayerMetadata(nodes);
|
|
1199
|
+
```
|
|
1200
|
+
|
|
1201
|
+
### resolveNodeDepthByIndex
|
|
1202
|
+
|
|
1203
|
+
```ts
|
|
1204
|
+
resolveNodeDepthByIndex(
|
|
1205
|
+
nodeByIndex: Map<number, RuntimeNodeLike>,
|
|
1206
|
+
directedEdges: { fromIndex: number; toIndex: number; }[],
|
|
1207
|
+
topologicalOrder: number[],
|
|
1208
|
+
): Map<number, number>
|
|
1209
|
+
```
|
|
1210
|
+
|
|
1211
|
+
Computes node depth (feed-forward distance from inputs) for an acyclic graph.
|
|
1212
|
+
|
|
1213
|
+
Depth assignment is parent-driven: each node depth is one plus the maximum
|
|
1214
|
+
resolved parent depth. Nodes with no resolved parents are skipped.
|
|
1215
|
+
|
|
1216
|
+
Parameters:
|
|
1217
|
+
- `nodeByIndex` - - Indexed nodes.
|
|
1218
|
+
- `directedEdges` - - Directed edges.
|
|
1219
|
+
- `topologicalOrder` - - Acyclic topological order.
|
|
1220
|
+
|
|
1221
|
+
Returns: Derived depth by node index.
|
|
1222
|
+
|
|
1223
|
+
Example:
|
|
1224
|
+
|
|
1225
|
+
```ts
|
|
1226
|
+
const depthByNodeIndex = resolveNodeDepthByIndex(nodeByIndex, edges, topologicalOrder);
|
|
1227
1227
|
```
|