def dict_to_dict_with_set(act: Dict) -> Dict: return modify_dict(act, {'level': lambda v: set(v)})
def edge_dict_to_node_dict_with_list(act: Dict) -> Dict: return modify_dict(act, {'level': lambda v: sorted(list(v))})
def reduce_node_dict(acc: Dict[str, Set], act: Dict[str, Set]) -> Dict[str, Set]: return modify_dict( acc, {'level': lambda acc_level: acc_level | act.get('level', {})})
def node_dict_to_edge_dict_with_list(act: Dict) -> Dict: return modify_dict( act, {'level': lambda lvls: {k: sorted(list(v)) for k, v in lvls.items()}})
def merge_level(acc_level: Dict[str, Any], act_level: Dict[str, Any]) -> Dict[str, Any]: return modify_dict(merge_dict(acc_level, act_level, lambda x: x), {'level': lambda x: reduce(union_sets, x, {})}, lambda x: next(x))