pub struct MemmapGraph { /* private fields */ }Expand description
Memory-mapped graph for extremely large graphs that don’t fit in RAM
§Wire format (portable across 32-bit and 64-bit targets)
All integer fields are serialised as little-endian u64 (8 bytes each), even
though they are held in memory as usize. This keeps the on-disk layout
identical on 32-bit (e.g. wasm32-unknown-unknown) and 64-bit hosts so a
graph written on one can be read on the other. The conversion is checked:
reading a value that does not fit in this target’s usize returns
io::ErrorKind::InvalidData rather than truncating. See issue #125.
Implementations§
Source§impl MemmapGraph
impl MemmapGraph
Sourcepub fn from_csr<P: AsRef<Path>>(csr: &CSRGraph, path: P) -> Result<Self>
pub fn from_csr<P: AsRef<Path>>(csr: &CSRGraph, path: P) -> Result<Self>
Create a new memory-mapped graph from an existing CSR graph
Sourcepub fn neighbors(&mut self, node: usize) -> Result<Vec<(usize, f64)>>
pub fn neighbors(&mut self, node: usize) -> Result<Vec<(usize, f64)>>
Get neighbors of a node (reads from disk)
Sourcepub fn node_count(&self) -> usize
pub fn node_count(&self) -> usize
Get number of nodes
Sourcepub fn edge_count(&self) -> usize
pub fn edge_count(&self) -> usize
Get number of edges
Trait Implementations§
Auto Trait Implementations§
impl Freeze for MemmapGraph
impl RefUnwindSafe for MemmapGraph
impl Send for MemmapGraph
impl Sync for MemmapGraph
impl Unpin for MemmapGraph
impl UnsafeUnpin for MemmapGraph
impl UnwindSafe for MemmapGraph
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more