4 ms·
For "proper" graphs, petgraph: https://crates.io/crates/petgraph https://crates.io/crates/petgraph For trees without parent pointers: Just roll your own along
by gpm 4y ago
For "proper" graphs, petgraph: https://crates.io/crates/petgraph https://crates.io/crates/petgraph
For trees without parent pointers: Just roll your own along the lines of the following. This fits nicely into rust's ownership semantics
struct Node<T> {
children: Vec<Node<T>>
}
For trees with parent pointers, I'm not sure what's most common. Potentially Rc with Weak, potentially petgraph, maybe something else.