Skip to main content

Dfs

Struct Dfs 

Source
pub struct Dfs<Node> { /* private fields */ }
Expand description

An iterative depth-first traversal.

Implementations§

Source§

impl<Node> Dfs<Node>

Source

pub fn new(roots: impl IntoIterator<Item = Node>) -> Self

Create a new DFS traversal, starting at the given roots.

Source

pub fn add_root(&mut self, root: Node)

Add a single new root to this traversal, to be visited immediately.

Source

pub fn add_roots(&mut self, roots: impl IntoIterator<Item = Node>)

Add multiple new roots to this traversal, to be visited immediately.

Source§

impl<Node> Dfs<Node>
where Node: Copy,

Source

pub fn next<G>( &mut self, graph: G, seen: impl Fn(Node) -> bool, ) -> Option<DfsEvent<Node>>
where G: Graph<Node>,

Pump the traversal, yielding the next DfsEvent.

Returns None when the traversal is complete.

Trait Implementations§

Source§

impl<Node> Default for Dfs<Node>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl<Node> Freeze for Dfs<Node>

§

impl<Node> RefUnwindSafe for Dfs<Node>
where Node: RefUnwindSafe,

§

impl<Node> Send for Dfs<Node>
where Node: Send,

§

impl<Node> Sync for Dfs<Node>
where Node: Sync,

§

impl<Node> Unpin for Dfs<Node>
where Node: Unpin,

§

impl<Node> UnwindSafe for Dfs<Node>
where Node: UnwindSafe,

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> 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> Same for T

Source§

type Output = T

Should always be Self
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.