(self, graph)
| 89 | self.pattern = ge.GEParser(pattern).parse() |
| 90 | |
| 91 | def apply(self, graph): |
| 92 | # Copy the graph. Don't change the original. |
| 93 | graph = copy.deepcopy(graph) |
| 94 | |
| 95 | while True: |
| 96 | matches, _ = graph.search(self.pattern) |
| 97 | if not matches: |
| 98 | break |
| 99 | # Remove found nodes |
| 100 | graph.remove(matches) |
| 101 | return graph |
| 102 | |
| 103 | |
| 104 | class PruneBranch(): |