def __init__(self, edges, num_vertices=None):
tmp = []<EOL>for edge in edges:<EOL><INDENT>if len(edge) != <NUM_LIT:2>:<EOL><INDENT>raise TypeError("<STR_LIT>")<EOL><DEDENT>i, j = edge<EOL>i = int(i)<EOL>j = int(j)<EOL>if i == j:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if i < <NUM_LIT:0> or j < <NUM_LIT:0>:<EOL><INDENT>raise TypeError("<STR_LIT>")<EOL><DEDENT>tmp.append(frozenset([i, j]))<EOL><DEDENT>edges = tuple(tmp)<EOL>if len(edges) == <NUM_LIT:0>:<EOL><INDENT>real_num_vertices = <NUM_LIT:0><EOL><DEDENT>else:<EOL><INDENT>real_num_vertices = max(max(a, b) for a, b in edges)+<NUM_LIT:1><EOL><DEDENT>if num_vertices is not None:<EOL><INDENT>if not isinstance(num_vertices, int):<EOL><INDENT>raise TypeError("<STR_LIT>"<EOL>"<STR_LIT>")<EOL><DEDENT>if num_vertices < real_num_vertices:<EOL><INDENT>raise ValueError("<STR_LIT>"<EOL>"<STR_LIT>")<EOL><DEDENT>real_num_vertices = num_vertices<EOL><DEDENT>self.edges = edges<EOL>self.num_vertices = real_num_vertices<EOL>
Arguments:
 | ``edges`` -- ``tuple(frozenset([vertex1, vertex2]), ...)``
 | ``num_vertices`` -- number of vertices

vertex1 to vertexN must be integers from 0 to N-1. If vertices above
the highest vertex value are not connected by edges, use the
num_vertices argument to tell what the total number of vertices is.

If the edges argument does not have the correct format, it will be
converted.