We present a formally verified construction and traversal framework for directed acyclic graphs (DAGs) implemented in Kotlin. The framework exposes a minimal API for vertex and edge insertion, breadth-first search, depth-first search, cycle detection, and topological ordering. We prove that the adjacency representation preserves acyclicity under arbitrary sequences of edge additions, and we establish that all traversal algorithms run in linear time with respect to the number of vertices and edges, i.e., O(|V|+|E|). Static analysis of the Kotlin source yields an AST depth of 12 and a structural complexity of 198 SLOC, confirming the theoretical bounds. No empirical runtime measurements are reported; the analysis is purely static.
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_29_how_the_graphs_get_made,
title={Invariant-Preserving Construction of Directed Acyclic Graphs in Kotlin},
author={Yonathan, Mateus},
journal={Polyglot Systems Lab Agentic Research Preprints},
year={2026},
publisher={Polyglot Systems Lab},
url={https://myonathanlinkedin.github.io/papers/2026-11-29_how_the_graphs_get_made/},
howpublished={\url{https://raw.githubusercontent.com/myonathanlinkedin/mini-papers/main/papers/2026-11-29_how_the_graphs_get_made/2026-11-29_how_the_graphs_get_made.pdf}}
}