code: def reversed_graph(graph:dict) -> dict:
      
      ret = defaultdict(set)
      for node, succs in graph.items():
          for succ in succs:
              ret[succ].add(node)
      return dict(ret)
docs: Return given graph reversed