1 Introduction
The stable marriage problem is one of the most classic and wellstudied problems in the area of matching under preference, with many applications in other fields including economics [4, 9]. We have a set of men and a set of women, with each person having a list that ranks some people of opposite gender as his/her acceptable partners in order of preference. A blocking pair of a matching is a pair of a man and a women that are not matched with each other but prefer each other to their own partners. The goal is to find a stable matching, a matching that does not contain any blocking pair.
On the other hand, the noncrossing matching problem is a problem in the area of geometric matching. We have a set of points lying on two parallel lines, each containing points. We also have some edges joining vertices on the opposite lines. The goal is to select a set of edges that do not cross one another subject to different objectives, e.g. maximum size, maximum weight, etc.
In this paper, we study a problem in geometric matching under preference, a combination of nature in both areas. In particular, we investigate the problem of having men and women represented by points lying on two parallel lines, with each line containing people of each gender. Each person has a list that ranks some people of opposite gender in strict order of preference. A noncrossing blocking pair of a matching is a blocking pair that does not cross any edge in . Our goal is to find a noncrossing matching that does not contain any noncrossing blocking pair, called a weakly stable noncrossing matching (WSNM).
Note that the realworld applications of this geometric problem are more likely to involve unmovable objects, e.g. construction of noncrossing bridges between cities on the two sides of a river, with each city having different preferences. In this paper, however, we keep the terminologies of men and women used in the original stable marriage problem in order to understand and relate to the original problem easier.
1.1 Related Work
The stable marriage problem was first introduced by Gale and Shapley [2]. They proved that a stable matching always exists in an instance with men and women, with each person’s preference list containing all people of opposite gender and not containing ties. They also developed an algorithm to find a stable matching in a given instance. Gusfield and Irving [4] later showed that the algorithm can be adapted to the setting where each person’s preference list may not contain all people of opposite gender. The algorithm runs in time in this setting, where is the total length of people’s preference lists. Gale and Sotomayor [3] proved that in this modified setting, a stable matching may have size less than , but every stable matching must have equal size. Irving [6] then generalized the notion of a stable matching to the case where ties are allowed in people’s preference lists. He introduced three types of stable matchings in this setting: weakly stable, superstable, and strongly stable, as well as developing algorithms to determine whether each type of matching exists in a given instance and find one if it does.
Stable roommates problem is a generalization of the stable marriage problem to a nonbipartite setting where people can be matched regardless of gender. Unlike in the original problem, a stable matching in this setting does not always exist. Irving [5] developed an algorithm to find a stable matching or report that none exists in a given instance, where is the number of people.
On the other hand, the noncrossing matching problem in a bipartite graph where the points lie on two parallel lines, each containing points, was encountered in many realworld situations such as in VLSI layout design [7]. In the special case where each point is adjacent to exactly one point on the opposite line, Fredman [1] presented an algorithm to find a maximum size noncrossing matching by computing the length of the longest increasing subsequence (LIS). Widmayer and Wong [10] developed another algorithm that runs in time, where is the size of the solution. This algorithm has the same worstcase runtime as Fredman’s, but runs faster in most general cases.
In a more general case where each point may be adjacent to more than one point, Malucelli et al. [8] developed an algorithm to find a maximum size noncrossing matching. The algorithm runs in either or time depending on implementation, where is the number of edges and is the size of the solution. In the case where each edge has a weight, they also showed that the algorithm can be adapted to find a maximum weight noncrossing matching with runtime.
1.2 Our Contribution
In this paper, we constructively prove that a weakly stable noncrossing matching always exists in any instance by developing an algorithm to find one in a given instance.
2 Preliminaries
In this setting, we have a set of men represented by points lying on a vertical line in this order from top to bottom, and a set of women represented by points lying on another parallel line in this order from top to bottom. Only people of opposite genders can be matched with each other, and each person can be matched with at most one other person.
For a person and a matching , define to be a person matched with (for convenience, let for an unmatched person ). For each person , let to be the preference list of , containing people of opposite gender to in order of preference, with the first entry in the list being the most preferred person, the second entry being the second most preferred person, and so on. Throughout this paper, we assume that the preference lists are strict (containing no tie among two or more people). Also, let be the rank of a person in , with the first entry having rank 1, the second entry having rank 2, and so on (for convenience, let and for any person not in ). A person prefers a person to a person if . Note that a preference list does not have to contain all people of opposite gender, and ties among people in the preference lists are not allowed in this setting.
A pair of edges cross each other if they intersect in the interior of both segments. Formally, an edge crosses an edge if and only if . A matching is called noncrossing if it does not contain any pair of crossing edges.
Following is the formal definition of a blocking pair given in the original stable marriage problem, and a noncrossing blocking pair we introduce.
Definition 1.
A blocking pair of a matching is a pair of a man and a woman that are not matched with each other, but prefers to and prefers to .
Definition 2.
A noncrossing blocking pair of a matching is a blocking pair of that does not cross any edge in .
We also introduce two types of stable noncrossing matchings, distinguished as weakly and strongly.
Definition 3.
A matching is called a weakly stable noncrossing matching (WSNM) if is noncrossing and does not contain any noncrossing blocking pair.
Definition 4.
A matching is called a strongly stable noncrossing matching (SSNM) if is noncrossing and does not contain any blocking pair.
Note that an SSNM is a matching that is both noncrossing and stable, while a WSNM is “stable” in a weaker sense as it may contain a blocking pair, just not a noncrossing one.
An SSNM may not exist in some instances. For example, in an instance of two men and two women, with , and , the only stable matching is , and its two edges do cross each other. On the other hand, the above instance has two WSNMs and . It also turns out that a WSNM always exists in every instance. Throughout this paper, we focus on the proof of existence of a WSNM by developing an algorithm to find one.
3 Our Algorithm
3.1 Outline
Without loss of generality, for each man and each woman , we assume that is in ’s preference list if and only if is also in ’s preference list (otherwise we can simply remove the entries that are not mutual from the lists). Also, for convenience we first append to the end of each preference list . Initially, every person is matched with . In the geometric aspect, we locate very close to so that does not cross any edge and does not interfere with the property of noncrossing.
Our algorithm uses proposal from men to women similarly to GaleShapley’s algorithm, but in a more organized way. When a woman receives a proposal from a man , if she prefers her current partner to , she rejects ; if she is currently unmatched or prefers to , she accepts and dumps .
Consider a man and a woman not matched with each other. We call accessible to if does not cross any edge in . Also, an entry in has three possible states:

