pub struct DfsOptions {
pub mode: NeighborMode,
pub unreachable: bool,
}Expand description
Parameters of a depth-first search (Graph::dfs, Graph::dfs_with).
The defaults are: follow out-edges (NeighborMode::Out) and do not
visit vertices unreachable from the root.
use igraph::prelude::*;
use igraph::visitor::DfsOptions;
// 0 -> 1, 2 -> 1: walking against the edges from 1 finds 0 and 2.
let g = Graph::from_edges(&[(0, 1), (2, 1)], 3, true)?;
let opts = DfsOptions::default().with_mode(NeighborMode::In);
assert_eq!(g.dfs(1, &opts)?.order, [1, 0, 2]);
assert_eq!(g.dfs(1, &DfsOptions::default())?.order, [1]);Fields§
§mode: NeighborModeWhich edges to follow in directed graphs (see BfsOptions::mode).
Ignored for undirected graphs.
unreachable: boolIf true, once the tree of the root is complete, further searches are
started from the not yet visited vertices, in increasing id order.
Implementations§
Source§impl DfsOptions
impl DfsOptions
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.
Trait Implementations§
Source§impl Clone for DfsOptions
impl Clone for DfsOptions
Source§fn clone(&self) -> DfsOptions
fn clone(&self) -> DfsOptions
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for DfsOptions
Source§impl Debug for DfsOptions
impl Debug for DfsOptions
Source§impl Default for DfsOptions
impl Default for DfsOptions
impl Eq for DfsOptions
Source§impl PartialEq for DfsOptions
impl PartialEq for DfsOptions
Source§fn eq(&self, other: &DfsOptions) -> bool
fn eq(&self, other: &DfsOptions) -> bool
Tests for
self and other values to be equal, and is used by ==.impl StructuralPartialEq for DfsOptions
Auto Trait Implementations§
impl Freeze for DfsOptions
impl RefUnwindSafe for DfsOptions
impl Send for DfsOptions
impl Sync for DfsOptions
impl Unpin for DfsOptions
impl UnsafeUnpin for DfsOptions
impl UnwindSafe for DfsOptions
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more