Function Repository Resource:

# ParityPairings

List all possible partitions of a list into disjoint pairs

 ResourceFunction["ParityPairings"][items] lists all partitionings of items into disjoint pairs matching each single item once to any other or to itself.

## Details

If items has length n, each output partitioning has dimensions {k,2}, where n/2kn.
Each item from items appears exactly once as a member of a non-identical pair {l,m} or exactly twice as both members of an identical pair {m,m}.
When the items are chosen to be a range of numbers 1, 2, …, n, ResourceFunction["ParityPairings"] lists involutions of length n almost in Cycles notation, except that fixed indices are also listed as pairs {m,m}.

## Examples

### Basic Examples (2)

The only pairing of one item is the Identity:

 In[1]:=
 Out[1]=

Two items admit two distinct pairings:

 In[2]:=
 Out[2]=

Alternatively, items can also be entered as integers:

 In[3]:=
 Out[3]=

### Properties and Relations (2)

Compare with the result of the resource function Involutions:

 In[4]:=
 Out[4]=

Plot the relative time savings:

 In[5]:=
 Out[5]=

### Neat Examples (1)

Count the number of distinct involutions on n letters (cf. OEIS A000085):

 In[6]:=
 Out[6]=