This visualisation uses AI Generated code, finetuned for the best visualisation, not code quality
unionfind.mov
Interactive C++ + Raylib visualizer for disjoint-set union, using a gravity-well metaphor to explain union by rank, path compression, and evolving connected components.
- How roots represent components and absorb smaller structures
- How union by rank controls tree growth
- How path compression shortens future traversals
- A debugger-style view that links DSU operations to code and live metrics
flowchart LR
A["Separate Elements"]
B["Find Roots"]
C["Union by Rank"]
D["Compress Paths"]
E["Fewer Components"]
A --> B
B --> C
C --> D
D --> E
q: quitspace: step one operationa: toggle auto-playr: reseth: toggle help
make run