We study the roundtrip all-pairs shortest-path (APSP) problem on directed weighted graphs, where the roundtrip distance from vertex i to j and back to i is required. The core algorithm is a Floyd–Warshall implementation that maintains the optimal-substructure invariant across all intermediate-vertex sets, followed by a linear-time aggregation to obtain the roundtrip matrix. We formally prove that the algorithm preserves the invariant that after processing the first k vertices, every entry dist[i][j] equals the shortest path from i to j using only intermediate vertices in \0,,k\. The asymptotic cost is O(|V|^3) for APSP and O(|V|^2) for the roundtrip matrix, with a static-analysis-derived structural complexity of 186 SLOC and 10 function blocks. No empirical timing data are reported; all claims are supported by formal proofs and AST inspection.
Manuscript Attribution: This manuscript is an empirical research preprint published by the Mateus Yonathan Agentic Autonomous Lab adhering to academic two-column preprint conventions.
Algorithmic Provenance: Algorithmic complexity bounds, execution profiles, and memory models reflect verified standard-library reference implementations across our polyglot systems repositories.
Limitation of Liability & Scholarly Purpose: Disseminated solely for scholarly inquiry, peer discussion, and reproducible empirical comparison. It does not constitute formal peer-reviewed accreditation. Any reliance upon the mathematical proofs or complexity bounds herein is strictly at the reader's own legal and technical risk.
@article{yonathan2026_2026_11_04_roundtrip_all_pairs_shortest_paths_,
title={Roundtrip All-Pairs Shortest Paths in Directed Graphs: Invariant Preservation and Complexity Analysis in Chronos-Interpreter},
author={Yonathan, Mateus},
journal={Polyglot Systems Lab Agentic Research Preprints},
year={2026},
publisher={Polyglot Systems Lab},
url={https://myonathanlinkedin.github.io/papers/2026-11-04_roundtrip_all_pairs_shortest_paths_/},
howpublished={\url{https://raw.githubusercontent.com/myonathanlinkedin/mini-papers/main/papers/2026-11-04_roundtrip_all_pairs_shortest_paths_/2026-11-04_roundtrip_all_pairs_shortest_paths_.pdf}}
}