graph-algorithmstable-marriage

Stable marriage (SMP) where graph is incomplete


To my understanding SMP will always have a stable solution as long as the graph is complete. In other words every male may are able to marry every female and vice versa.

But what if this does not hold true? Lets say that some males have a list of females that they can not marry under any circumstances.

Is this another problem or does it exist a good algorithm to solve this problem. This problem should not always have a solution I presume, but I would like to get an as good as possible solution.


Solution

  • Not sure how efficient you need this to be but my standard matching algorithm is to just make a bipartite graph and run max flow on it. This would work here to find a matching, and would even work if some nodes are orphaned and can't be matched with anyone.

    Now to find a good solution that is valid you could use min-cost max-flow. When constructing the graph 1 set is the males all connected to the source with a cost 0, capacity 1. Then the other set is the females connected to the sink cost 0, capacity 1. Now connect each male/female pair with an edge that has capacity 1, and a cost that is some metric of how good the match is (perhaps the sum of their indices in each others' preference list, or square of the sum?). Now your matching will be minimized based on whatever metric you choose.

    Not exactly optimal but will probably have a good solution and you can tweak it based on your data.