3 ms·
This is really the only practical way to do it, yes. But it's gross and means that you have to write custom code to print the data structures. That might sound
by foldr 9y ago
This is really the only practical way to do it, yes. But it's gross and means that you have to write custom code to print the data structures. That might sound trivial, but the ability to autoderive pretty printers is super useful when debugging.
- steveklabnik 9y agoOr just use petgraph, which does this for you.
- foldr 9y agoThat's fine if you're actually running a bunch of graph algorithms, but it's not a good fit for, e.g., a parse tree where each node has a link to its parent as well as links to its children. At least, I for one don't want to have to pull in a relatively large library just to define such a simple data structure.