pub enum VertexSelector<'a> {
All,
None,
Single(igraph_int_t),
List(Cow<'a, [igraph_int_t]>),
Range(igraph_int_t, igraph_int_t),
Adjacent {
vertex: igraph_int_t,
mode: NeighborMode,
},
NonAdjacent {
vertex: igraph_int_t,
mode: NeighborMode,
},
}Expand description
A set of vertices, see the module docs.
Variants§
All
All vertices, in increasing id order.
None
No vertex.
Single(igraph_int_t)
A single vertex.
List(Cow<'a, [igraph_int_t]>)
The listed vertices, in the given order (duplicates allowed).
Range(igraph_int_t, igraph_int_t)
Vertices with id in start..end; like a Rust range it is empty
(and selects nothing, whatever the graph) when start >= end.
Adjacent
Neighbors of a vertex, each listed once, in increasing order (loops
and multi-edges are ignored; see
Graph::adjacent_vertices for
other conventions).
Fields
vertex: igraph_int_tThe center vertex.
mode: NeighborModeWhich neighbors, for directed graphs.
NonAdjacent
Vertices not adjacent to a vertex.
Fields
vertex: igraph_int_tThe center vertex.
mode: NeighborModeWhich neighbors, for directed graphs.
Implementations§
Source§impl<'a> VertexSelector<'a>
impl<'a> VertexSelector<'a>
Sourcepub fn adjacent(vertex: igraph_int_t, mode: NeighborMode) -> Self
pub fn adjacent(vertex: igraph_int_t, mode: NeighborMode) -> Self
The neighbors of vertex (shorthand for VertexSelector::Adjacent).
Sourcepub fn non_adjacent(vertex: igraph_int_t, mode: NeighborMode) -> Self
pub fn non_adjacent(vertex: igraph_int_t, mode: NeighborMode) -> Self
The vertices not adjacent to vertex (shorthand for
VertexSelector::NonAdjacent).
Sourcepub fn into_owned(self) -> VertexSelector<'static>
pub fn into_owned(self) -> VertexSelector<'static>
An owned copy of the selector, not borrowing anything.
Source§impl VertexSelector<'_>
impl VertexSelector<'_>
Sourcepub fn to_raw(&self) -> Result<RawVs>
pub fn to_raw(&self) -> Result<RawVs>
Builds the raw igraph selector (igraph_vs_t), for calling raw FFI
functions; the safe wrappers of the crate do it for you.
Empty ranges (start >= end) become igraph_vs_none: igraph 1.0.0
and 1.0.1 would reject an empty range starting at vcount and accept
a decreasing one with a negative size.
§Errors
Only if igraph fails to build the selector (e.g. out of memory); vertex ids are validated when the selector is used.
Trait Implementations§
Source§impl<'a> Clone for VertexSelector<'a>
impl<'a> Clone for VertexSelector<'a>
Source§fn clone(&self) -> VertexSelector<'a>
fn clone(&self) -> VertexSelector<'a>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<'a> Debug for VertexSelector<'a>
impl<'a> Debug for VertexSelector<'a>
impl<'a> Eq for VertexSelector<'a>
Source§impl<'a> From<&'a Vec<i64>> for VertexSelector<'a>
impl<'a> From<&'a Vec<i64>> for VertexSelector<'a>
Source§fn from(v: &'a Vec<igraph_int_t>) -> Self
fn from(v: &'a Vec<igraph_int_t>) -> Self
Source§impl<'a, const N: usize> From<&'a [i64; N]> for VertexSelector<'a>
impl<'a, const N: usize> From<&'a [i64; N]> for VertexSelector<'a>
Source§fn from(v: &'a [igraph_int_t; N]) -> Self
fn from(v: &'a [igraph_int_t; N]) -> Self
Source§impl<'a> From<&'a [i64]> for VertexSelector<'a>
impl<'a> From<&'a [i64]> for VertexSelector<'a>
Source§fn from(v: &'a [igraph_int_t]) -> Self
fn from(v: &'a [igraph_int_t]) -> Self
Source§impl<'a> From<&'a igraph_vector_int_t> for VertexSelector<'a>
impl<'a> From<&'a igraph_vector_int_t> for VertexSelector<'a>
Source§impl From<Range<i64>> for VertexSelector<'_>
impl From<Range<i64>> for VertexSelector<'_>
Source§fn from(r: Range<igraph_int_t>) -> Self
fn from(r: Range<igraph_int_t>) -> Self
Source§impl From<RangeFull> for VertexSelector<'_>
impl From<RangeFull> for VertexSelector<'_>
Source§impl From<RangeInclusive<i64>> for VertexSelector<'_>
impl From<RangeInclusive<i64>> for VertexSelector<'_>
Source§fn from(r: RangeInclusive<igraph_int_t>) -> Self
fn from(r: RangeInclusive<igraph_int_t>) -> Self
a..=b selects the vertices a, a + 1, ..., b (none if a > b).
Source§impl From<Vec<i64>> for VertexSelector<'_>
impl From<Vec<i64>> for VertexSelector<'_>
Source§fn from(v: Vec<igraph_int_t>) -> Self
fn from(v: Vec<igraph_int_t>) -> Self
Source§impl From<i64> for VertexSelector<'_>
impl From<i64> for VertexSelector<'_>
Source§fn from(v: igraph_int_t) -> Self
fn from(v: igraph_int_t) -> Self
Source§impl<'a> PartialEq for VertexSelector<'a>
impl<'a> PartialEq for VertexSelector<'a>
Source§fn eq(&self, other: &VertexSelector<'a>) -> bool
fn eq(&self, other: &VertexSelector<'a>) -> bool
self and other values to be equal, and is used by ==.