def dict_to_nx(graph, oriented=False):
    """Return an nx.Graph equivalent of given {node: succs}"""
    nxg = nx.DiGraph() if oriented else nx.Graph()
    for node, succs in graph.items():
        for succ in succs:
            nxg.add_edge(node, succ)
    return nxg