Skip to main content

VertexSelector

Enum VertexSelector 

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

The center vertex.

§mode: NeighborMode

Which neighbors, for directed graphs.

§

NonAdjacent

Vertices not adjacent to a vertex.

Fields

§vertex: igraph_int_t

The center vertex.

§mode: NeighborMode

Which neighbors, for directed graphs.

Implementations§

Source§

impl<'a> VertexSelector<'a>

Source

pub fn adjacent(vertex: igraph_int_t, mode: NeighborMode) -> Self

The neighbors of vertex (shorthand for VertexSelector::Adjacent).

Source

pub fn non_adjacent(vertex: igraph_int_t, mode: NeighborMode) -> Self

The vertices not adjacent to vertex (shorthand for VertexSelector::NonAdjacent).

Source

pub fn into_owned(self) -> VertexSelector<'static>

An owned copy of the selector, not borrowing anything.

Source§

impl VertexSelector<'_>

Source

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>

Source§

fn clone(&self) -> VertexSelector<'a>

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<'a> Debug for VertexSelector<'a>

Source§

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

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

impl<'a> Eq for VertexSelector<'a>

Source§

impl<'a> From<&'a Vec<i64>> for VertexSelector<'a>

Source§

fn from(v: &'a Vec<igraph_int_t>) -> Self

Converts to this type from the input type.
Source§

impl<'a, const N: usize> From<&'a [i64; N]> for VertexSelector<'a>

Source§

fn from(v: &'a [igraph_int_t; N]) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<&'a [i64]> for VertexSelector<'a>

Source§

fn from(v: &'a [igraph_int_t]) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<&'a igraph_vector_int_t> for VertexSelector<'a>

Source§

fn from(v: &'a VectorInt) -> Self

Converts to this type from the input type.
Source§

impl From<Range<i64>> for VertexSelector<'_>

Source§

fn from(r: Range<igraph_int_t>) -> Self

Converts to this type from the input type.
Source§

impl From<RangeFull> for VertexSelector<'_>

Source§

fn from(_: RangeFull) -> Self

Converts to this type from the input type.
Source§

impl From<RangeInclusive<i64>> for VertexSelector<'_>

Source§

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<'_>

Source§

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

Converts to this type from the input type.
Source§

impl From<i64> for VertexSelector<'_>

Source§

fn from(v: igraph_int_t) -> Self

Converts to this type from the input type.
Source§

impl<'a> PartialEq for VertexSelector<'a>

Source§

fn eq(&self, other: &VertexSelector<'a>) -> bool

Tests for self and other values to be equal, and is used by ==.
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<'a> StructuralPartialEq for VertexSelector<'a>

Auto Trait Implementations§

§

impl<'a> Freeze for VertexSelector<'a>

§

impl<'a> RefUnwindSafe for VertexSelector<'a>

§

impl<'a> Send for VertexSelector<'a>

§

impl<'a> Sync for VertexSelector<'a>

§

impl<'a> Unpin for VertexSelector<'a>

§

impl<'a> UnsafeUnpin for VertexSelector<'a>

§

impl<'a> UnwindSafe for VertexSelector<'a>

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