Testing five AI-written shortest-path routines
An AI model produced an incremental shortest-path routine and four follow-up fixes. Each version was tested against an exact Floyd-Warshall reference and benchmarked against conventional code.
Open interactive Repair 3 explorer
Method
After single edge additions or deletions, each candidate returned shortest-path distances from a source vertex. Test sets covered every labelled graph up to 5 vertices, adversarial topologies (chains, rings, stars, bridges), random edit streams, and two social graphs.
Recorded outcomes
| Version | Wrong answers (of 55,924 edits) | Facebook graph runtime |
|---|---|---|
| Original AI version | 9,793 | 392 ms |
| AI repair 1 | 0 | 374 ms |
| AI repair 2 | 24,585 | 85 ms |
| AI repair 3 | 10,090 | 392 ms |
| AI repair 4 | 0 | 382 ms |
| Conventional incremental reference | 0 | 59 ms |
| Full recomputation baseline | 0 | 642 ms |
Timings show medians over five runs of 64 random edits on the 4,039-node Facebook graph.
Main findings
- The original AI routine fails on a 3-node graph by reporting distance 1 from the source node to itself after an addition.
- Repair 3 passed all 128 edits on both public social graphs, while failing 9,262 exhaustive checks on graphs of up to 5 nodes.
- Repair 2 ran fastest among AI attempts and failed on 44% of checked edits.
- The two correct AI routines (repairs 1 and 4) ran roughly six times slower than plain conventional code.
Repository and timestamps
Workload commit SHA: 03aee5b923a2305d4735d1400ab6b3b91813aecc. Recorded 15 November 2026 between 22:34 and 22:38 UTC (23:34-23:38 in Geneva).