pub struct SimpleDirectedGraph<N>{ /* private fields */ }Expand description
An immutable directed graph with nodes of type N and a minimal interface for iterating over nodes and their adjacent nodes.
Implementations§
Source§impl<N> SimpleDirectedGraph<N>
impl<N> SimpleDirectedGraph<N>
Sourcepub fn new<EI>(edges: EI) -> Selfwhere
EI: IntoIterator<Item = (N, N)>,
pub fn new<EI>(edges: EI) -> Selfwhere
EI: IntoIterator<Item = (N, N)>,
Constructs a new SimpleDirectedGraph from a list of edges.
Sourcepub fn adjacent_nodes(
&self,
node: &N,
) -> Option<impl DoubleEndedIterator<Item = &N>>
pub fn adjacent_nodes( &self, node: &N, ) -> Option<impl DoubleEndedIterator<Item = &N>>
Returns the adjacent nodes for the given node, or None if the node is not in the graph.
Sourcepub fn contains_node(&self, node: &N) -> bool
pub fn contains_node(&self, node: &N) -> bool
Returns true if this graph contains the given node.
Sourcepub fn get_postorder<'a>(&'a self, start_node: &'a N) -> Vec<&'a N>
pub fn get_postorder<'a>(&'a self, start_node: &'a N) -> Vec<&'a N>
Returns a postorder traversal of the nodes in this graph starting from the given node.
Trait Implementations§
Source§impl<N> Clone for SimpleDirectedGraph<N>
impl<N> Clone for SimpleDirectedGraph<N>
Source§fn clone(&self) -> SimpleDirectedGraph<N>
fn clone(&self) -> SimpleDirectedGraph<N>
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 moreSource§impl<N> Debug for SimpleDirectedGraph<N>
impl<N> Debug for SimpleDirectedGraph<N>
impl<N> Eq for SimpleDirectedGraph<N>
Source§impl<N> PartialEq for SimpleDirectedGraph<N>
impl<N> PartialEq for SimpleDirectedGraph<N>
Source§fn eq(&self, other: &SimpleDirectedGraph<N>) -> bool
fn eq(&self, other: &SimpleDirectedGraph<N>) -> bool
Tests for
self and other values to be equal, and is used by ==.impl<N> StructuralPartialEq for SimpleDirectedGraph<N>
Auto Trait Implementations§
impl<N> Freeze for SimpleDirectedGraph<N>
impl<N> RefUnwindSafe for SimpleDirectedGraph<N>where
N: RefUnwindSafe,
impl<N> Send for SimpleDirectedGraph<N>where
N: Send,
impl<N> Sync for SimpleDirectedGraph<N>where
N: Sync,
impl<N> Unpin for SimpleDirectedGraph<N>where
N: Unpin,
impl<N> UnsafeUnpin for SimpleDirectedGraph<N>
impl<N> UnwindSafe for SimpleDirectedGraph<N>where
N: UnwindSafe,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more