inaccessible, if is not accessible to ;

unavailable, if is accessible to , but is currently matched with a man she likes more than , i.e. is going to be rejected if he proposes to her;

available, if is accessible to , and is currently unmatched or matched with a man she likes less than , i.e. is going to be accepted if he proposes to her.
For convenience, if is currently matched with , we also call accessible to , and the state of entry in is available.
For a man , if every entry in before is either inaccessible or unavailable, then we say that is stable; otherwise (there is at least one available entry before ) we say that is unstable.
The main idea of our algorithm is that, at any point, if there is at least one unstable man, we pick the topmost unstable man (an unstable man with least index ) and perform the following operations:

let propose to an available woman that he prefers most (and he is going to be accepted);

remove the old pairs and , if any, from and add the new pair to .
We repeatedly perform such operations until every man becomes stable. Note that in this algorithm, every proposal will result in acceptance since men propose only to women available to them.
3.2 Proof of Correctness
First, we will show that if our algorithm stops, then the matching given by the algorithm must be a WSNM.
Assume, for the sake of contradiction, that contains a noncrossing blocking pair . That means prefers to his current partner , prefers to her current partner , and does not cross an edge in , thus the entry in is available and is located before . However, by the definition of our algorithm, the process stops when every man becomes stable, which means there cannot be an available entry before in , a contradiction. Therefore, we can conclude that our algorithm gives a WSNM as a result whenever it stops.
However, it is not trivial that our algorithm will eventually stop. In contrast to the GaleShapley’s algorithm in the original stable marriage problem, in this problem a woman is not guaranteed to only get increasingly better partner throughout the process because a man can dump a woman too if he later finds a better available woman previously inaccessible to him (due to having an edge obstructing them). In fact, it is actually the case where the process may not stop if in each step we pick an arbitrary unstable man instead of the topmost one. For example, an instance of two men and two women with , and the order of picking results in the process continuing forever, with the matching looping between , , , and in each step.
We will prove that our algorithm must eventually stop and evaluate its worstcase runtime after we introduce the explicit implementation of the algorithm in the next subsection.
3.3 Implementation
To implement the above algorithm, we have to consider how to efficiently find the topmost unstable man in each step in order to perform the operations on him. Of course, a straightforward way to do this is to update the state of every entry in every man’s preference list after each step, but that method will take a lot of time. Instead, we introduce the following scanning method.
Throughout the algorithm, we do not know exactly the set of all unstable men, but we instead keep a set of men that are “possibly unstable.” Initially, the set contains all men, i.e. , and at each step we keep the set of the form for some . In each step, we scan the topmost man in (that means all with are guaranteed to be stable at that time) and check whether is stable. If is already stable, then we simply skip him by removing from and moving to scan the next man in . If is unstable, then is indeed the topmost unstable man we want, so we perform the operations on . Note that the operations may cause some men to become unstable, so after that we have to add all men that are possibly affected by the operations back to . The details of the scanning and updating processes are as follows.
During the scan of , let be the matched man closest to that lies above him, and let (we let if there is no ). Also, let be the matched man closest to that lies below him, and let (we let if there is no ). Observe that matching with anyone above will cross the edge , and matching with anyone below will cross the edge . Therefore, the range of all accessible women to ranges exactly from to , hence the range of all available women to ranges from either or (depending on whether prefers to ) to either or (depending on whether prefers to ). See Fig. 1.
Then in the available range, selects a woman that he prefers most.
Case 1: does not exist or is currently matched with .
That means is currently stable, so we can skip him. We remove from and proceed to scan in the next step (called a downward jump).
Case 2: exists and is not currently matched with
That means is indeed the topmost unstable man we want, so we perform the operations on him by letting propose to and dump his current partner (if any).
Case 2.1: exists and .
That means dumps to get matched with , which leaves unmatched and may possibly become unstable. Furthermore, as well as itself may also possibly become unstable since they now gain access to women above previously inaccessible to them. Therefore, we add to and proceed to scan in the next step (called an upward jump).
Case 2.2: does not exist or .
Case 2.2.1: is currently matched and lies below .
Then, (or if does not exist) may possibly becomes unstable since they now gain access to women between and previously inaccessible to them. Therefore, we perform the upward jump to (or to if does not exist), adding (or ) to and proceed to scan (or ) in the next step. Actually, this case is impossible to happen, which we will prove in the next subsection.
Case 2.2.2: is currently unmatched or lies above .
Then all men above clearly remain stable (because the sets of available women to either remain the same or become smaller). Also, now becomes stable as well (because selects a woman he prefers most in the available range), except in the case where (because the edge is removed and now has access to women below previously inaccessible to him). Therefore, we perform the downward jump, removing from and moving to scan in the next step, except in the case where which we have to scan again in the next step (this exception, however, is impossible to happen, which we will prove in the next subsection).
We scan the men in this way until becomes empty. See Example 1.
Example 5.
Consider an instance of three men and three women with the following preference lists.
Our algorithm will scan the men in the following order and output a matching , which is a WSNM. ∎
Step  Process  at the end of step  at the end of step 

