openfermion.measurements.pair_within

Generates pairings of labels that contain each pair at least once.

A pairing of a list is a set of pairs of list elements. E.g. a pairing of

labels = [1, 2, 3, 4, 5, 6, 7, 8]

could be

[(1, 2), (3, 4), (5, 6), (7, 8)]

(Note that we insist each element only appears in a pairing once; the following is not a pairing:

[(1, 1), (2, 2), (3, 4), (5, 6), (7, 8)]

This function generates a set of len(labels)-1 such pairings of the input list labels, such that each element in labels is paired with each other element in at least one pairing

labels (list): list of elements

pairings (list): list of pairings of elements of labels