Struct Digraph

Source
pub struct Digraph<Node: Hash + Eq, Edge> { /* private fields */ }

Implementations§

Source§

impl<Node: Hash + Eq, Edge> Digraph<Node, Edge>

Source

pub fn new() -> Self

Source

pub fn add_node(&mut self, node: Node)

Source

pub fn add_edge(&mut self, u: Node, e: Edge, v: Node)

Source

pub fn out_of(&self, node: Node) -> Option<&Vec<(Edge, Node)>>

Source

pub fn nodes(&self) -> Vec<&Node>

Source

pub fn node_count(&self) -> usize

Source§

impl<Node: Hash + Eq + Clone, Edge> Digraph<Node, Edge>

Source

pub fn dfs<F>(&self, f: F, start: Node)
where F: FnMut(Node),

Conducts a depth-first search (DFS) starting from start, calling f on each node encountered in DFS order. This function performs multiple clone()s of the nodes, which is still performant when nodes are smart pointers such as Rc.

Requires: start is in the graph.

Auto Trait Implementations§

§

impl<Node, Edge> Freeze for Digraph<Node, Edge>

§

impl<Node, Edge> RefUnwindSafe for Digraph<Node, Edge>
where Node: RefUnwindSafe, Edge: RefUnwindSafe,

§

impl<Node, Edge> Send for Digraph<Node, Edge>
where Node: Send, Edge: Send,

§

impl<Node, Edge> Sync for Digraph<Node, Edge>
where Node: Sync, Edge: Sync,

§

impl<Node, Edge> Unpin for Digraph<Node, Edge>
where Node: Unpin, Edge: Unpin,

§

impl<Node, Edge> UnwindSafe for Digraph<Node, Edge>
where Node: UnwindSafe, Edge: 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, 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.