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)]].

# TODO: enable specifying a max split size of Lists of disjoint pairs. # pylint: disable=fixme

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]]]