get_top_n_color_pairs

get_top_n_color_pairs#

iqm.applications.graph_utils.get_top_n_color_pairs(max_color_pairs, problem_graph=None, color_sets=None)[source]#

Helper function for the greedy router.

Finds an edge coloring of a graph, and then returns max_color_pairs largest (by the number of edges) pairs of colors. If there is less than max_color_pairs color pairs, then it returns all of them.

Parameters:
Returns:

The largest color pairs.

Raises:

ValueError – If both problem_graph and color_sets are None.

Return type:

list[tuple[set[LogEdge], set[LogEdge]]]