def testDegrees(g1, g2):
    """
    Check if the graphs have the same number of vertices of different degrees.
    :param g1: The first graph.
    :param g2: The second graph.
    :return: True if both graphs have the same number of vertices of different degrees. False, otherwise.
    """
    degreesG1 = [0] * len(g1.vertices)
    degreesG2 = [0] * len(g2.vertices)
    for v in g1.vertices:
        degreesG1[v.degree] += 1
    for v in g2.vertices:
        degreesG2[v.degree] += 1

    for d in range(len(degreesG1)):
        if degreesG1[d] != degreesG2[d]:
            return False
    return True