def delete_vertices(graph, dverts):
    """Delete the vertices indexed by dverts from graph; return the resulting graph."""
    vertices, edges = graph
    remverts = list(filter(lambda x: x not in dverts, range(len(vertices))))
    vmap = {v: n for (n, v) in enumerate(remverts)}
    nvertices = list(map(vertices.__getitem__, remverts))
    nedges = []
    for (a, b) in edges:
        if a in dverts or b in dverts:
            continue
        nedges.append((vmap[a], vmap[b]))
    return (nvertices, tuple(nedges))