pub struct PipelineGraph { /* private fields */ }Expand description
A directed acyclic graph of pipeline nodes.
Implementations§
Source§impl PipelineGraph
impl PipelineGraph
Sourcepub fn add_node(
&mut self,
node_type: PipelineNodeType,
label: impl Into<String>,
) -> PipelineNodeId
pub fn add_node( &mut self, node_type: PipelineNodeType, label: impl Into<String>, ) -> PipelineNodeId
Add a new node and return its id.
Sourcepub fn connect(
&mut self,
from: PipelineNodeId,
to: PipelineNodeId,
) -> Result<(), String>
pub fn connect( &mut self, from: PipelineNodeId, to: PipelineNodeId, ) -> Result<(), String>
Connect from → to.
Returns an error string if either node does not exist.
Sourcepub fn is_valid_dag(&self) -> bool
pub fn is_valid_dag(&self) -> bool
Returns true if the graph contains no directed cycles (is a valid DAG).
Sourcepub fn sources(&self) -> Vec<PipelineNodeId>
pub fn sources(&self) -> Vec<PipelineNodeId>
Returns the ids of all source nodes (nodes with no incoming edges).
Sourcepub fn sinks(&self) -> Vec<PipelineNodeId>
pub fn sinks(&self) -> Vec<PipelineNodeId>
Returns the ids of all sink nodes (nodes with no outgoing edges).
Sourcepub fn node_count(&self) -> usize
pub fn node_count(&self) -> usize
Total number of nodes.
Sourcepub fn edge_count(&self) -> usize
pub fn edge_count(&self) -> usize
Total number of directed edges.
Sourcepub fn node_type(&self, id: PipelineNodeId) -> Option<PipelineNodeType>
pub fn node_type(&self, id: PipelineNodeId) -> Option<PipelineNodeType>
Look up the type of a node.
Sourcepub fn node_label(&self, id: PipelineNodeId) -> Option<&str>
pub fn node_label(&self, id: PipelineNodeId) -> Option<&str>
Look up the label of a node.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for PipelineGraph
impl RefUnwindSafe for PipelineGraph
impl Send for PipelineGraph
impl Sync for PipelineGraph
impl Unpin for PipelineGraph
impl UnsafeUnpin for PipelineGraph
impl UnwindSafe for PipelineGraph
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more