(self, obj, level=1, fmt='{0}({1})')
| 212 | return '\n'.join(self.repr_node(N) for N in self) |
| 213 | |
| 214 | def repr_node(self, obj, level=1, fmt='{0}({1})'): |
| 215 | output = [fmt.format(obj, self.valency_of(obj))] |
| 216 | if obj in self: |
| 217 | for other in self[obj]: |
| 218 | d = fmt.format(other, self.valency_of(other)) |
| 219 | output.append(' ' * level + d) |
| 220 | output.extend(self.repr_node(other, level + 1).split('\n')[1:]) |
| 221 | return '\n'.join(output) |
| 222 | |
| 223 | |
| 224 | class GraphFormatter: |