Struct hexodsp::nodes::node_graph_ordering::NodeGraphOrdering
source · [−]pub struct NodeGraphOrdering {
node2idx: HashMap<NodeId, usize>,
node_count: usize,
nodes: Vec<Node>,
in_degree: Vec<usize>,
}
Fields
node2idx: HashMap<NodeId, usize>
node_count: usize
nodes: Vec<Node>
in_degree: Vec<usize>
Implementations
sourceimpl NodeGraphOrdering
impl NodeGraphOrdering
pub fn new() -> Self
pub fn clear(&mut self)
pub fn add_node(&mut self, node_id: NodeId) -> usize
fn get_node(&self, node_id: NodeId) -> Option<&Node>
fn get_node_mut(&mut self, node_id: NodeId) -> Option<&mut Node>
pub fn add_edge(&mut self, from_node_id: NodeId, to_node_id: NodeId)
pub fn has_path(&self, from_node_id: NodeId, to_node_id: NodeId) -> Option<bool>
sourcepub fn calculate_order(&mut self, out: &mut Vec<NodeId>) -> bool
pub fn calculate_order(&mut self, out: &mut Vec<NodeId>) -> bool
Run Kahn’s Algorithm to find the node order for the directed
graph. out
will contain the order the nodes should be
executed in. If false
is returned, the graph contains cycles
and no proper order can be computed. out
will be cleared
in this case.
Trait Implementations
sourceimpl Clone for NodeGraphOrdering
impl Clone for NodeGraphOrdering
sourcefn clone(&self) -> NodeGraphOrdering
fn clone(&self) -> NodeGraphOrdering
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations
impl RefUnwindSafe for NodeGraphOrdering
impl Send for NodeGraphOrdering
impl Sync for NodeGraphOrdering
impl Unpin for NodeGraphOrdering
impl UnwindSafe for NodeGraphOrdering
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more