def flip_edge(graph, edge):
    """
    Flips an edge in a networkx graph.
    :param graph: a target graph
    :param edge: edge to flip
    :return: None
    """
    if graph.has_edge(*edge):
        graph.remove_edge(*edge)
    else:
        graph.add_edge(*edge)
    return None