pub struct igraph_inclist_t { /* private fields */ }Implementations§
Source§impl igraph_inclist_t
impl igraph_inclist_t
Sourcepub fn init_empty(n: usize) -> Result<Self>
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.
Sourcepub fn len(&self) -> usize
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.
Sourcepub fn clear(&mut self)
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.
Sourcepub fn as_raw_slice(&self) -> &[VectorInt] ⓘ
pub fn as_raw_slice(&self) -> &[VectorInt] ⓘ
The per-vertex lists as a slice of owned igraph vectors.
Sourcepub fn as_raw_mut_slice(&mut self) -> &mut [VectorInt] ⓘ
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.
Sourcepub fn get(&self, v: VertexId) -> Option<&[igraph_int_t]>
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].
Sourcepub fn get_mut(&mut self, v: VertexId) -> Option<&mut VectorInt>
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, …).
Sourcepub fn iter_mut(&mut self) -> IterMut<'_, VectorInt>
pub fn iter_mut(&mut self) -> IterMut<'_, VectorInt>
Iterates mutably over the lists of the vertices 0, 1, ....
Sourcepub fn to_vecs(&self) -> Vec<Vec<igraph_int_t>>
pub fn to_vecs(&self) -> Vec<Vec<igraph_int_t>>
Copies the lists into nested Rust vectors.
Sourcepub fn print(&self) -> Result<()>
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.
Sourcepub fn fprint(&self, out: &mut impl Write) -> Result<()>
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
impl igraph_inclist_t
Sourcepub fn new(graph: &Graph, mode: NeighborMode, loops: Loops) -> Result<Self>
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
impl Clone for igraph_inclist_t
Source§impl Debug for igraph_inclist_t
impl Debug for igraph_inclist_t
Source§impl Default for igraph_inclist_t
impl Default for igraph_inclist_t
Source§impl Display for igraph_inclist_t
impl Display for igraph_inclist_t
Source§impl Drop for igraph_inclist_t
impl Drop for igraph_inclist_t
Source§impl From<&[Vec<i64>]> for igraph_inclist_t
impl From<&[Vec<i64>]> for igraph_inclist_t
Source§fn from(lists: &[Vec<igraph_int_t>]) -> Self
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>>
impl From<&igraph_inclist_t> for Vec<Vec<igraph_int_t>>
Source§fn from(list: &igraph_inclist_t) -> Self
fn from(list: &igraph_inclist_t) -> Self
Source§impl From<igraph_inclist_t> for Vec<Vec<igraph_int_t>>
impl From<igraph_inclist_t> for Vec<Vec<igraph_int_t>>
Source§fn from(list: igraph_inclist_t) -> Self
fn from(list: igraph_inclist_t) -> Self
Source§impl FromIterator<Vec<i64>> for igraph_inclist_t
impl FromIterator<Vec<i64>> for igraph_inclist_t
Source§fn from_iter<I: IntoIterator<Item = Vec<igraph_int_t>>>(iter: I) -> Self
fn from_iter<I: IntoIterator<Item = Vec<igraph_int_t>>>(iter: I) -> Self
Source§impl Index<usize> for igraph_inclist_t
impl Index<usize> for igraph_inclist_t
Source§impl IndexMut<usize> for igraph_inclist_t
impl IndexMut<usize> for igraph_inclist_t
Source§fn index_mut(&mut self, v: usize) -> &mut [igraph_int_t] ⓘ
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.