Expand description
Minimal graph adapter traits.
Every operator in this crate is generic over one of these traits, so callers can plug in any representation that exposes node count and a neighbor query. Four traits cover the product of two axes: owned vs borrowed neighbor lists, unweighted vs weighted edges.
| Unweighted | Weighted | |
|---|---|---|
Owned Vec | Graph | WeightedGraph |
| Borrowed slice | GraphRef | WeightedGraphRef |
Pick the owned variant for ease of implementation; pick the borrowed variant when the operator runs in a tight loop (random walks, message passing) and neighbor-list allocation would dominate.
Structs§
- Adjacency
Matrix - Row-major adjacency-matrix adapter.
- Petgraph
Ref - Pre-built adjacency list adapter for petgraph graphs.
Converts a petgraph graph into a structure implementing
GraphRefby pre-computing neighbor lists.
Traits§
- Graph
- Owned-neighbor graph adapter. The simplest adapter to implement — each
neighbors(node)call returns a freshVec. - Graph
Ref - Graph view that returns borrowed neighbor slices, avoiding per-query allocation.
- Weighted
Graph - Graph with scalar
f64edge weights. - Weighted
Graph Ref - Weighted graph view returning borrowed
(neighbors, weights)slice pairs.