Optimized Preferential Pairings for Groups of Four

This Demonstration shows examples of optimal pairings of two groups based on a set of expressed preferences. The pairings were optimized using the Gale–Shapley algorithm available as the StableMarriage function in the Combinatorica package. (There is also a built-in function FindIndependentEdgeSet.) You can choose from five hypothetical scenarios of people's preferences. The grids list the first two preferences for each person in each group, while the graphic on the right links the optimal pair based on the preferences. There are color sliders to distinguish each group. The matching can be used to create partners, match mentors to students, match programs to people, or any other situation in which pairs need to be created given a set of preferences.


  • [Snapshot]
  • [Snapshot]
  • [Snapshot]


This was a project for Advanced Topics in Mathematics II, 2019–2020, Torrey Pines High School, San Diego, CA.
    • Share:

Embed Interactive Demonstration New!

Just copy and paste this snippet of JavaScript code into your website or blog to put the live Demonstration on your site. More details »

Files require Wolfram CDF Player or Mathematica.