code: def compare_groups(true_groups, pred_groups):
      r
      import utool as ut
      true = {frozenset(_group) for _group in true_groups}
      pred = {frozenset(_group) for _group in pred_groups}
      common = true.intersection(pred)
      true_sets = true.difference(common)
      pred_sets = pred.difference(common)
      pred_conn = {p: frozenset(ps) for ps in pred for p in ps}
      true_conn = {t: frozenset(ts) for ts in true for t in ts}
      pred_merges = []
      true_merges = []
      for ts in true_sets:
          ccs = set([pred_conn.get(t, frozenset()) for t in ts])
          if frozenset.union(*ccs) == ts:
              pred_merges.append(ccs)
              true_merges.append(ts)
      true_splits = []
      pred_splits = []
      for ps in pred_sets:
          ccs = set([true_conn.get(p, frozenset()) for p in ps])
          if frozenset.union(*ccs) == ps:
              true_splits.append(ccs)
              pred_splits.append(ps)
      pred_merges_flat = ut.flatten(pred_merges)
      true_splits_flat = ut.flatten(true_splits)
      pred_hybrid = frozenset(map(frozenset, pred_sets)).difference(
          set(pred_splits + pred_merges_flat))
      true_hybrid = frozenset(map(frozenset, true_sets)).difference(
          set(true_merges + true_splits_flat))
      comparisons = {
          'common': common,
          'true_splits': true_splits,
          'true_merges': true_merges,
          'true_hybrid': true_hybrid,
          'pred_splits': pred_splits,
          'pred_merges': pred_merges,
          'pred_hybrid': pred_hybrid,
      }
      return comparisons