pub struct DiGraph<NId, NL, EL>{ /* private fields */ }
Expand description
The base structure denoting a directed graph with a start in the first added node.
- NId: id of the node. should be unique and implement
Eq + Hash
- NL: payload for node
- EL: payload for edge
Implementations§
Source§impl DiGraph<usize, EmptyPayload, EmptyPayload>
impl DiGraph<usize, EmptyPayload, EmptyPayload>
Source§impl<NId, NL, EL> DiGraph<NId, NL, EL>
impl<NId, NL, EL> DiGraph<NId, NL, EL>
pub fn new() -> Self
Sourcepub fn remove_node(&mut self, id: NId) -> Option<NL>
pub fn remove_node(&mut self, id: NId) -> Option<NL>
Removes a node. Returns a payload if the node is presented.
Note: this operation should be accompanied by the remove_edge operations.
Sourcepub fn add_edge(&mut self, from: NId, to: NId, payload: EL) -> Option<EL>
pub fn add_edge(&mut self, from: NId, to: NId, payload: EL) -> Option<EL>
Adds new edge. Returns prev.
Sourcepub fn remove_edge(&mut self, from: NId, to: NId) -> Option<EL>
pub fn remove_edge(&mut self, from: NId, to: NId) -> Option<EL>
Removes edge. Returns a payload on the edge if it exists.
Sourcepub fn successors(&self, from: NId) -> Option<&HashMap<NId, EL>>
pub fn successors(&self, from: NId) -> Option<&HashMap<NId, EL>>
Returns a reference to the successors.
Sourcepub fn analyze(&self) -> GraphAnalyzer<'_, NId, NL, EL>
pub fn analyze(&self) -> GraphAnalyzer<'_, NId, NL, EL>
Invokes a graph analyzer GraphAnalyzer
Sourcepub fn visualize(&self) -> DotGraphVisualizer<'_, NId, NL, EL>
pub fn visualize(&self) -> DotGraphVisualizer<'_, NId, NL, EL>
Invokes a graph visualizer DotGraphVisualizer
Trait Implementations§
Auto Trait Implementations§
impl<NId, NL, EL> Freeze for DiGraph<NId, NL, EL>where
NId: Freeze,
impl<NId, NL, EL> RefUnwindSafe for DiGraph<NId, NL, EL>
impl<NId, NL, EL> Send for DiGraph<NId, NL, EL>
impl<NId, NL, EL> Sync for DiGraph<NId, NL, EL>
impl<NId, NL, EL> Unpin for DiGraph<NId, NL, EL>
impl<NId, NL, EL> UnwindSafe for DiGraph<NId, NL, EL>
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