def have_cycle(graph:dict) -> frozenset:
    walked = set()
    nodes = frozenset(it.chain(it.chain.from_iterable(graph.values()), graph.keys()))
    preds = reversed_graph(graph)
    last_walked_len = -1
    while last_walked_len != len(walked):
        last_walked_len = len(walked)
        for node in nodes - walked:
            if len(preds.get(node, set()) - walked) == 0:
                walked.add(node)
    return frozenset(nodes - walked)