def non_edges(graph):
    if graph.is_directed():
        for u in graph:
            for v in non_neighbors(graph, u):
                yield (u, v)
    else:
        nodes = set(graph)
        while nodes:
            u = nodes.pop()
            for v in nodes - set(graph[u]):
                yield (u, v)
Returns the non-existent edges in the graph.
dataset/ETHPy150Open networkx/networkx/networkx/classes/function.py/non_edges