def _delete_edge(edges_from, n, to):
    """
    Removes an edge from the graph.

    @param      edges_from      structure which contains the edges (will be modified)
    @param      n               first vertex
    @param      to              second vertex
    @return                     the edge
    """
    le = edges_from[to]
    f = None
    for i, e in enumerate(le):
        if e[1] == to and e[2] == n or e[2] == to and e[1] == n:
            f = i
            break
    assert f is not None
    del le[f]
    if len(le) == 0:
        del edges_from[to]
    le = edges_from[n]
    f = None
    for i, e in enumerate(le):
        if e[1] == to and e[2] == n or e[2] == to and e[1] == n:
            f = i
            break
    assert f is not None
    keep = le[f]
    del le[f]
    if len(le) == 0:
        del edges_from[n]
    return keep
