[{"data":1,"prerenderedAt":4},["ShallowReactive",2],{"9g7TFjyuer":3},"# GraphLib\n\nA [Lean 4](https://lean-lang.org/) library for **formal graph theory and graph algorithms**, built on top of [Mathlib](https://github.com/leanprover-community/mathlib4). GraphLib aims to provide machine-checked definitions, theorems, and algorithm implementations covering the standard undergraduate-through-graduate curriculum on graphs.\n\nThe graph definitions intentionally diverge from Mathlib's: vertex and edge sets are both carried as `Set`s with minimal axioms, so that dynamic operations (adding/removing vertices and edges, contractions, minors) and algorithmic reasoning stay close to their textbook formulations.\n\n## Roadmap — v1\n\n### Theory\n\nAmong others:\n\n- **Walks & connectivity.** Walks, paths, cycles, Eulerian walks, components.\n- **Trees.** Trees and forests, Cayley's theorem on the number of labeled trees.\n- **Spectral graph theory.** Laplacian, Cheeger's inequality (upper and lower bounds), expansion / expander graphs.\n- **Matchings.** Matchings, augmenting paths, Hall's theorem, König's theorem.\n- **Colorings.** Proper vertex and edge colorings, chromatic number, basic bounds.\n- **Contractions, minors, topological minors.** Edge/vertex contractions and the minor and topological-minor relations.\n- **Embeddings & planarity.** Planar graphs, Euler's formula, Kuratowski's theorem, toroidal graphs.\n\n### Algorithms\n\n- **Flows.** Ford–Fulkerson, Edmonds–Karp, Push–Relabel.\n- **Graph traversal.** BFS, DFS.\n- **Shortest paths.** Dijkstra, Bellman–Ford, Floyd–Warshall.\n- **Minimum spanning trees.** Kruskal, Prim, Borůvka.\n- **Strongly connected components.** Tarjan / Kosaraju.\n- **Union–Find.** Disjoint-set forests with union-by-rank and path compression.\n\nEvery algorithm comes with a proof of correctness and a proof of runtime.\n\n## Repository layout\n\n```\nGraphLib/\n├── Basic/          -- core graph structures (Graph, SimpleGraph, DiGraph, SimpleDiGraph)\n├── Theory/         -- mathematical results (walks, trees, spectral, matching, …)\n└── Algorithms/     -- algorithm implementations and correctness proofs\n```\n\n## Building\n\n```\nlake build\n```\n\nRequires the Lean toolchain pinned in `lean-toolchain`. `elan` will install it automatically.\n",1784558044479]