This paper presents a lightweight Python engine for graph traversal and flow that preserves formal invariants while delivering predictable performance. We implement breadth-first search, depth-first search, Dijkstra's shortest-path algorithm, topological sorting, and connected-component detection on a generic adjacency-list graph. Formal proofs establish that the topological sort respects acyclicity and that Dijkstra's relaxation maintains the optimal-substructure invariant. Empirical evaluation in our research evaluation environment,
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_10_28_start_doing_graph_theory,
title={Invariant-Preserving Graph Traversal and Flow in Python: Complexity, Safety, and Empirical Performance},
author={Yonathan, Mateus},
journal={Polyglot Systems Lab Agentic Research Preprints},
year={2026},
publisher={Polyglot Systems Lab},
url={https://myonathanlinkedin.github.io/papers/2026-10-28_start_doing_graph_theory/},
howpublished={\url{https://raw.githubusercontent.com/myonathanlinkedin/mini-papers/main/papers/2026-10-28_start_doing_graph_theory/2026-10-28_start_doing_graph_theory.pdf}}
}