| 144 | return self.compute_packed(topoorder), linear_data, inverse |
| 145 | |
| 146 | def _minimize(self, down_to): |
| 147 | # proceed from the leaf up to a certain point |
| 148 | for i in range(len(self.unchecked_nodes) - 1, down_to - 1, -1): |
| 149 | (parent, letter, child) = self.unchecked_nodes[i] |
| 150 | if child in self.minimized_nodes: |
| 151 | # replace the child with the previously encountered one |
| 152 | parent.edges[letter] = self.minimized_nodes[child] |
| 153 | else: |
| 154 | # add the state to the minimized nodes. |
| 155 | self.minimized_nodes[child] = child |
| 156 | self.unchecked_nodes.pop() |
| 157 | |
| 158 | def _lookup(self, word): |
| 159 | """ Return an integer 0 <= k < number of strings in dawg |