pub struct GraphView {
pub node_count: usize,
pub index_to_node: Vec<NodeId>,
pub node_to_index: HashMap<NodeId, usize>,
pub out_offsets: Vec<usize>,
pub out_targets: Vec<usize>,
pub in_offsets: Vec<usize>,
pub in_sources: Vec<usize>,
pub weights: Option<Vec<f64>>,
}Expand description
A dense, integer-indexed view of the graph topology using Compressed Sparse Row (CSR) format.
Fields§
§node_count: usizeNumber of nodes
index_to_node: Vec<NodeId>Mapping from dense index (0..N) back to NodeId
node_to_index: HashMap<NodeId, usize>Mapping from NodeId to dense index
out_offsets: Vec<usize>Outgoing edges CSR structure
Offsets into out_targets. Size = node_count + 1
out_targets: Vec<usize>Contiguous array of target node indices
in_offsets: Vec<usize>Incoming edges CSR structure (Compressed Sparse Column effectively)
Offsets into in_sources. Size = node_count + 1
in_sources: Vec<usize>Contiguous array of source node indices
weights: Option<Vec<f64>>Edge weights: aligned with out_targets
Implementations§
Source§impl GraphView
impl GraphView
Sourcepub fn out_degree(&self, idx: usize) -> usize
pub fn out_degree(&self, idx: usize) -> usize
Get the out-degree of a node (by index)
Sourcepub fn successors(&self, idx: usize) -> &[usize]
pub fn successors(&self, idx: usize) -> &[usize]
Get outgoing neighbors (successors) of a node
Sourcepub fn predecessors(&self, idx: usize) -> &[usize]
pub fn predecessors(&self, idx: usize) -> &[usize]
Get incoming neighbors (predecessors) of a node
Auto Trait Implementations§
impl Freeze for GraphView
impl RefUnwindSafe for GraphView
impl Send for GraphView
impl Sync for GraphView
impl Unpin for GraphView
impl UnsafeUnpin for GraphView
impl UnwindSafe for GraphView
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