Make up an ID for a sequence (list) of nodes. Note: `getrandbits()` is very uninformative as a "readable" ID. Here, we build a name such that when the mouse hovers over the drawn node in Jupyter, one can figure out which original nodes make up the sequence. This is actually q
(self, sequence)
| 295 | |
| 296 | |
| 297 | def sequence_id(self, sequence): |
| 298 | """Make up an ID for a sequence (list) of nodes. |
| 299 | Note: `getrandbits()` is very uninformative as a "readable" ID. Here, we build a name |
| 300 | such that when the mouse hovers over the drawn node in Jupyter, one can figure out |
| 301 | which original nodes make up the sequence. This is actually quite useful. |
| 302 | """ |
| 303 | if self.meaningful_ids: |
| 304 | # TODO: This might fail if the ID becomes too long |
| 305 | return "><".join([node.id for node in sequence]) |
| 306 | else: |
| 307 | return getrandbits(64) |
| 308 | |
| 309 | def build_dot(self): |
| 310 | """Generate a GraphViz Dot graph. |