stable matching

Straightforward implementation of Gale-Shapley "stable marriage" algorithm.


Updated 30 Nov 2011

View License

A matching is a mapping from the elements of one set to the elements of the other set.
A matching is stable whenever it is not the case that both:
a.some given element A of the first matched set prefers some given element B of the
second matched set over the element to which A is already matched, and
b. B also prefers A over the element to which B is already matched

The matching in this case is according to men's preferences, to change it according
to women's preferences some trivial changes need to be made.

Cite As

Hanan Kavitz (2023). stable matching (, MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2011b
Compatible with any release
Platform Compatibility
Windows macOS Linux

Inspired: Gale Shapley Stable Marriage Algorithm

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Version Published Release Notes