0  
1  scan , add  
2  scan , add , remove  
3  scan , add  
4  scan , add , remove  
5  scan , add , remove  
6  scan , add , remove  
7  scan  
8  scan  
9  scan 
3.4 Observations
First, we will prove the following lemma about the algorithm described in the previous subsection.
Lemma 6.
During the scan of a man , if is currently matched, then does not propose to any woman below .
Proof.
We call a situation when a man proposes to a woman below a downward switch. Assume, for the sake of contradiction, that a downward switch occurs at least once during the whole algorithm. Suppose that the first downward switch occurs at step , when a man is matched to and proposes to with . We have prefers to .
Consider the step when proposed to (if proposed to multiple times, consider the most recent one). At step , must be inaccessible or unavailable to (otherwise he would choose instead of ), meaning that there must be an edge with and obstructing them in the inaccessible case, or an edge with , , and preferring to in the unavailable case.
We define a dynamic edge as follows. First, at step we set . Then, throughout the process we update by the following method: whenever the endpoints of cease to be partners of each other, we update to be the edge joining the endpoint that dumps his/her partner with his/her new partner. Formally, suppose that is currently . If dumps to get matched with , we update to be ; if dumps to get matched with , we update to be .
By this updating method, the edge will always exist since step , but may change by the time. Observe that from step to step , we always have because of the existence of . Moreover, before step , if dumps to get matched with , by the assumption that a downward switch did not occur before step , we have , which means the index of the women’s side of ’s endpoints never increases. Consider the edge at step , we must have and . If , then the edge obstructs and , making inaccessible to . If , that means never got dumped since step , so she got only increasingly better partners, thus prefers to , making unavailable to . Therefore, in both cases could not propose to , a contradiction. Hence, a downward switch cannot occur in our algorithm. ∎∎
Lemma 6 shows that a woman cannot get her partner stolen by any woman below her, or equivalent to the following corollary.
Corollary 7.
If a man dumps a woman to propose to a woman , then .
It also implies that Case 2.2.1 in the previous subsection never occurs. Therefore, the only case where upward jump occurs is Case 2.1 ( exists and proposes to ). We will then prove the following lemma.
Lemma 8.
During the scan of a man , if exists, then does not propose to .
Proof.
Assume, for the sake of contradiction, that proposes to . Since exists, this proposal obviously cannot occur in the very first step of the algorithm. Consider a man we scanned in the previous step right before scanning .
Case 1: is below , i.e. .
In order for the upward jump from to to occur, must have been matched with a woman but got her stolen by in the previous step. However, are all currently unmatched (by the definition of ), so the only possibility is that , and thus his partner that got stolen was . Therefore, we can conclude that prefers to , which means is currently unavailable to , a contradiction.
Case 2: is above , i.e. .
The jump before the current step was a downward jump, but since has been scanned before, an upward jump over must have occurred at some point before the current step. Consider the most recent upward jump over before the current step. Suppose than it occurred at the end of step and was a jump from to , with and . In order for this jump to occur, must have been matched with a woman but got her stolen by in step . However, are all currently unmatched (by the definition of ), so the only possibility is that , and thus ’s partner that got stolen was . We also have were all unmatched during step (otherwise would be inaccessible to ), and prefers to .
Now, consider the most recent step before step that we scanned . Suppose it occurred at step . During step , was matched with and was accessible to . However, was still left unmatched after step (otherwise an upward jump over at step could not occur), meaning that must be unavailable to him back then due to preferring to . Therefore, we can conclude that prefers to , thus is currently unavailable to , a contradiction. ∎∎
Lemma 8 shows that a man cannot get his partner stolen by any man above him, or equivalent to the following corollary.
Corollary 9.
If a woman dumps a man to accept a man , then .
3.5 Proof of Finiteness
Now, we will show that the position of each woman’s partner can only move downward throughout the process, which guarantees the finiteness of the number of steps in the entire process.
Lemma 10.
After a woman ceases to be a partner of a man , she cannot be matched with any man with afterwards.
Proof.
Suppose that ’s next partner (if any) is . It is sufficient to prove that . First, consider the situation when and cease to be partners.
Case 1: dumps .
This means dumps to get matched with right away. By Corollary 9, we have as wanted.
Case 2: dumps .
Suppose that dumps to get matched with . By Corollary 7, we have .
Case 2.1: never gets dumped afterwards.
That means will only get increasingly better partner, and the position of his partner can only moves upward (by Corollary 7), which means cannot be matched with again, or any man above afterwards due to having an edge obstructing. Therefore, must be below , i.e. .
Case 2.2: gets dumped afterwards.
Supposed that first gets dumped by at step . By Corollary 7, we have (because only gets increasingly better partner before getting dumped). Also suppose that dumps in order to get matched with . By Corollary 9, we have . Similarly to the proof of Lemma 7, consider a dynamic first set to be at step . We have the index of the men’s side of ’s endpoints never decreases, and that of the women’s side never increases. Therefore, since step , there always exists an edge with and , obstructing ’s access to and all men above him. Therefore, must be below . ∎∎
3.6 Runtime Analysis
Consider any upward jump from to with that occurs right after stole from . We call such jump associated to , and has size .
For any woman , let be the sum of size of all upward jumps associated to . From Lemma 10, we know that the position of ’s partner can only move upward throughout the process, so we have . Therefore, the sum of size of all upwards jumps is . Since the scan starts at and ends at , the total number of downward jumps equals to the sum of size of all upward jumps plus , hence the total number of steps in the whole algorithm is .
For each , we keep an array of size , with the th entry storing the rank of in (the rank is if is not in ). Each time we scan , we query a minimum rank of available women, which is a consecutive range in the array. Using an appropriate range minimum query (RMQ) data structure, we can perform the scan with preprocessing time per array and query time. Therefore, the total runtime of our algorithm is .
In conclusion, we proved that our developed algorithm is correct and can be implemented in time, which also implicitly proves the existence of a WSNM in any instance.
Theorem 11.
A weakly stable noncrossing matching exists in any instance with men and women with strict preference lists.
Theorem 12.
There is an algorithm to find a weakly stable noncrossing matching in an instance with men and women with strict preference lists.
Remarks: Our algorithm does not require the numbers of men and women to be equal. In the case that there are men and women, the algorithm works similarly with runtime. Also, in the case that poeple’s preference lists are not strict, we can modify the instance by breaking ties in arbitrary order. Clearly, a WSNM in the modified instance will also be a WSNM in the original one (because every noncrossing blocking pair in the original instance will also be a noncrossing blocking pair in the modified instance).
4 Discussion
In this paper, we constructively prove that a WSNM always exists in any instance by developing an algorithm to find one. A possible future work is to develop an algorithm to determine whether an SSNM exists in a given instance, and to find one if it does.
Another interesting work is to investigate the noncrossing matching in the geometric aspect of the stable roommates problem where people can be matched regardless of gender. The most basic and natural setting of this problem is where people are represented by points arranged on a circle. A possible future work is to develop an algorithm to determine whether a WSNM or an SSNM exists in a given instance, and to find one if it does.
References
 [1] M.L. Fredman. On computing the length of longest increasing subsequences, Discrete Applied Mathematics, 11(1):2935 (1975).
 [2] D. Gale and L.S. Shapley. College admissions and the stability of marriage. American Mathematical Monthly, 69:915 (1962).
 [3] D. Gale and M. Sotomayor. Some remarks on the stable matching problem. Discrete Applied Mathematics, 11(3):223232 (1985).
 [4] D. Gusfield and R.W. Irving. The Stable Marriage Problem: Structure and Algorithms. MIT Press (1989).
 [5] R.W. Irving. An efficient algorithm for the “stable roommates” problem. Journal of Algorithms, 6:577595 (1985).
 [6] R.W. Irving. Stable marriage and indifference. Discrete Applied Mathematics, 48(3):261272 (1994).
 [7] Y. Kajitami and T. Takahashi. The noncross matching and applications to the 3side switch box routing in VLSI layout design. In Proceedings of the International Symposium on Circuits and Systems, pages 776779 (1986).
 [8] F. Malucelli, T. Ottmann, and D. Pretolani. Efficient labelling algorithms for the maximum noncrossing matching problem. Discrete Applied Mathematics, 47(2):175179 (1993).
 [9] A.E. Roth and M.A.O. Sotomayor. Twosided matching: a study in gametheoretic modeling and analysis, volume 18 of Econometric Society Monographs. Cambridge University Press (1990).
 [10] P. Widmayer and C.K. Wong. An optimal algorithm for the maximum alignment of terminals, Information Processing Letters. 10:7582 (1985).
Comments
There are no comments yet.