def _set_pattern_graph(self, pattern_graph):
self.pattern_graph = pattern_graph<EOL>self.level_edges = {}<EOL>self.level_constraints = {}<EOL>self.duplicate_checks = set([])<EOL>if pattern_graph is None:<EOL><INDENT>return<EOL><DEDENT>if len(pattern_graph.independent_vertices) != <NUM_LIT:1>:<EOL><INDENT>raise ValueError("<STR_LIT>"<EOL>"<STR_LIT>")<EOL><DEDENT>ibfe = self.pattern_graph.iter_breadth_first_edges(self.start_vertex)<EOL>for edge, distance, constraint in ibfe:<EOL><INDENT>if constraint:<EOL><INDENT>l = self.level_constraints.setdefault(distance-<NUM_LIT:1>, [])<EOL><DEDENT>else:<EOL><INDENT>l = self.level_edges.setdefault(distance, [])<EOL><DEDENT>l.append(edge)<EOL><DEDENT>if self.criteria_sets is not None:<EOL><INDENT>for cycles in pattern_graph.symmetry_cycles:<EOL><INDENT>if len(cycles) > <NUM_LIT:0>:<EOL><INDENT>self.duplicate_checks.add((cycles[<NUM_LIT:0>][<NUM_LIT:0>], cycles[<NUM_LIT:0>][<NUM_LIT:1>]))<EOL><DEDENT><DEDENT><DEDENT>
Initialize the pattern_graph