File size: 38,684 Bytes
6fbb45f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
---

license: mit
pretty_name: Semantic Potential Routing Telemetry
language:
- en
task_categories:
- time-series-forecasting
- tabular-regression
- graph-ml
tags:
- networking
- routing
- graph-theory
- operations-research
- physics-based-simulation
- telemetry
- microbursts
- data-center-networks
- benchmark
- synthetic
size_categories:
- 100M<n<1B
configs:
- config_name: router_summary
  data_files: data/router_summary/*.parquet
- config_name: flow_summary
  data_files: data/flow_summary/*.parquet
- config_name: episodes
  data_files: data/episodes/*.parquet
- config_name: events
  data_files: data/events/*.parquet
- config_name: network_telemetry
  data_files: data/network_telemetry/*.parquet
- config_name: flow_telemetry
  data_files: data/flow_telemetry/*.parquet
- config_name: link_telemetry
  data_files: data/link_telemetry/*.parquet
- config_name: potential_field
  data_files: data/potential_field/*.parquet
---


# Semantic Potential Routing Telemetry

**Version 2.0** — a systematic, packet-level benchmark of **training-free potential-field routing** against
classical routing under stochastic congestion, dynamic topologies and microburst traffic.

Every episode is a network simulation in which routing is a physical field: each flow's destination is the
grounded, attractive well of a discrete Poisson equation on the graph Laplacian, congested buffers inject
repulsive current, and packets follow the resulting routing gradient without any learned weights. The same
episode — identical topology, failure timeline and packet arrivals — is replayed under **six routers**: three
potential-field variants (steepest descent, proportional multipath splitting, and a static ablation without
congestion feedback) and three classical baselines (static shortest path, equal-cost multipath, and
queue-aware adaptive shortest path). Episodes are laid out on a **full factorial design** over topology
family, network size, traffic profile, offered load and topology dynamics, so every effect can be studied
in isolation, and the recorded telemetry is step-resolved: buffer occupancy and drops of every node, load of
every directed link, per-flow delivery and delay, and the potential field itself.

Everything is generated on CPU with linear algebra and a vectorised queueing simulator: no GPU, no
training, no external data. The generator ships in this repository, and any episode can be re-created bit
for bit from `data/config.json` and its episode id.

## Experimental design

Episodes belong to the cells of a five-factor factorial design (`src/design.py`). With the default 10
replicates per cell the dataset holds **5 × 4 × 3 × 3 × 3 = 540 cells and 5,400 episodes**, each replayed
under all six routers.

| Factor | Levels | Meaning |
|---|---|---|
| `topology` | `barabasi_albert`, `watts_strogatz`, `erdos_renyi`, `waxman`, `fat_tree` | scale-free (router-level Internet), small-world, random, geometric ISP-like (distance latencies, coordinates), k-ary data-centre fabric (hosts are the endpoints, 2:1 oversubscribed edge) |
| `size` | 32, 64, 128, 256 | nominal node count; fat-trees use k = 4, 6, 8, 10 (36, 99, 208, 375 nodes) |
| `traffic_profile` | `poisson`, `microburst`, `sustained` | stationary Poisson; short intense bursts (peak/idle 16, mean 15-step bursts, 13 % duty); long moderate surges (peak/idle 4, 50 % duty) |
| `load_level` | `light`, `moderate`, `heavy` | offered load ρ = 0.01, 0.03, 0.10 of the network's directed link capacity (defined below) |
| `dynamics_level` | `static`, `moderate`, `severe` | no events; link failures and node degradations at 0.002/step each lasting 50–200 steps; 0.01/step lasting 100–400 steps |

Episode `e` maps deterministically to cell `e mod 540` and replicate `e div 540`, so any prefix of the
episode range — including a partially generated or resumed dataset — covers all cells evenly. Replicates
are assigned to splits by `replicate mod 5`: 0–2 train, 3 validation, 4 test (60/20/20), recorded in
`episodes.split`. Random families are generated at a common mean degree of 6, so network size is the only
structural quantity that changes with the size factor.

## Tables

The dataset is a relational schema of eight Parquet tables, one folder each under `data/`, sharded by
episode (`part-00000.parquet`, …) and served as separate configurations on the Hub, so you download only
what you need. Node ids are `0 … n_nodes−1`, flows `0 … n_flows−1`, and one step is one millisecond of
simulated time. Every telemetry row carries `episode_id`, `router` and `step`.

**`episodes`** — one row per episode: design cell (`cell_id`, `replicate`, `split`, `topology`, `size`,
`traffic_profile`, `load_level`, `dynamics_level`), dimensions (`n_nodes`, `n_edges`, `n_flows`,
`tracked_flows`, `steps`, `field_stride`), `offered_load` (ρ) and `total_capacity` (Σ directed link
capacity), the static graph (`edge_u`, `edge_v` with `u < v` in a fixed order; per-link `capacity` in
packets/step and `latency` in steps; `node_role` 0 router / 1 core / 2 aggregation / 3 edge / 4 host;
`node_x`, `node_y` for Waxman graphs, empty otherwise) and the flows (`flow_source`, `flow_sink`,
`flow_mean_rate`, `flow_idle_rate`, `flow_burst_rate`, plus the MMPP transition probabilities
`p_idle_to_burst`, `p_burst_to_idle`, zero for the Poisson profile).

**`events`** — one row per topology event, active for `start <= step < end`: `kind` (`link_failure`: the
link's capacity is 0; `node_degradation`: all links of `node` are scaled by `factor`), `edge_u`/`edge_v` or
`node` (−1 where not applicable).

**`router_summary`** — one row per (episode, router): `offered`, `delivered`, `dropped`, `in_flight`,

`loss_ratio`, `mean_delay`, `p99_delay`, `mean_queue`, `max_queue`, `link_utilisation` (packets forwarded /

directed link capacity over all link-steps), `link_saturation` (fraction of directed link-steps at full

capacity), `route_changes` (next-hop table entries that changed, summed over steps and flows).



**`flow_summary`** — one row per (episode, router, flow): `source`, `sink`, `mean_rate`, `min_hops`,
`min_latency` (shortest path on the base graph), `offered`, `delivered`, `dropped`, `in_flight`,
`loss_ratio`, `mean_delay`, `delay_std`, `p50_delay`, `p95_delay`, `p99_delay`, `max_delay`,
`mean_queueing_delay`, `mean_path_latency` (delay = queueing + propagation), `mean_hops`, `route_changes`.

**`network_telemetry`** — one row per (episode, router, step): network totals `offered`, `admitted`,

`delivered`, `dropped`, `queued`, `in_transit`, `mean_delay` (of packets delivered this step, NaN if none),

`route_changes`, and two lists of length `n_nodes`: `queue_depth` (buffer occupancy after the step's

arrivals were admitted and before forwarding, i.e. what the router sees) and `node_dropped`.



**`flow_telemetry`** — one row per (episode, router, step, tracked flow) for the first `tracked_flows` (8)
flows of every episode: `mmpp_state` (0 idle, 1 burst), `offered`, `admitted`, `delivered`, `dropped`,
`queued`, `in_transit`, `mean_delay`, `route_changes`.

**`link_telemetry`** — one row per (episode, router, step): `load_uv` and `load_vu`, lists of length

`n_edges` with the packets forwarded over each link in the `u → v` and `v → u` directions.



**`potential_field`** — one row per logged step of the `potential` router: `potential`, a list of
`tracked_flows × n_nodes` float32 values, flow-major, with φ = 0 at each flow's sink. Steps are logged every
`field_stride` steps (2 for 32-node graphs, 12 for the largest fat-trees) so that each episode's field
stays within 1 MB; any step and any flow can be recomputed exactly from the other tables (see below).

With the defaults, `flow_telemetry` holds about 260 M rows (5,400 episodes × 6 routers × 1,000 steps × 8
tracked flows) and `network_telemetry` and `link_telemetry` 32.4 M each; the whole dataset is roughly 20 GB,
three quarters of it the two per-step list tables. The summary tables are a few hundred MB and answer most
benchmark questions on their own. **None of the step-level tables fits in memory** — read them with column
projection and `episode_id` / `router` filters, or stream them shard by shard as
`scripts/validate_dataset.py` does.

All list columns (`queue_depth`, `node_dropped`, `load_uv`, `load_vu`, `capacity`, `latency`, …) are
**int16** to keep the files small. Widen them before arithmetic — `np.stack(net.queue_depth) * 160`
silently overflows, `np.stack(net.queue_depth).astype(float) * 160` does not.

## Simulation model

**Topologies.** Barabási–Albert (m = 3), connected Watts–Strogatz (k = 6, p = 0.1) and Erdős–Rényi
(p = 6/(n−1)) graphs; Waxman graphs with uniformly random coordinates in the unit square and link
preference exp(−d / 0.15√2), drawn with an exact edge count for mean degree 6 and latency proportional to
distance; and k-ary fat-trees (k²/4 core, k² pod switches, k³/4 hosts) with 40 packets/step fabric links
and 80 packets/step host links. Random-graph links have integer capacities uniform in 8–80 packets/step
(≈ 100–1 000 Mb/s for 1 500-byte packets at 1 ms steps) and latencies uniform in 1–10 steps. A disconnected
Erdős–Rényi or Waxman sample is stitched into one component by joining each stray component to the main
one (closest pair of nodes for geometric graphs), which adds on average fewer than 0.2 links per graph
below 128 nodes and about one link per graph at 256 nodes, so the node count is always the nominal one.

**Dynamics.** Independently each step a link fails or a node degrades with the level's probability; failed
links are chosen only among the non-bridge links of the live graph, so the network never partitions and the
question of interest — how quickly traffic routes around the damage — is always well posed. A degraded node
multiplies the capacity of all its links by a factor in 0.1–0.5. Effective capacities are
`max(1, ⌊capacity × factor_u × factor_v⌋)`, or 0 while failed, and follow from `episodes` + `events`.

**Traffic.** Each episode has two flows per endpoint node between distinct ordered (source, sink) pairs.
Per-flow mean rates are log-normal (σ = 0.75, elephants and mice) and rescaled so that the offered load
`ρ = Σ_f m_f · hops_f / Σ_links capacity` — the share of the network's directed capacity the flows would
occupy on their shortest paths — equals the cell's level exactly. Each flow is a two-state Markov-modulated
Poisson process whose idle and burst rates are derived from its mean rate and the profile's peak ratio and
duty cycle, so profiles differ in burstiness at equal long-run load.

**Queueing.** Every node owns one drop-tail FIFO buffer of 256 packets shared by all flows. Each step, in
order: new packets are created at their sources; packets reaching a node this step are delivered if the
node is their sink, otherwise admitted oldest-first while space remains, the rest dropped; buffers are
logged and routing decisions taken; then every directed link forwards, oldest first, up to its capacity of
the packets whose next hop crosses it (virtual output queueing, no head-of-line blocking). A packet
forwarded at step `t` over a link of latency ℓ arrives at `t + ℓ`, so delay is propagation plus queueing,
and a packet already on the wire is unaffected by a failure of that link. Traffic is open-loop: there is no
congestion control, which is what makes the routers' behaviour under overload comparable.

## Routers

| router | decision | recomputed | capacity-aware | congestion-aware | multipath |
|---|---|---|---|---|---|
| `potential` | link with the largest current I_ij = w_ij(φ_i − φ_j) | every step | yes | yes | no |
| `potential_split` | packets sprayed in proportion to the positive currents | every step | yes | yes | yes |
| `potential_static` | largest current of the field without congestion injection | topology change | yes | no | no |
| `shortest_path` | Dijkstra on latency (OSPF-like) | topology change | no | no | no |
| `ecmp` | round-robin over all equal-latency shortest-path next hops | topology change | no | no | yes |
| `adaptive_shortest_path` | Dijkstra on latency + queue / capacity, quantised to 10⁻⁶ steps (ARPANET-style) | every step | partly | yes | no |

**Potential field.** For flow *f* with source *s* and sink *t*,

```

L_g φ = b,   L = D − W,   w_ij = capacity_ij / latency_ij   (live links only)

b_i = source_injection · [i = s] + background_injection / (N − 1) + congestion_gain · queue_i / buffer_size

```

where `L_g` is the weighted graph Laplacian with the sink's row and column removed — the Dirichlet condition
φ_t = 0 that makes the sink the grounded well of the field (defaults 1.0, 0.5 and 2.0). The grounded inverse

is available in closed form from the Laplacian pseudo-inverse, `(L_g⁻¹)_ij = L⁺_ij − L⁺_it − L⁺_tj + L⁺_tt`,

and because the background and congestion injections are shared by all flows, the fields of all flows follow

from one matrix–vector product with L⁺ plus O(N) work per flow; L⁺ is formed once per topology change. On

every live directed link the current is I_ij = w_ij(φ_i − φ_j). Since b_i > 0 at every non-sink node,
Σ_j I_ij = b_i > 0: at least one current is positive and every positive-current link leads strictly

downhill, so both potential rules are loop-free and reach the sink in at most N − 1 hops for *any*

congestion pattern — congestion bends routes but can never trap a packet. Proportional splitting is the

physically faithful rule (electrical current divides over parallel paths); it uses a low-discrepancy

per-packet coordinate so that the split is exact and the simulation stays deterministic.



**Baselines.** `shortest_path` is the classic link-state behaviour, blind to capacity and queues but
reacting to failures. `ecmp` spreads packets over all equal-cost paths, the data-centre default. The
adaptive baseline recomputes Dijkstra each step with link cost latency + queue/capacity, the queue-aware
policy that famously oscillates; its `route_changes` make that visible. Together with `potential_static`,
the suite separates the value of capacity awareness, congestion awareness and multipath.

On the defaults, at moderate load with microbursts, mean loss over episodes is about 1 % for `potential`,
under 0.5 % for `potential_split` and `adaptive_shortest_path`, 2–3 % for `potential_static` and around
10 % for `shortest_path` and `ecmp`. At heavy load every router loses packets: a few percent for the
adaptive ones, about 20 % for the static potential field and a third or more for shortest path and ECMP.
The multipath and static potential variants pay for their robustness with longer paths (path stretch
about 1.4–1.5 against 1.2 for the others), and the adaptive routers change next hops several orders of
magnitude more often than the static baselines.

## Generating the dataset

Any Python ≥ 3.9 environment works; the commands below are written with forward slashes, which both
PowerShell and POSIX shells accept.

```bat

cd "<path to this repository>"

pip install -r requirements.txt

```

Check the whole pipeline end to end in about a minute — fifteen short episodes covering every topology
family, traffic profile and router in a temporary folder that is deleted afterwards:

```bat

python scripts/run_local_sweep.py --smoke

```

Generate the dataset (5,400 episodes on every logical core, shards of 40 episodes streamed to `data/`):

```bat

python scripts/run_local_sweep.py

```

An episode costs roughly 3–7 s of CPU at size 32, 6–13 s at 64, 20–35 s at 128 and 60–100 s at 256
(six routers, 1 000 steps; heavier load and larger fabrics cost more), i.e. about 4–5 CPU-hours per
replicate: expect the default run to take **one night on an 8-core laptop** and to write about 20 GB.
Keep the machine plugged in with sleep disabled. The sweep
prints progress with an ETA, and if it is interrupted, running the same command again resumes with the
missing shards; when it finishes it writes `data/manifest.json` (provenance, coverage, table sizes) and
prints the router benchmark. `data/config.json` binds the folder to its configuration, so a changed setting
must go to another `--out` folder.

Every design level and model knob is a flag (`python scripts/run_local_sweep.py --help`). A half-size run
with exact 60/20/20 splits, a smaller design, or a potential-field-only run:

```bat

python scripts/run_local_sweep.py --replicates 5

python scripts/run_local_sweep.py --sizes 32,64 --topologies barabasi_albert,fat_tree --out data_small

python scripts/run_local_sweep.py --routers potential,shortest_path --out data_pair

```

Requirements: Python ≥ 3.9 with NumPy, SciPy, pandas, PyArrow, NetworkX, huggingface_hub and, for the

figures, Matplotlib (`requirements.txt`). Workers use one BLAS thread each; all parallelism comes from the

process pool.



## Validating a generated dataset



`scripts/validate_dataset.py` is the test suite of a data folder. It re-derives every quantity it can from
an independent path and compares, rather than merely re-reading what the generator wrote:

```bat

python scripts/validate_dataset.py                                :: validates data/

python scripts/validate_dataset.py --out data_small --resimulate 5

```

| Group | What is checked |
|---|---|
| Structure | every table has the same number of shards; `manifest.json` present |
| Design coverage | all cells present, replicates balanced to ±1, episode ids unique, the three splits present |
| Invariants | `offered = delivered + dropped + in_flight`; loss ratio in [0, 1]; `mean_delay ≥ min_latency` and `mean_hops ≥ min_hops`; delay quantiles ordered; `mean_delay = mean_queueing_delay + mean_path_latency`; `flow_summary` sums to `router_summary`; `network_telemetry` and `flow_telemetry` sum to their summaries per (episode, router[, flow]); `admitted ≤ offered` on every step; link utilisation and saturation in [0, 1] |
| Physical bounds (sampled episodes) | buffer occupancy within `buffer_size`; per-node drops sum to the step total; link loads never exceed the capacity in force at that step (recomputed from `episodes` + `events`); potentials non-negative and exactly 0 at each flow's sink |
| Reproducibility | sampled episodes re-simulated from `config.json` alone and compared **bit for bit**, every table and column (NaN equal to NaN) |
| Field reconstruction | one stored `potential_field` snapshot recovered from the graph state and queue depths with the sparse SuperLU reference solver, independent of the pseudo-inverse path used by the generator |

Sampled episodes are the smallest, the largest and one drawn at random (`--seed`); `--resimulate` sets how
many are re-simulated. Every line is printed as `[ok ]` or `[FAIL]`, the script exits **1** with a summary
of the failures if anything is wrong, and a failing cross-table sum names the first group that differs
(abridged output of a full default run):

```

Structure

  [ok ] 135 shards present

  [ok ] every table has every shard

  [ok ] manifest.json present

Design coverage

  [ok ] all 540 design cells present

  [ok ] balanced: 10-10 episodes per cell

  [ok ] episode ids unique

  [ok ] splits present: ['test', 'train', 'validation']

Invariants

  [ok ] flow conservation: offered = delivered + dropped + in-flight

  ...

  [ok ] tracked-flow telemetry sums to the flow summary

  [ok ] admitted <= offered

Physical bounds (sampled episodes)

  [ok ] episode 0: queue depths within the buffer

  [ok ] episode 0: link loads never exceed the capacity in force

  [ok ] episode 0: potentials non-negative and zero at the sinks

Reproducibility (re-simulating from config.json)

  [ok ] episode 0: every table reproduced bit for bit

Potential-field reconstruction (sparse reference solver)

  [ok ] episode 0, step 100: stored field matches the sparse solve (max rel err 4.5e-08)



Dataset v2.0: 5400 episodes, 20.14 GB

All checks passed.

```

**Memory.** The cross-table checks never load a step-level table. The shards are scanned one record batch
at a time (`--batch-rows`, default 262,144) and folded into a dense accumulator whose size is fixed by the
design — episodes × routers × tracked flows, about 260 k slots — not by the 260 M rows being read. Peak
resident memory is therefore flat in dataset size: **well under 1 GB** for the full 20 GB dataset, of which
the PyArrow buffers are about 20 MB. The invariant pass costs roughly a minute per 10 GB on one core; the
re-simulation of a few episodes dominates the total runtime.

A quick end-to-end rehearsal of generation *and* validation, in about two minutes:

```bat

python scripts/run_local_sweep.py --out data_tiny --sizes 32 --replicates 5 --steps 200 --shard_episodes 25

python scripts/validate_dataset.py --out data_tiny

python examples/benchmark_routers.py --data data_tiny

```

## Using the data

```python

import numpy as np, pandas as pd



rs = pd.read_parquet("data/router_summary")

ep = pd.read_parquet("data/episodes").set_index("episode_id")

df = rs.join(ep[["topology", "size", "traffic_profile", "load_level", "dynamics_level", "split"]], on="episode_id")

print(df.pivot_table(index=["traffic_profile", "load_level"], columns="router", values="loss_ratio"))



# One episode, step by step

eid = 7

net = pd.read_parquet("data/network_telemetry", filters=[("episode_id", "=", eid), ("router", "=", "potential")]).sort_values("step")

queue = np.stack(net.queue_depth).astype(np.int32)                   # (steps, n_nodes); int16 on disk

link = pd.read_parquet("data/link_telemetry", filters=[("episode_id", "=", eid), ("router", "=", "potential")]).sort_values("step")

load = np.stack(link.load_uv).astype(np.int32) + np.stack(link.load_vu)   # (steps, n_edges), both directions

field = pd.read_parquet("data/potential_field", filters=[("episode_id", "=", eid)]).sort_values("step")

row = ep.loc[eid]

phi = np.stack(field.potential).reshape(-1, row.tracked_flows, row.n_nodes)   # (snapshots, tracked flows, nodes)

```

The graph state at any step — the N × N capacity matrix in force — follows from `episodes` and `events`:

```python

def capacity_matrix(row, events, step):

    cap = row.capacity.astype(float).copy()

    factor, failed = np.ones(row.n_nodes), np.zeros(len(cap), bool)

    for e in events[(events.start <= step) & (step < events.end)].itertuples():

        if e.kind == "node_degradation":

            factor[e.node] *= e.factor

        else:

            failed |= (row.edge_u == e.edge_u) & (row.edge_v == e.edge_v)

    cap = np.maximum(1, np.floor(cap * factor[row.edge_u] * factor[row.edge_v]))

    cap[failed] = 0

    A = np.zeros((row.n_nodes, row.n_nodes))

    A[row.edge_u, row.edge_v] = A[row.edge_v, row.edge_u] = cap

    return A



events = pd.read_parquet("data/events", filters=[("episode_id", "=", eid)])

A = capacity_matrix(row, events, step=500)

```

The same reconstruction, the telemetry of any router and an exact recomputation of the field of any flow at
any step are one call each in the read API:

```python

from src.dataset import Dataset



ds = Dataset("data")

ep = ds.episode(7)

A = ep.capacity_matrix(500)                       # the graph state at step 500

queue = ep.queue_depth("potential")               # (steps, n_nodes)

phi = ep.solve_field(500, flows=[0, 1, 2])         # exact field of any flows at any step

path = ep.descent_path(500, phi[0], ep.source[0], ep.sink[0])

```

`scripts/validate_dataset.py` checks such recomputations against the sparse SuperLU reference solver. From
the Hub, each table is a configuration:

```python

from datasets import load_dataset

rs = load_dataset("<user>/<dataset>", "router_summary", split="train")

```

Suggested uses: benchmarking routing policies on identical scenarios; forecasting queue build-up, drops
or link saturation from step-level telemetry (`network_telemetry`, `link_telemetry`); learning graph
surrogates of the potential field or of the routers' next-hop decisions (`potential_field` plus the graph
state); studying route flapping of adaptive policies (`route_changes`); and out-of-distribution evaluation
across topology families, sizes or dynamics levels using the factor columns of `episodes`.

## Examples

`examples/` holds four scripts written against the small read API in `src/dataset.py``Dataset(path)`
opens a data folder, `ds.table(name, columns, filters)` and `ds.summary(name)` return tables (the latter
joined with the design factors and split), and `ds.episode(id)` bundles one episode: its graph, event
timeline and flows, the capacities in force at any step (`capacity_at`, `live_graph`, `capacity_matrix`),
its telemetry under any router (`queue_depth`, `node_dropped`, `link_load`, `link_utilisation`), the stored
field (`field`) and an exact recomputation of the field of *any* flow at *any* step (`solve_field`,
`next_hops`, `descent_path`). Every script runs on `data/` by default (`--data` selects another folder),
prints its results, asserts the properties it relies on and ends with "All checks passed", so the set also
serves as a usage test of a generated dataset.

```bat

python examples/benchmark_routers.py        :: paired router comparison with bootstrap intervals, per factor

python examples/inspect_episode.py --episode 7 --step 500

python examples/forecast_congestion.py      :: ridge forecast of near-term loss on the splits

python examples/visualize.py                :: eight figures into figures/

```

### `benchmark_routers.py` — paired router comparison



Compares every router with a reference (`--reference`, default `shortest_path`) on the identical episodes:
mean loss and delay differences with 95 % bootstrap confidence intervals, win and tie rates, the loss ratio
broken down by each design factor, and flow-level path stretch, latency stretch and queueing delay.
`--csv figures/benchmark.csv` writes the per-episode joined summary. Abridged output:

```

Paired differences to 'shortest_path' (negative = better; bootstrap 95 % CI over episodes):

                        episodes  loss_diff  loss_ci_low  loss_ci_high  wins_loss  delay_diff  wins_delay

router

adaptive_shortest_path       675    -0.0770      -0.0863       -0.0681     0.4593     -0.8561      0.5837

ecmp                         675    -0.0082      -0.0107       -0.0059     0.3096     -0.1613      0.5244

potential                    675    -0.0685      -0.0766       -0.0601     0.4607      0.3886      0.3615

potential_split              675    -0.0828      -0.0924       -0.0734     0.4637      2.6682      0.1630

potential_static             675    -0.0409      -0.0472       -0.0352     0.4074      1.0377      0.1733



Flow level (flows with at least one delivered packet):

                        flows  lossless_share  path_stretch  latency_stretch  queueing_delay  p99_delay

potential               38879          0.9174        1.2646           1.2213          0.2678    11.0834

potential_split         38879          0.9505        1.4912           1.6238          0.1118    23.9248

potential_static        38879          0.8506        1.4371           1.2912          0.5299    11.4198

shortest_path           38879          0.7846        1.2540           1.0038          1.6477    11.1648

ecmp                    38879          0.7945        1.2541           1.0038          1.5072    11.2295

adaptive_shortest_path  38879          0.9359        1.1999           1.0494          0.2220     9.3849

```

Read it as: the potential routers and the adaptive baseline cut loss by 4–8 percentage points against
shortest path; the multipath split trades 2.7 steps of extra delay and 49 % path stretch for the lowest
loss of all; the win rates are below 0.5 only because at light load more than half the episode pairs are
exact ties (`ties_loss`, printed in the full table). The numbers above come from the two-minute rehearsal
run (675 size-32 episodes, 200 steps), so they are noisier and lossier than a full sweep — the *ordering*
of the routers is what reproduces.

### `inspect_episode.py` — one episode, checked against the physics



Prints the design cell, graph, flows, event timeline and router summary; then, at one step, the capacities

in force, the busiest buffers and links; recomputes the tracked flows' potential field from the graph state

and queue depths and asserts it against the stored snapshot *and* the sparse reference solver; and follows

one flow's steepest-current descent to its sink.



```

Episode 7 [barabasi_albert/32/poisson/heavy/moderate] 32 nodes, 87 links, 64 flows, 200 steps, split=train
  degree min/mean/max 3/5.44/16, capacity 8-80 pkt/step, latency 1-10 steps, total directed capacity 7678 pkt/step
  flows: 64 between 32 endpoints, offered load rho = 0.100, tracked flows 8, field stride 1

Topology events (1):
            kind  start  end  node  factor

node_degradation     72  128     6  0.4374


Step 100: 0 failed links, 9 links with reduced capacity, 87 live links
  busiest buffers under potential: node 0: 256, node 4: 189, node 6: 142
  [ok] potential field of the 8 tracked flows recomputed from graph state + queues (max rel dev 4.9e-08)
  [ok] pseudo-inverse solution agrees with the sparse SuperLU solve for flow 0
  [ok] steepest-current descent of flow 0 reaches its sink: 12 -> 1 -> 7 (2 hops, shortest possible 2);
       potentials 0.4934 > 0.4433 > 0.0000

```


The last line is the loop-freedom guarantee made concrete: the potential decreases strictly along the path
and the walk terminates at the sink.

### `forecast_congestion.py` — a learning task on the splits



Predicts the network's loss ratio over the next `--horizon` steps from the last `--window` steps of

`network_telemetry`, normalised by `total_capacity` so all sizes share one feature scale, with a closed-form

ridge regression tuned on validation and reported on test against a persistence baseline:



```

data/: router potential, window 10, horizon 10, stride 5

  samples: train 14,985 (405 episodes), validation 4,995 (135), test 4,995 (135); features 52

Ridge penalty chosen on validation: lambda = 0.0001 (validation RMSE 0.0270)

                             MAE    RMSE      R2

ridge (validation)        0.0096  0.0270  0.8405

persistence (validation)  0.0091  0.0325  0.7689

ridge (test)              0.0099  0.0268  0.8285

persistence (test)        0.0096  0.0342  0.7215

```



As a squared-loss model the ridge wins on RMSE and R² while persistence keeps a marginally lower MAE on the

many loss-free windows — a useful reminder to state the metric before claiming a win. The script asserts

that the splits are disjoint by episode and that no feature is undefined.



### `visualize.py` — the figure gallery



Draws eight PNGs into `figures/` (`--out`) with one fixed palette in which every router keeps its hue.

Select a subset with `--figures`, and steer the single-episode panels with `--episode` (default: a busy

one), `--step`, `--flow`, `--routers` (default `potential,shortest_path`) and `--dpi`:

```bat

python examples/visualize.py --data data_small --figures potential_field,timeline --episode 12 --step 400

```

| File | Shows |
|---|---|
| `topologies.png` | one graph per family, link width scaled by capacity |
| `benchmark.png` | loss and mean delay per router at each load level, 95 % bootstrap intervals |
| `timeline.png` | one episode step by step under two routers, with bursts and topology events marked |
| `queue_heatmap.png` | buffer occupancy of every node over time, same episode, two routers side by side |
| `link_utilisation.png` | CCDF of per-link-step utilisation: how often links run near saturation, per router |
| `potential_field.png` | the field of one flow on the graph, node size = buffer occupancy, with the steepest-current next hops and the descent path |
| `delays.png` | flow-level p99 delay and path stretch per router |
| `traffic_profiles.png` | offered packets of one flow under each of the three profiles |

![Router benchmark](figures/benchmark.png)

![Potential field](figures/potential_field.png)

![Buffer occupancy](figures/queue_heatmap.png)

![Episode timeline](figures/timeline.png)

## Reproducibility and provenance

Episode `e` draws every random quantity from `numpy.random.default_rng([seed, e])` in a fixed order and
the routers are deterministic, so `scripts/validate_dataset.py` can re-simulate any episode and compare it
bit for bit. The generator also avoids the two places where platforms usually disagree: shortest-path
next hops are derived from Dijkstra *distances* (exact, because latencies and the quantised adaptive
costs are integer-valued) with a fixed tie rule rather than from the solver's predecessor tie-breaking,
and the potential routers resolve mathematically tied currents — common on symmetric fabrics — within a
relative tolerance far above rounding noise. All twenty sample episodes generated during development were
bit-identical under NumPy 1.26 / SciPy 1.11 and NumPy 2.4 / SciPy 1.17. `data/config.json` records the
configuration and `data/manifest.json` the dataset version, library versions, platform, design coverage
and table statistics of the shards present.

## Limitations

Traffic is open-loop (no TCP-like feedback), nodes have a single shared drop-tail buffer, all packets
have the same size, time is discretised to 1 ms steps and capacities to whole packets per step, and the
topologies are synthetic families rather than measured networks. Routing tables are recomputed
instantaneously with global knowledge, which is an upper bound on what a distributed implementation can
achieve. These choices keep the routers comparable and the episodes reproducible; they should be kept in
mind when transferring conclusions to production networks.

## Publishing

Uploading is the one manual step. Draw the figures this card embeds, log in once with a write token, then
push the project folder — Parquet shards, `config.json`, `manifest.json`, this dataset card with its
figures, and the generator and example source — as a dataset repository; the upload is resumable and its
bookkeeping lives in `.cache/`:

```bat

python examples/visualize.py

hf auth login

python scripts/push_to_huggingface.py --repo <user>/<dataset>

```

Add `--private` for a private repository. The `configs:` block at the top of this file makes every table
browsable in the Dataset Viewer as soon as the upload finishes.

## Repository layout

```

├── README.md                    dataset card and this guide

├── requirements.txt

├── .gitignore                   keeps generated data and caches out of git

├── src/

│   ├── design.py                factors, levels, episode → cell / replicate / split

│   ├── config.py                every knob of the generator, one frozen dataclass

│   ├── graph_generator.py       five topology families, connectivity-preserving event timelines

│   ├── physics_engine.py        Laplacian potential field, routing gradient, multipath spraying, baselines

│   ├── simulation_loop.py       traffic, vectorised packet queueing, six routers, multiprocessing sweep

│   ├── telemetry_logger.py      Parquet schemas, sharded resumable writing, manifest

│   └── dataset.py               read API: tables, episodes, graph state and field at any step

├── scripts/

│   ├── run_local_sweep.py       generate (automatic, resumable)

│   ├── validate_dataset.py      verify a generated dataset

│   └── push_to_huggingface.py   publish (manual)

├── examples/

│   ├── benchmark_routers.py     paired router benchmark

│   ├── inspect_episode.py       one episode end to end, checked against the physics

│   ├── forecast_congestion.py   loss forecasting on the splits

│   └── visualize.py             figure gallery

├── figures/                     drawn by examples/visualize.py

└── data/                        generated shards, one folder per table, plus config.json and manifest.json

```

## Changelog

**2.0** — full factorial design over five topology families, four sizes, three traffic profiles, three
offered-load levels and three dynamics levels with balanced replicates and 60/20/20 splits; six routers
(three potential-field variants, three classical baselines); two flows per endpoint with log-normal rates
and offered load defined relative to network capacity; potential fields via the Laplacian pseudo-inverse
(exact, O(N·F) per step); per-link loads, per-node drops, queueing/propagation delay decomposition, route
changes, network-level per-step totals; manifest with provenance and coverage; validation script.

**1.0** — 1,000 Barabási–Albert episodes with four flows, potential field vs. shortest path, six tables.

Tooling fixes since the 2.0 data release (the Parquet schemas and the generated data are unchanged, so no
regeneration is needed): the cross-table invariant checks in `scripts/validate_dataset.py` now stream the
shards into a dense per-group accumulator instead of loading `flow_telemetry` into pandas, which exhausted
memory on the full dataset, and they report the first group that differs when a sum disagrees; the
potential-field figure widens the int16 `queue_depth` before scaling it into marker sizes, which previously
overflowed and hid the busiest nodes.

## Design notes

The original blueprint solved `L φ = b` on the full Laplacian, which is singular and only consistent when
`b` sums to zero — a condition that congestion injections break. Grounding the sink removes the
singularity, gives the sink its physical meaning as the well of the field and yields the loop-freedom
guarantee above. Choosing the next hop by the largest current rather than the lowest neighbouring
potential makes the decision conductance-aware, so a low-capacity or high-latency link is not chosen merely
because its far end sits at a low potential. Telemetry is streamed straight to Parquet in atomic, resumable
shards, which is what the Hub reads natively and makes a separate HDF5 staging layer unnecessary.