Struct DAG

Source
pub struct DAG { /* private fields */ }
Expand description

The Ranked-DAG data structure.

Implementations§

Source§

impl DAG

Source

pub fn new() -> Self

Source

pub fn set_validate(&mut self, validate: bool)

Source

pub fn clear(&mut self)

Source

pub fn iter(&self) -> NodeIterator

Source

pub fn add_edge(&mut self, from: NodeHandle, to: NodeHandle)

Source

pub fn remove_edge(&mut self, from: NodeHandle, to: NodeHandle) -> bool

Remove an edge from \p from to \p to. \returns True if an edge was removed.

Source

pub fn new_node(&mut self) -> NodeHandle

Create a new node.

Source

pub fn new_nodes(&mut self, n: usize)

Create \p n new nodes.

Source

pub fn successors(&self, from: NodeHandle) -> &Vec<NodeHandle>

Source

pub fn predecessors(&self, from: NodeHandle) -> &Vec<NodeHandle>

Source

pub fn single_pred(&self, from: NodeHandle) -> Option<NodeHandle>

Source

pub fn single_succ(&self, from: NodeHandle) -> Option<NodeHandle>

Source

pub fn verify(&self)

Source

pub fn len(&self) -> usize

Source

pub fn is_empty(&self) -> bool

Source

pub fn is_reachable(&self, from: NodeHandle, to: NodeHandle) -> bool

\returns True if there is a path from \p ‘from’ to \p ‘to’.

Source

pub fn num_levels(&self) -> usize

\returns the number of ranks in the dag.

Source

pub fn row_mut(&mut self, level: usize) -> &mut Vec<NodeHandle>

\return a mutable reference to a row at level \p level.

Source

pub fn row(&self, level: usize) -> &Vec<NodeHandle>

\return a reference to a row at level \p level.

Source

pub fn ranks(&self) -> &RankType

\return a reference to the whole rank data structure.

Source

pub fn ranks_mut(&mut self) -> &mut RankType

\return a mutable reference to the whole rank data structure.

Source

pub fn is_first_in_row(&self, elem: NodeHandle, level: usize) -> bool

\returns True if \p elem is the first node in the row \p level.

Source

pub fn is_last_in_row(&self, elem: NodeHandle, level: usize) -> bool

\returns True if \p elem is the last node in the row \p level.

Source

pub fn recompute_node_ranks(&mut self)

Places all of the nodes in ranks (levels).

Source

pub fn update_node_rank_level( &mut self, node: NodeHandle, new_level: usize, insert_before: Option<NodeHandle>, )

Move the node \p node to a new level \p new_level. Place the node before \p node, or at the end.

Source

pub fn level(&self, node: NodeHandle) -> usize

\returns the level of the node \p node in the rank.

Trait Implementations§

Source§

impl Debug for DAG

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Default for DAG

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl Freeze for DAG

§

impl RefUnwindSafe for DAG

§

impl Send for DAG

§

impl Sync for DAG

§

impl Unpin for DAG

§

impl UnwindSafe for DAG

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.