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 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§
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