cirq.work.group_settings_greedy

Greedily group settings which can be simultaneously measured.

We construct a dictionary keyed by max_setting (see docstrings for _max_weight_state and _max_weight_observable) where the value is a list of settings compatible with max_setting. For each new setting, we try to find an existing group to add it and update max_setting for that group if necessary. Otherwise, we make a new group.

In practice, this greedy algorithm performs comparably to something more complicated by solving the clique cover problem on a graph of simultaneously-measurable settings.

settings The settings to group.

A dictionary keyed by max_setting which need not exist in the input list of settings. Each dictionary value is a list of settings compatible with max_setting.