3 ms·
>In Rust, does the standard way of implementing a graph structure still use a vector of nodes and indices for edges? You'd probably want to do this whenever yo
by holy_city 7y ago
>In Rust, does the standard way of implementing a graph structure still use a vector of nodes and indices for edges?
You'd probably want to do this whenever you implement a graph in a performant language, it's faster and safer (depending on the problem). Implementing edges as vectors of pointers is an exercise in memory leaks and data races, imo.
You can see an implementation with adjacency lists here:
https://github.com/bluss/petgraph/blob/master/src/graph_impl/stable_graph/mod.rs#L103 https://github.com/bluss/petgraph/blob/master/src/graph_impl...
>I think I saw a Rust implementation of an arena. Is it working?
https://docs.rs/typed-arena/1.4.1/typed_arena/ https://docs.rs/typed-arena/1.4.1/typed_arena/