def iter_halfs_bend(graph):
for atom2 in range(graph.num_vertices):<EOL><INDENT>neighbors = list(graph.neighbors[atom2])<EOL>for index1, atom1 in enumerate(neighbors):<EOL><INDENT>for atom3 in neighbors[index1+<NUM_LIT:1>:]:<EOL><INDENT>try:<EOL><INDENT>affected_atoms = graph.get_halfs(atom2, atom1)[<NUM_LIT:0>]<EOL>yield affected_atoms, (atom1, atom2, atom3)<EOL>continue<EOL><DEDENT>except GraphError:<EOL><INDENT>pass<EOL><DEDENT>try:<EOL><INDENT>affected_atoms = graph.get_halfs(atom2, atom3)[<NUM_LIT:0>]<EOL>yield affected_atoms, (atom3, atom2, atom1)<EOL><DEDENT>except GraphError:<EOL><INDENT>pass<EOL><DEDENT><DEDENT><DEDENT><DEDENT>
Select randomly two consecutive bonds that divide the molecule in two