pub struct BfsOptions<'a> {
pub mode: NeighborMode,
pub unreachable: bool,
pub restricted: Option<&'a [VertexId]>,
}Expand description
Parameters of a breadth-first search (Graph::bfs, Graph::bfs_with).
The defaults are: follow out-edges (NeighborMode::Out), do not
visit vertices unreachable from the roots, no restriction.
use igraph::prelude::*;
use igraph::visitor::BfsOptions;
let restricted = [0, 1, 2];
let opts = BfsOptions::default()
.with_mode(NeighborMode::All)
.with_unreachable(true)
.with_restricted(&restricted);
assert_eq!(opts.mode, NeighborMode::All);
assert!(opts.unreachable);
assert_eq!(opts.restricted, Some(&restricted[..]));Fields§
§mode: NeighborModeWhich edges to follow in directed graphs: NeighborMode::Out follows
the edge directions, NeighborMode::In goes against them and
NeighborMode::All ignores them. Ignored for undirected graphs.
unreachable: boolIf true, once the roots are exhausted, further searches are started
from the not yet visited vertices, in increasing id order, until every
(allowed) vertex has been visited.
restricted: Option<&'a [VertexId]>If set, the search only walks on these vertices: every other vertex is treated as already visited (even when it is given as a root, in which case it is silently skipped).
Implementations§
Source§impl<'a> BfsOptions<'a>
impl<'a> BfsOptions<'a>
Sourcepub fn with_mode(self, mode: NeighborMode) -> Self
pub fn with_mode(self, mode: NeighborMode) -> Self
Sets mode.
Sourcepub fn with_unreachable(self, unreachable: bool) -> Self
pub fn with_unreachable(self, unreachable: bool) -> Self
Sets unreachable.
Sourcepub fn with_restricted(self, vertices: &'a [VertexId]) -> Self
pub fn with_restricted(self, vertices: &'a [VertexId]) -> Self
Sets restricted to Some(vertices).
Trait Implementations§
Source§impl<'a> Clone for BfsOptions<'a>
impl<'a> Clone for BfsOptions<'a>
Source§fn clone(&self) -> BfsOptions<'a>
fn clone(&self) -> BfsOptions<'a>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl<'a> Copy for BfsOptions<'a>
Source§impl<'a> Debug for BfsOptions<'a>
impl<'a> Debug for BfsOptions<'a>
Source§impl Default for BfsOptions<'_>
impl Default for BfsOptions<'_>
impl<'a> Eq for BfsOptions<'a>
Source§impl<'a> PartialEq for BfsOptions<'a>
impl<'a> PartialEq for BfsOptions<'a>
Source§fn eq(&self, other: &BfsOptions<'a>) -> bool
fn eq(&self, other: &BfsOptions<'a>) -> bool
self and other values to be equal, and is used by ==.