Skip to main content

DataflowGraph

Struct DataflowGraph 

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

A dataflow graph representing the transformation pipeline.

Implementations§

Source§

impl DataflowGraph

Source

pub fn new() -> Self

Create a new empty dataflow graph.

Source

pub fn add_node(&mut self, node: Node) -> NodeId

Add a node to the graph.

Returns the node’s ID for connecting edges.

Source

pub fn connect(&mut self, from: NodeId, to: NodeId) -> bool

Connect two nodes with an edge (from -> to).

Returns false if either node doesn’t exist.

Source

pub fn get_node(&self, id: NodeId) -> Option<&Node>

Get a node by ID.

Source

pub fn get_node_mut(&mut self, id: NodeId) -> Option<&mut Node>

Get a mutable node by ID.

Source

pub fn get_node_by_name(&self, name: &str) -> Option<&Node>

Get a node by name.

Source

pub fn get_id_by_name(&self, name: &str) -> Option<NodeId>

Get node ID by name.

Source

pub fn outgoing(&self, id: NodeId) -> &[NodeId]

Get all outgoing edges from a node.

Source

pub fn incoming(&self, id: NodeId) -> &[NodeId]

Get all incoming edges to a node.

Source

pub fn node_count(&self) -> usize

Get the number of nodes.

Source

pub fn edge_count(&self) -> usize

Get the number of edges.

Source

pub fn sources(&self) -> Vec<NodeId>

Get all source nodes (no incoming edges).

Source

pub fn sinks(&self) -> Vec<NodeId>

Get all sink nodes (no outgoing edges).

Source

pub fn topological_sort(&self) -> Option<Vec<NodeId>>

Perform topological sort of the graph.

Returns None if the graph has cycles.

Source

pub fn has_cycles(&self) -> bool

Check if the graph has any cycles.

Source

pub fn reachable_from(&self, start: NodeId) -> HashSet<NodeId>

Find all nodes reachable from a given node.

Source

pub fn nodes(&self) -> impl Iterator<Item = (NodeId, &Node)>

Iterate over all nodes.

Trait Implementations§

Source§

impl Clone for DataflowGraph

Source§

fn clone(&self) -> DataflowGraph

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for DataflowGraph

Source§

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

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

impl Default for DataflowGraph

Source§

fn default() -> Self

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

Auto Trait Implementations§

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.