I made this crude GIF of Mike Bostock’s beautiful visualization of Wilson’s Algorithm.

A uniform spanning tree of the canvas is generated using Wilson’s algorithm, and then flooded with color using random traversal. Starting in the bottom-left corner, the flood algorithm keeps an array of the neighboring pixels on the flood’s edge. At each step, one of these pixels is selected randomly and colored, as long as it is not already colored. Then any neighboring blank pixels are added to the array. Hue encodes Manhattan distance from the start. (This is not an optimal visual encoding, but it suffices and is pretty.)

  1. meganleppla posted this