pub trait GraphRef {
// Required methods
fn node_count(&self) -> usize;
fn neighbors_ref(&self, node: usize) -> &[usize];
// Provided method
fn out_degree(&self, node: usize) -> usize { ... }
}Expand description
A graph view that can return borrowed neighbor slices.
This is the “cache-friendly” adapter: it avoids allocating a new Vec
on every step of a random walk.