pub struct DAG { /* private fields */ }
Expand description
The Ranked-DAG data structure.
Implementations§
Source§impl DAG
impl DAG
pub fn new() -> Self
pub fn set_validate(&mut self, validate: bool)
pub fn clear(&mut self)
pub fn iter(&self) -> NodeIterator ⓘ
pub fn add_edge(&mut self, from: NodeHandle, to: NodeHandle)
Sourcepub fn remove_edge(&mut self, from: NodeHandle, to: NodeHandle) -> bool
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.
Sourcepub fn new_node(&mut self) -> NodeHandle
pub fn new_node(&mut self) -> NodeHandle
Create a new node.
pub fn successors(&self, from: NodeHandle) -> &Vec<NodeHandle>
pub fn predecessors(&self, from: NodeHandle) -> &Vec<NodeHandle>
pub fn single_pred(&self, from: NodeHandle) -> Option<NodeHandle>
pub fn single_succ(&self, from: NodeHandle) -> Option<NodeHandle>
pub fn verify(&self)
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
Sourcepub fn is_reachable(&self, from: NodeHandle, to: NodeHandle) -> bool
pub fn is_reachable(&self, from: NodeHandle, to: NodeHandle) -> bool
\returns True if there is a path from \p ‘from’ to \p ‘to’.
Sourcepub fn num_levels(&self) -> usize
pub fn num_levels(&self) -> usize
\returns the number of ranks in the dag.
Sourcepub fn row_mut(&mut self, level: usize) -> &mut Vec<NodeHandle>
pub fn row_mut(&mut self, level: usize) -> &mut Vec<NodeHandle>
\return a mutable reference to a row at level \p level.
Sourcepub fn row(&self, level: usize) -> &Vec<NodeHandle>
pub fn row(&self, level: usize) -> &Vec<NodeHandle>
\return a reference to a row at level \p level.
Sourcepub fn ranks_mut(&mut self) -> &mut RankType
pub fn ranks_mut(&mut self) -> &mut RankType
\return a mutable reference to the whole rank data structure.
Sourcepub fn is_first_in_row(&self, elem: NodeHandle, level: usize) -> bool
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.
Sourcepub fn is_last_in_row(&self, elem: NodeHandle, level: usize) -> bool
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.
Sourcepub fn recompute_node_ranks(&mut self)
pub fn recompute_node_ranks(&mut self)
Places all of the nodes in ranks (levels).
Sourcepub fn update_node_rank_level(
&mut self,
node: NodeHandle,
new_level: usize,
insert_before: Option<NodeHandle>,
)
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.
Sourcepub fn level(&self, node: NodeHandle) -> usize
pub fn level(&self, node: NodeHandle) -> usize
\returns the level of the node \p node in the rank.
Trait Implementations§
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> 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