# Minimum cut

> Global minimum cut for connected, undirected, unweighted multigraphs, implemented with classic Karger and recursive Karger–Stein over injected `knotkit/disjoint-set` layouts.

Global minimum cut for connected, undirected, unweighted multigraphs, implemented with classic Karger and recursive Karger–Stein over injected `knotkit/disjoint-set` layouts.

## Result

> Classic contraction on a 75-vertex graph: indexed layout 0.0251 ms against 0.0393 ms for object

## Modules

* [`knotkit/disjoint-set`](/modules/disjoint-set/): Tracks which elements belong to the same set, with dense-index, object, and struct-of-arrays layouts
* [`knotkit/prng`](/modules/prng/): Generates seeded pseudorandom numbers and unbiased integers for reproducible simulations and tests

## Figures

* The four-cycle has a cut of 2 edges (Karger–Stein with seed 42).
* At 512 vertices the documented bounds give 903642 classic trials
* and 77 Karger–Stein runs for at most 0.1% failure.
* Measured on Apple M1 Pro, one classic trial grows as n^1.2 and one recursive run as n^3.1
* over 25 to 200 vertices, so reaching 0.1% failure takes 53–123× longer with Karger–Stein.

Hover or focus a chart for exact values. Drawn by [`demo.ts`](https://github.com/jkomyno/knotkit/blob/main/problems/min-cut/demo.ts) at build time, from the fixtures the benchmark uses; it reproduces the README figure.

## Reproduce

```bash
git clone https://github.com/jkomyno/knotkit.git && cd knotkit && bun install
bun run demo:problem:min-cut
```

[`problems/min-cut/README.md`](https://github.com/jkomyno/knotkit/blob/main/problems/min-cut/README.md) states the fixture, the seed, and the result table.
