pub struct Graph<'a, N> { /* private fields */ }Expand description
This structure holds a graph in the Compressed Sparse Row format for compression of data size. This graph is represented via Memory Mapping, allowing the graph to be loaded into memory as required. This makes it possible to load any-size graphs, even those that do not fit into memory!
Implementations
sourceimpl<'a, N> Graph<'a, N> where
N: ValidGraphType,
N: 'a,
impl<'a, N> Graph<'a, N> where
N: ValidGraphType,
N: 'a,
sourcepub fn from_txt_adjacency_list<T>(
stream: T,
folder_name: &str
) -> Result<Graph<'a, N>, Error> where
T: Read + Sized,
pub fn from_txt_adjacency_list<T>(
stream: T,
folder_name: &str
) -> Result<Graph<'a, N>, Error> where
T: Read + Sized,
Convenience method for reading an input stream in text format.
Each line should contain two numbers, separated by a space.
The graph will be converted to the underlying CSR representation, and stored in folder_name.
sourcepub fn from_binary_adjancency<T>(
stream: T,
destination_folder_name: &str
) -> Result<Graph<'a, N>, Error> where
T: Read + Sized,
pub fn from_binary_adjancency<T>(
stream: T,
destination_folder_name: &str
) -> Result<Graph<'a, N>, Error> where
T: Read + Sized,
Same as from_txt_adjacency, except this time it assumes the edge list to be in binary representation.
sourcepub fn from_adjacency_list<T>(
stream: T,
folder_name: &str
) -> Result<Graph<'a, N>, Error> where
T: Iterator<Item = Result<(N, N)>> + Sized,
pub fn from_adjacency_list<T>(
stream: T,
folder_name: &str
) -> Result<Graph<'a, N>, Error> where
T: Iterator<Item = Result<(N, N)>> + Sized,
Given a SORTED (by source) adjancency list file source_file_name, transforms this file
into the underlying binary representation in CSR and returns a version of the Graph in this format.
The graph will be stored in folder_name.
sourcepub fn load_graph(graph_folder: &str) -> Result<Graph<'a, N>, Error>
pub fn load_graph(graph_folder: &str) -> Result<Graph<'a, N>, Error>
Loads a graph from the underlying representation and returns it as a Graph struct.
sourcepub fn iter(&'a self) -> GraphIterator<'a, N>ⓘNotable traits for GraphIterator<'a, N>impl<'a, N> Iterator for GraphIterator<'a, N> where
N: ValidGraphType, type Item = &'a [N];
pub fn iter(&'a self) -> GraphIterator<'a, N>ⓘNotable traits for GraphIterator<'a, N>impl<'a, N> Iterator for GraphIterator<'a, N> where
N: ValidGraphType, type Item = &'a [N];
N: ValidGraphType, type Item = &'a [N];
Returns an iterator over the edge list of each node.
Auto Trait Implementations
impl<'a, N> RefUnwindSafe for Graph<'a, N> where
N: RefUnwindSafe,
impl<'a, N> !Send for Graph<'a, N>
impl<'a, N> !Sync for Graph<'a, N>
impl<'a, N> Unpin for Graph<'a, N>
impl<'a, N> !UnwindSafe for Graph<'a, N>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more