~/projects [h]
tldr kruskal [3/7]
traveling-salesman
Four ways to solve the traveling salesman problem, racing each other on the same cities. Brute force and dynamic programming find the guaranteed shortest round trip, a genetic algorithm and an ant colony approximate it in a fraction of the time. Add cities and watch the exact methods hit a wall while the heuristics keep going.

- stack
- genetic algorithm, ant colony optimization, rust, python, wasm
- uses
- numpy, pygame, aiostream
- used by
- Traveling salesman problem
- links
- [video] [post]
fireflies
A swarm of fireflies, living their lives in a colony in a true ecosystem, or taking flight in a swarm of thousands. Each one only follows three rules over the friends it sees: don't crowd them, fly their way, stay close. Together that gives streams, swirls and flocks that split around rocks and scatter away from predators.
- stack
- rust, wasm, boids, swarm intelligence
- links
kruskal
Kruskal's algorithm for the minimum spanning tree, built on hand-made data structures: a min binary heap hands out the edges cheapest first, a disjoint set with union by rank and path compression tells whether an edge joins two trees or would close a cycle. Watch the forest grow into a single tree, one edge at a time.

- stack
- binary heap, disjoint set, rust, python, wasm
- used by
- Through the trees...
- links
- [post]
sudoku-solver
A Sudoku solver, regular or diagonal, by constraint propagation: elimination, only choice and naked twins narrow the pencil marks down. When they get stuck, a depth-first search guesses in the cell with the fewest candidates and backtracks on a contradiction. Watch every step, or switch the strategies off and see how much more it has to guess.

- stack
- constraint propagation, search, rust, python, wasm
- links
- [video]
wayoflife
Conway's Game of Life with a twist: every cell is new, a survivor or dying, each in its own colour, so you can follow how the grid evolves. The Python version grew from a naive grid into one that only looks at active cells and keeps neighbour counts up to date, sped up with Numba. A Rust port runs right here in the browser.

- stack
- numba, pygame, rust, python, wasm
- uses
- numpy, numba, pygame, opencv
- used by
- A way of life
- links
- [gitlab] [video] [post]
aoc-rust-vs-python
Advent of Code 2024, day 1, taken far beyond the puzzle: Rust and Python side by side, from a straightforward solution to memory-mapped files, parallelism, SIMD and a bucket sort in Rust, and NumPy and Polars in Python. In the end, Rust processes 100 million lines, about 1.3GB, in less than a second.

- stack
- rust, python, simd, polars
- uses
- polars, numpy
- used by
- Advent of Code Day 1: Rust versus Python
- links
- [post]
rust-etl-pipeline
A streaming ETL pipeline in Rust: it reads a CSV file, processes the records and stores them in SQLite, with every stage running as its own async task, linked by channels. New data is read and processed while earlier batches are still being written, so no stage waits for another.
- stack
- rust, tokio, sqlx, clap
- uses
- tokio, futures, csv-async, sqlx, clap
- used by
- A basic Rust streaming ETL pipeline
- links
- [video] [post]