def get_halfs_double(self, vertex_a1, vertex_b1, vertex_a2, vertex_b2):
if vertex_a1 not in self.neighbors[vertex_b1]:<EOL><INDENT>raise GraphError("<STR_LIT>")<EOL><DEDENT>if vertex_a2 not in self.neighbors[vertex_b2]:<EOL><INDENT>raise GraphError("<STR_LIT>")<EOL><DEDENT>vertex_a_new = set(self.neighbors[vertex_a1])<EOL>vertex_a_new.discard(vertex_b1)<EOL>if vertex_a1 == vertex_b2:<EOL><INDENT>vertex_a2, vertex_b2 = vertex_b2, vertex_a2<EOL><DEDENT>if vertex_a1 == vertex_a2:<EOL><INDENT>vertex_a_new.discard(vertex_b2) <EOL><DEDENT>vertex_a_part = set([vertex_a1])<EOL>touched = False <EOL>while len(vertex_a_new) > <NUM_LIT:0>:<EOL><INDENT>pivot = vertex_a_new.pop()<EOL>if pivot == vertex_b1:<EOL><INDENT>raise GraphError("<STR_LIT>"<EOL>"<STR_LIT>")<EOL><DEDENT>vertex_a_part.add(pivot)<EOL>pivot_neighbors = set(self.neighbors[pivot])<EOL>pivot_neighbors -= vertex_a_part<EOL>if pivot == vertex_a2 or pivot == vertex_b2:<EOL><INDENT>if pivot == vertex_b2:<EOL><INDENT>if touched:<EOL><INDENT>raise GraphError("<STR_LIT>"<EOL>"<STR_LIT>"<EOL>"<STR_LIT>")<EOL><DEDENT>else:<EOL><INDENT>vertex_a2, vertex_b2 = vertex_b2, vertex_a2<EOL><DEDENT><DEDENT>pivot_neighbors.discard(vertex_b2)<EOL>touched = True<EOL><DEDENT>vertex_a_new |= pivot_neighbors<EOL><DEDENT>if vertex_a2 not in vertex_a_part:<EOL><INDENT>raise GraphError("<STR_LIT>"<EOL>"<STR_LIT>"<EOL>"<STR_LIT>")<EOL><DEDENT>if vertex_b1 == vertex_b2:<EOL><INDENT>closed = True<EOL><DEDENT>else:<EOL><INDENT>vertex_b_new = set(self.neighbors[vertex_b1])<EOL>vertex_b_new.discard(vertex_a1)<EOL>vertex_b_part = set([vertex_b1])<EOL>closed = False<EOL>while len(vertex_b_new) > <NUM_LIT:0>:<EOL><INDENT>pivot = vertex_b_new.pop()<EOL>if pivot == vertex_b2:<EOL><INDENT>closed = True<EOL>break<EOL><DEDENT>pivot_neighbors = set(self.neighbors[pivot])<EOL>pivot_neighbors -= vertex_b_part<EOL>vertex_b_new |= pivot_neighbors<EOL>vertex_b_part.add(pivot)<EOL><DEDENT><DEDENT>if not closed:<EOL><INDENT>raise GraphError("<STR_LIT>"<EOL>"<STR_LIT>"<EOL>"<STR_LIT>")<EOL><DEDENT>vertex_b_part = set(range(self.num_vertices)) - vertex_a_part<EOL>return vertex_a_part, vertex_b_part,(vertex_a1, vertex_b1, vertex_a2, vertex_b2)<EOL>
Compute the two parts separated by ``(vertex_a1, vertex_b1)`` and ``(vertex_a2, vertex_b2)``

           Raise a GraphError when ``(vertex_a1, vertex_b1)`` and
           ``(vertex_a2, vertex_b2)`` do not separate the graph in two
           disconnected parts. The edges must be neighbors. If not a GraphError
           is raised. The for vertices must not coincide or a GraphError is
           raised.

           Returns the vertices of the two halfs and the four 'hinge' vertices
           in the correct order, i.e. both ``vertex_a1`` and ``vertex_a2`` are
           in the first half and both ``vertex_b1`` and ``vertex_b2`` are in the
           second half.