pub struct Graph {
pub offsets: Vec<usize>,
pub targets: Vec<usize>,
pub weights: Vec<f64>,
pub n_nodes: usize,
}Expand description
A directed, weighted graph in CSR form.
Fields§
§offsets: Vec<usize>offsets[i] .. offsets[i + 1] is the slice of out-edges of node i.
targets: Vec<usize>Destination node of each out-edge, grouped by source node.
weights: Vec<f64>Weight (e.g. length or travel time) of each out-edge.
n_nodes: usizeNumber of nodes.
Implementations§
Source§impl Graph
impl Graph
Sourcepub fn from_edges(
from: &[usize],
to: &[usize],
weight: &[f64],
n_nodes: usize,
) -> Self
pub fn from_edges( from: &[usize], to: &[usize], weight: &[f64], n_nodes: usize, ) -> Self
Build a CSR graph from parallel from/to/weight edge vectors.
n_nodes is the number of distinct node indices; every value in
from/to must be in 0 .. n_nodes.
Auto Trait Implementations§
impl Freeze for Graph
impl RefUnwindSafe for Graph
impl Send for Graph
impl Sync for Graph
impl Unpin for Graph
impl UnsafeUnpin for Graph
impl UnwindSafe for Graph
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more