pub struct DirectedGraph<T: Clone + PartialEq + Hash + Ord + Debug + Display>(/* private fields */);Expand description
A directed graph, whose nodes contain an identifier of type T.
Implementations§
Source§impl<T: Clone + PartialEq + Hash + Ord + Debug + Display> DirectedGraph<T>
impl<T: Clone + PartialEq + Hash + Ord + Debug + Display> DirectedGraph<T>
Sourcepub fn retain(&mut self, predicate: impl Fn(&T, &T) -> bool)
pub fn retain(&mut self, predicate: impl Fn(&T, &T) -> bool)
Remove all edges that don’t match the given predicate.
pub fn extend(&mut self, other: impl IntoIterator<Item = (T, T)>)
Sourcepub fn add_edge(&mut self, source: T, target: T)
pub fn add_edge(&mut self, source: T, target: T)
Add an edge to the graph, adding nodes if necessary.
Sourcepub fn get_targets<'a>(&'a self, id: &T) -> Option<&'a HashSet<T>>
pub fn get_targets<'a>(&'a self, id: &T) -> Option<&'a HashSet<T>>
Get targets of all edges from this node.
Sourcepub fn get_closure<'a>(&'a self, start: &T) -> HashSet<&'a T>
pub fn get_closure<'a>(&'a self, start: &T) -> HashSet<&'a T>
Given a dependency graph, find the set of all nodes that have a
dependency on the start node (i.e., the reverse dependency closure).
This includes start itself.
Sourcepub fn add_node(&mut self, source: T)
pub fn add_node(&mut self, source: T)
Adds an edgeless node to the graph. Used by shutdown to ensure every node gets visited, even if there are no paths to the node.
Trait Implementations§
Source§impl<T: Clone + Clone + PartialEq + Hash + Ord + Debug + Display> Clone for DirectedGraph<T>
impl<T: Clone + Clone + PartialEq + Hash + Ord + Debug + Display> Clone for DirectedGraph<T>
Source§fn clone(&self) -> DirectedGraph<T>
fn clone(&self) -> DirectedGraph<T>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<T: Clone + PartialEq + Hash + Ord + Debug + Display, const N: usize> From<[(T, T); N]> for DirectedGraph<T>
impl<T: Clone + PartialEq + Hash + Ord + Debug + Display, const N: usize> From<[(T, T); N]> for DirectedGraph<T>
Source§impl<T: Clone + PartialEq + Hash + Ord + Debug + Display> From<Box<[(T, T)]>> for DirectedGraph<T>
impl<T: Clone + PartialEq + Hash + Ord + Debug + Display> From<Box<[(T, T)]>> for DirectedGraph<T>
Source§impl<T: Clone + PartialEq + Hash + Ord + Debug + Display + 'static> IntoIterator for DirectedGraph<T>
impl<T: Clone + PartialEq + Hash + Ord + Debug + Display + 'static> IntoIterator for DirectedGraph<T>
Source§impl<T: PartialEq + Clone + PartialEq + Hash + Ord + Debug + Display> PartialEq for DirectedGraph<T>
impl<T: PartialEq + Clone + PartialEq + Hash + Ord + Debug + Display> PartialEq for DirectedGraph<T>
impl<T: Eq + Clone + PartialEq + Hash + Ord + Debug + Display> Eq for DirectedGraph<T>
impl<T: Clone + PartialEq + Hash + Ord + Debug + Display> StructuralPartialEq for DirectedGraph<T>
Auto Trait Implementations§
impl<T> Freeze for DirectedGraph<T>
impl<T> RefUnwindSafe for DirectedGraph<T>where
T: RefUnwindSafe,
impl<T> Send for DirectedGraph<T>where
T: Send,
impl<T> Sync for DirectedGraph<T>where
T: Sync,
impl<T> Unpin for DirectedGraph<T>where
T: Unpin,
impl<T> UnwindSafe for DirectedGraph<T>where
T: 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