pub struct Graph { /* private fields */ }Expand description
Directed Acryllic Graph representing the flow of execution in that pipeline. Only operates on index and edge information - doesn’t store actual state.
See Registry for where state comes in.
Implementations§
Source§impl Graph
impl Graph
pub fn new() -> Self
Sourcepub fn from_node_indices(node_indices: &[usize]) -> Self
pub fn from_node_indices(node_indices: &[usize]) -> Self
Takes a slice of node indicies and adds them to an unconnected graph.
These are the indices returned by Registry::register
Sourcepub fn add_node(&mut self, id: usize) -> NodeIndex
pub fn add_node(&mut self, id: usize) -> NodeIndex
Adds a new node to the graph, by its Registry index.
Sourcepub fn connect(
&mut self,
from_id: usize,
to_id: usize,
source_output: DataLabel,
target_input: DataLabel,
) -> Result<(), EdgeCreationError>
pub fn connect( &mut self, from_id: usize, to_id: usize, source_output: DataLabel, target_input: DataLabel, ) -> Result<(), EdgeCreationError>
Connects the output of a node to the input of another node, resulting
in a new graph edge. See Registry
Sourcepub fn execute(
&self,
registry: &mut Registry,
) -> Result<(), Error<NodeExecutionError>>
pub fn execute( &self, registry: &mut Registry, ) -> Result<(), Error<NodeExecutionError>>
Execute the graph in its current state, performing the entire flow of operations. This will find any non-lazy nodes and execute each of them, recursively executing all dependencies first in order to satisfy their input requirements.
Sourcepub fn get_output(&self, _registry: &mut Registry) -> NodeOutput
pub fn get_output(&self, _registry: &mut Registry) -> NodeOutput
This will take an output from the graph, either cloning it or removing it entirely, based on cache settings.