pub struct CsrMmapGraph {
pub node_count: usize,
pub edge_count: usize,
pub vector_dim: usize,
pub flags: u32,
/* private fields */
}Expand description
Memory-mapped CSR graph reader with safe unaligned loads.
Fields§
§node_count: usizeNumber of nodes in the CSR graph.
edge_count: usizeNumber of edges.
vector_dim: usizeEmbedding dimension (0 when no vectors are stored).
flags: u32Header flags bitfield.
Implementations§
Source§impl CsrMmapGraph
impl CsrMmapGraph
Sourcepub fn open<P: AsRef<Path>>(path: P) -> Result<Self>
pub fn open<P: AsRef<Path>>(path: P) -> Result<Self>
Open and fully validate a graph.mmap file.
Sourcepub fn get_neighbors(&self, node_idx: usize) -> (Vec<u32>, Vec<f32>)
pub fn get_neighbors(&self, node_idx: usize) -> (Vec<u32>, Vec<f32>)
Graph neighbors as owned vectors (safe, allocation per call).
Sourcepub fn k_hop_neighborhood(
&self,
start_node_idx: usize,
k: usize,
) -> Vec<(u32, f32)>
pub fn k_hop_neighborhood( &self, start_node_idx: usize, k: usize, ) -> Vec<(u32, f32)>
k-hop neighborhood with multiplicative path weights (first visit wins).
Sourcepub fn get_vector(&self, node_idx: usize) -> Option<Vec<f32>>
pub fn get_vector(&self, node_idx: usize) -> Option<Vec<f32>>
Copy out the vector row for node_idx (None if no vectors).
Sourcepub fn dot_product(a: &[f32], b: &[f32]) -> f32
pub fn dot_product(a: &[f32], b: &[f32]) -> f32
Dot product with an unrolled loop (may auto-vectorize; not explicit SIMD).
Trait Implementations§
Auto Trait Implementations§
impl Freeze for CsrMmapGraph
impl RefUnwindSafe for CsrMmapGraph
impl Send for CsrMmapGraph
impl Sync for CsrMmapGraph
impl Unpin for CsrMmapGraph
impl UnsafeUnpin for CsrMmapGraph
impl UnwindSafe for CsrMmapGraph
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