def make_merge_map(G, w1, w2):
    """ Make a list to denote the merging of two vertices.

    The list "maps" the indices of vertices in the unmerged graph to the
    indices of the vertices in the merged graph.

    For example, merging vertices 2 and 4 might consist of the list
    [1, 2, 0, 3, 0, 4, 5] or [0, 1, 2, 3, 2, 4, 5], i.e., index i of the
    list is the "old index" and the value is the new index, but it doesn't
    matter which new indices you choose, just which vertices are mapped to
    the same index.
    """
    n = len(G.vs)
    no_offset = list(range(w2.index))
    offset_part = [w1.index] + [w2.index + j for j in range(n - w2.index - 1)]
    return no_offset + offset_part