Struct DiGraph

Source
pub struct DiGraph<NId, NL, EL>
where NId: Eq + Hash,
{ /* 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>

Source

pub fn empty() -> Self

Default empty payload graph

Source§

impl<NId, NL, EL> DiGraph<NId, NL, EL>
where NId: Clone + Eq + Hash,

Source

pub fn new() -> Self

Source

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.

Source

pub fn add_edge(&mut self, from: NId, to: NId, payload: EL) -> Option<EL>

Adds new edge. Returns prev.

Source

pub fn remove_edge(&mut self, from: NId, to: NId) -> Option<EL>

Removes edge. Returns a payload on the edge if it exists.

Source

pub fn successors(&self, from: NId) -> Option<&HashMap<NId, EL>>

Returns a reference to the successors.

Source

pub fn start(&self) -> &Option<NId>

Returns a reference to a start node.

Source

pub fn analyze(&self) -> GraphAnalyzer<'_, NId, NL, EL>

Invokes a graph analyzer GraphAnalyzer

Source

pub fn visualize(&self) -> DotGraphVisualizer<'_, NId, NL, EL>

Invokes a graph visualizer DotGraphVisualizer

Source§

impl<NId, NL, EL> DiGraph<NId, NL, EL>
where NId: Clone + Eq + Hash, NL: Default,

Source

pub fn add_bare_node(&mut self, id: NId) -> Option<NId>

Adds a node with an EmptyPayload

Source§

impl<NId, NL, EL> DiGraph<NId, NL, EL>
where NId: Clone + Eq + Hash, EL: Default,

Source

pub fn add_bare_edge(&mut self, from: NId, to: NId) -> Option<EL>

Adds an edge with an EmptyPayload

Trait Implementations§

Source§

impl<NId, NL: Debug, EL: Debug> Debug for DiGraph<NId, NL, EL>
where NId: Eq + Hash + Debug,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

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>
where NId: Send, NL: Send, EL: Send,

§

impl<NId, NL, EL> Sync for DiGraph<NId, NL, EL>
where NId: Sync, NL: Sync, EL: Sync,

§

impl<NId, NL, EL> Unpin for DiGraph<NId, NL, EL>
where NId: Unpin, NL: Unpin, EL: Unpin,

§

impl<NId, NL, EL> UnwindSafe for DiGraph<NId, NL, EL>
where NId: UnwindSafe, NL: UnwindSafe, EL: 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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V