Add graph-algorithms module: Dijkstra (heap, array, lazy deletion), Bellman-Ford reference, Kahn topological sort, Union-Find strategies, Kruskal and Prim (15 tests, 13 transcripts)

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017ic4b3RckKrNbvvStS36UM
This commit is contained in:
2026-11-18 21:05:59 +05:30
co-authored by Claude Sonnet 5.5
parent eef175d669
commit 05f41a3ef7
30 changed files with 1490 additions and 0 deletions
@@ -0,0 +1,13 @@
union(0,1), union(1,2), ... union(n-2,n-1) with n=20000, then find(0) twice
===========================================================================
NAIVE max depth 19999 | find(0) #1: 19999 hops | find(0) #2: 19999 hops
BY_SIZE max depth 1 | find(0) #1: 1 hops | find(0) #2: 1 hops
COMPRESSION max depth 19999 | find(0) #1: 19999 hops | find(0) #2: 1 hops
BY_SIZE_AND_COMPRESSION max depth 1 | find(0) #1: 1 hops | find(0) #2: 1 hops
Tournament pattern, n=16384: round r joins sets of size 2^r, so equal sizes meet every time
NAIVE max depth 14
BY_SIZE max depth 14
COMPRESSION max depth 13
BY_SIZE_AND_COMPRESSION max depth 13