pub struct LazyIncList<'g> { /* private fields */ }Expand description
Lazy incidence list (igraph_lazy_inclist_t) borrowing a graph: the
incident edges of each vertex are queried on first access and cached.
Create it with Graph::lazy_inclist_init or LazyIncList::new.
Implementations§
Source§impl<'g> LazyIncList<'g>
impl<'g> LazyIncList<'g>
Sourcepub fn len(&self) -> usize
pub fn len(&self) -> usize
Number of vertices of the lazy incidence list, i.e. of the graph (igraph_lazy_inclist_size).
Binds igraph_lazy_inclist_size.
Sourcepub fn mode(&self) -> NeighborMode
pub fn mode(&self) -> NeighborMode
The effective neighbor mode (always NeighborMode::All for
undirected graphs).
Sourcepub fn has(&self, v: VertexId) -> bool
pub fn has(&self, v: VertexId) -> bool
Whether the incident edges of vertex v were already computed and cached.
Returns false for out-of-range vertices. Time complexity: O(1).
Binds the igraph_lazy_inclist_has macro.
Sourcepub fn get(&mut self, v: VertexId) -> Result<&[igraph_int_t]>
pub fn get(&mut self, v: VertexId) -> Result<&[igraph_int_t]>
The incident edges of vertex v, computed on the first call and cached afterwards.
The returned slice borrows the lazy list mutably, so copy it
(.to_vec()) if you need to query other vertices while using
it. Time complexity: O(d) on the first call for a vertex of
degree d, O(1) afterwards.
Binds the igraph_lazy_inclist_get macro.
§Errors
ErrorKind::InvalidVertexId if v is out of range, or an
igraph error if the list cannot be computed (out of memory).
Sourcepub fn clear(&mut self)
pub fn clear(&mut self)
Forgets all the cached lists (igraph_lazy_inclist_clear); they will be recomputed on demand.
Any edits made through get_mut are lost.
Binds igraph_lazy_inclist_clear.
Source§impl<'g> LazyIncList<'g>
impl<'g> LazyIncList<'g>
Sourcepub fn new(graph: &'g Graph, mode: NeighborMode, loops: Loops) -> Result<Self>
pub fn new(graph: &'g Graph, mode: NeighborMode, loops: Loops) -> Result<Self>
Lazy incidence list of graph: same as Graph::lazy_inclist_init.