iqm.benchmarks.utils.split_into_disjoint_pairs

iqm.benchmarks.utils.split_into_disjoint_pairs#

iqm.benchmarks.utils.split_into_disjoint_pairs(pairs: Sequence[tuple[int, int]]) list[list[tuple[int, int]]]#

Split a Sequence of pairs of integers into a List of a minimal number of Lists of disjoint pairs.

Example: input [(0,3), (2,3), (3,8), (8,13), (13,17), (17,18)] gives output [[(0, 3), (8, 13), (17, 18)], [(2, 3), (13, 17)], [(3, 8)]].

Parameters:

pairs (Sequence[tuple[int, int]]) – The input list of pairs of integers.

Returns:

A List of Lists of disjoint pairs.

Return type:

list[list[tuple[int, int]]]