Skip to main content

igraph_inclist_t

Struct igraph_inclist_t 

Source
pub struct igraph_inclist_t { /* private fields */ }

Implementations§

Source§

impl igraph_inclist_t

Source

pub fn init_empty(n: usize) -> Result<Self>

Creates an incidence list for n vertices, all with empty lists (igraph_inclist_init_empty).

Useful to build a structure vertex by vertex, e.g. before turning it into a graph. Time complexity: O(n).

Binds igraph_inclist_init_empty.

§Errors

ErrorKind::InvalidValue if n does not fit in an igraph_int_t, or an out-of-memory error if it is too large to be allocated.

Source

pub fn len(&self) -> usize

Number of vertices, i.e. of lists, in the an incidence list (igraph_inclist_size).

Time complexity: O(1).

Binds igraph_inclist_size.

Source

pub fn is_empty(&self) -> bool

Whether there are no vertices at all.

Source

pub fn total_len(&self) -> usize

Total number of entries (edge ids) stored in all the lists.

Source

pub fn clear(&mut self)

Removes all edge ids from every list, keeping the number of vertices (igraph_inclist_clear).

Time complexity: O(n), n being the number of vertices.

Binds igraph_inclist_clear.

Source

pub fn as_raw_slice(&self) -> &[VectorInt] ⓘ

The per-vertex lists as a slice of owned igraph vectors.

Source

pub fn as_raw_mut_slice(&mut self) -> &mut [VectorInt] ⓘ

The per-vertex lists as a mutable slice of owned igraph vectors: every list can be resized, pushed to, sorted, or even replaced by another VectorInt.

Source

pub fn get(&self, v: VertexId) -> Option<&[igraph_int_t]>

The list of vertex v, or None if v is out of range (the igraph_inclist_get macro).

The panicking counterpart is indexing: list[v].

Source

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

The list of vertex v as a mutable VectorInt, or None if v is out of range.

Unlike IndexMut, this allows changing the length of the list (push, pop, resize, clear, …).

Source

pub fn iter(&self) -> Iter<'_> ⓘ

Iterates over the lists of the vertices 0, 1, ..., as slices.

Source

pub fn iter_mut(&mut self) -> IterMut<'_, VectorInt>

Iterates mutably over the lists of the vertices 0, 1, ....

Source

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

Copies the lists into nested Rust vectors.

Source

pub fn print(&self) -> Result<()>

Prints the lists to the standard output, one vertex per line, entries separated by spaces (igraph_inclist_print).

The same text is produced by the Display implementation and by igraph_inclist_t::fprint.

Note that the text goes to the C stdout stream, bypassing Rust’s output capturing (e.g. in cargo test): prefer println!("{list}") in Rust code.

Source

pub fn fprint(&self, out: &mut impl Write) -> Result<()>

Writes the lists to out in igraph’s textual format, one vertex per line (igraph_inclist_fprint).

The output is produced by the C library itself (through a memory stream), and it matches the Display implementation.

§Errors

ErrorKind::File if writing fails.

Source§

impl igraph_inclist_t

Source

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

Incidence list of graph: same as Graph::inclist_init.

Trait Implementations§

Source§

impl Clone for igraph_inclist_t

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for igraph_inclist_t

Source§

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

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

impl Default for igraph_inclist_t

Source§

fn default() -> Self

An empty structure with no vertices.

Source§

impl Display for igraph_inclist_t

Source§

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

One line per vertex with the entries separated by spaces, exactly like igraph_inclist_print.

Source§

impl Drop for igraph_inclist_t

Source§

fn drop(&mut self)

Frees the lists with igraph_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
Source§

impl From<&[Vec<i64>]> for igraph_inclist_t

Source§

fn from(lists: &[Vec<igraph_int_t>]) -> Self

Builds the structure from nested vectors, one per vertex.

Source§

impl From<&igraph_inclist_t> for Vec<Vec<igraph_int_t>>

Source§

fn from(list: &igraph_inclist_t) -> Self

Converts to this type from the input type.
Source§

impl From<Vec<Vec<i64>>> for igraph_inclist_t

Source§

fn from(lists: Vec<Vec<igraph_int_t>>) -> Self

Builds the structure from nested vectors, one per vertex.

Source§

impl From<igraph_inclist_t> for Vec<Vec<igraph_int_t>>

Source§

fn from(list: igraph_inclist_t) -> Self

Converts to this type from the input type.
Source§

impl FromIterator<Vec<i64>> for igraph_inclist_t

Source§

fn from_iter<I: IntoIterator<Item = Vec<igraph_int_t>>>(iter: I) -> Self

Creates a value from an iterator. Read more
Source§

impl Index<usize> for igraph_inclist_t

Source§

fn index(&self, v: usize) -> &[igraph_int_t] ⓘ

The list of the given vertex as a slice.

§Panics

If the vertex is out of range.

Source§

type Output = [i64]

The returned type after indexing.
Source§

impl IndexMut<usize> for igraph_inclist_t

Source§

fn index_mut(&mut self, v: usize) -> &mut [igraph_int_t] ⓘ

The list of the given vertex as a mutable slice (its length cannot change: use igraph_inclist_t::get_mut for that).

§Panics

If the vertex is out of range.

Source§

impl<'a> IntoIterator for &'a igraph_inclist_t

Source§

type Item = &'a [i64]

The type of the elements being iterated over.
Source§

type IntoIter = Iter<'a>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Iter<'a> ⓘ

Creates an iterator from a value. Read more
Source§

impl PartialEq for igraph_inclist_t

Source§

fn eq(&self, other: &Self) -> bool

Equal when both have the same number of vertices and the same lists, in the same order.

1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Send for igraph_inclist_t

Source§

impl Sync for igraph_inclist_t

Auto Trait Implementations§

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
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.