def _BorderEdges(facelist):
    """Return a set of (u,v) where u and v are successive vertex indices
    in some face in the list in facelist."""

    ans = set()
    for i in range(0, len(facelist)):
        f = facelist[i]
        for j in range(1, len(f)):
            ans.add((f[j - 1], f[j]))
        ans.add((f[-1], f[0]))
    return ans