Stable\_matching(3) OCaml library Stable\_matching(3)

# [NAME](#NAME)

Stable\_matching - no description

# [Module](#Module)

Module Stable\_matching

# [Documentation](#Documentation)

Module **Stable\_matching**  
: **sig end**

*module Item :* **sig end**

*type left\_index* = **int**

*type right\_index* = **int**

*type rank* = **int**

*type* **('a, 'v)** *matches* = {  
left : **'a list** ;  
pairs : **('v * 'v) list** ;  
right : **'a list** ;  
}

*type* **('v, 'k)** *item\_matches* = **(('v, 'k) Item.t, 'v) matches**

*type unstable\_matching* = {  
first : **left\_index * right\_index** ;  
second : **left\_index * right\_index** ;  
current\_rank : **rank * rank** ;  
optimal : **rank * rank** ;  
}

*val stable\_matches* : **distance:(int -&gt; int -&gt; int) -&gt;** **('a, int) matches -&gt;** **(unit, unstable\_matching) Result.t**

*val strong\_stable\_matches* : **distance:(int -&gt; int -&gt; int) -&gt;** **('a, int) matches -&gt;** **(unit, unstable\_matching) Result.t**

*val matches* : **compatible:(left\_index -&gt; right\_index -&gt; bool) -&gt;** **preferences:(right\_index -&gt;** **(left\_index * rank) array) -&gt;** **size:int * int -&gt; (int, int) matches**

**matches ~compatible ~preferences ~size:(ls,rs)** computes a matching between a set of **ls** left items and **rs** right items favoring the right side. The matches are compatible and weakly stable according to the **preferences** matrix. The size of the matching is at least 2/3 of the optimal matching size (computing optimal matching with partial preferences and ties is in NP).

*val fuzzy\_match\_names* : **compatibility:('k -&gt; 'k -&gt; bool) -&gt;** **max\_right\_items:int -&gt;** **cutoff:(string -&gt; int) -&gt;** **('v, 'k) Item.t list -&gt;** **('v, 'k) Item.t list -&gt; ('v, 'k) item\_matches**

**fuzzy\_match\_names ~compatibility ~max\_right\_item ~cutoff left right** calls the **Stable\_matching.matches** function using the OSA edit distance to compute preferences with a cutoff function. To avoid quadratic complexity on large module size we limit the right side to the first **max\_right\_item** items

2026-10-23 OCamldoc

---

Document: Stable_matching(3o) from ocaml 5.5.2-r0 (Chainguard OS)
Source: https://github.com/ocaml/ocaml
