Josiah March
  • Home
  • Projects
  • Contact
  • Resume

Gale–Shapley Deferred Acceptance Algorithm Visualizer

Try the live demo → · View the code on GitHub →

The problem

The Gale–Shapley Deferred Acceptance Algorithm is the foundation of two-sided matching markets — most famously used to match residents to hospitals (and, in modified forms, students to schools). It guarantees a stable matching, but the mechanics of why it’s stable and how the outcome differs depending on which side “proposes” are hard to grasp from equations alone.

My approach

I built an interactive web app so the algorithm can be explored hands-on rather than just read about. The app:

  • Implements both directions of the algorithm — doctor-proposing and hospital-proposing — so users can directly compare how the outcome shifts depending on which side has the “advantage.”
  • Lets users define their own number of doctors and hospitals, custom preference rankings, hospital-specific capacities, and even mark certain matches as unacceptable.
  • Runs step-by-step, showing the full proposal/rejection log at each stage rather than just the final result, so the mechanics of the algorithm are visible as it runs.

Skills used

Python · Shiny for Python/Shinylive · Algorithm design · Game theory · Interactive UI design

Try it yourself

The live version runs entirely in-browser (no server required, thanks to Shinylive) — open the visualizer here and try building your own matching market.