Skip to main content

LazyIncList

Struct LazyIncList 

Source
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>

Source

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.

Source

pub fn is_empty(&self) -> bool

Whether the underlying graph has no vertices.

Source

pub fn graph(&self) -> &'g Graph

The graph this lazy list reads from.

Source

pub fn mode(&self) -> NeighborMode

The effective neighbor mode (always NeighborMode::All for undirected graphs).

Source

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.

Source

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).

Source

pub fn get_mut(&mut self, v: VertexId) -> Result<&mut VectorInt>

The incident edges of vertex v as a mutable VectorInt, computed on first access.

Modifying it changes only the cached copy, never the graph.

§Errors

As get.

Source

pub fn to_vecs(&mut self) -> Result<Vec<Vec<igraph_int_t>>>

Computes (if needed) all the lists and copies them into nested Rust vectors.

§Errors

As get.

Source

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>

Source

pub fn new(graph: &'g Graph, mode: NeighborMode, loops: Loops) -> Result<Self>

Lazy incidence list of graph: same as Graph::lazy_inclist_init.

Source

pub fn loops(&self) -> Loops

The loop handling of this list, as given at creation.

Trait Implementations§

Source§

impl Debug for LazyIncList<'_>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Drop for LazyIncList<'_>

Source§

fn drop(&mut self)

Frees the cached lists with igraph_lazy_inclist_destroy.

Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more

Auto Trait Implementations§

§

impl<'g> !Send for LazyIncList<'g>

§

impl<'g> !Sync for LazyIncList<'g>

§

impl<'g> Freeze for LazyIncList<'g>

§

impl<'g> RefUnwindSafe for LazyIncList<'g>

§

impl<'g> Unpin for LazyIncList<'g>

§

impl<'g> UnsafeUnpin for LazyIncList<'g>

§

impl<'g> UnwindSafe for LazyIncList<'g>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.