Hacker News new | ask | show | jobs
by bennofs 3413 days ago
A possibility is to use a different representation for graphs, such as adjacency matrices, which are much easier to work with the borrow checker.

Or just use RefCell, deferring the borrow checking until runtime.

Another strategy could be to give every node an explicit ID, and then have a mapping ID -> node. Every else you just refer to the nodes by their IDs.