def create_color_dict(g, h):
    """
    Creates the color dict based on the colornums of the vertices in graphs g and h.
    """
    colors = {}
    colors_get = colors.get
    for v in g._V:
        l = colors_get(v.colornum, [])
        l.append(v)
        colors[v.colornum] = l
    for v in h._V:
        l = colors_get(v.colornum, [])
        l.append(v)
        colors[v.colornum] = l

    return colors