pub struct QueryDag { /* private fields */ }Expand description
A Directed Acyclic Graph representing a query plan
Implementations§
Source§impl QueryDag
impl QueryDag
Sourcepub fn add_node(&mut self, node: OperatorNode) -> usize
pub fn add_node(&mut self, node: OperatorNode) -> usize
Add a node to the DAG, returns the node ID
Sourcepub fn add_edge(&mut self, parent: usize, child: usize) -> Result<(), DagError>
pub fn add_edge(&mut self, parent: usize, child: usize) -> Result<(), DagError>
Add an edge from parent to child
Sourcepub fn remove_node(&mut self, id: usize) -> Option<OperatorNode>
pub fn remove_node(&mut self, id: usize) -> Option<OperatorNode>
Remove a node from the DAG
Sourcepub fn get_node(&self, id: usize) -> Option<&OperatorNode>
pub fn get_node(&self, id: usize) -> Option<&OperatorNode>
Get a reference to a node
Sourcepub fn get_node_mut(&mut self, id: usize) -> Option<&mut OperatorNode>
pub fn get_node_mut(&mut self, id: usize) -> Option<&mut OperatorNode>
Get a mutable reference to a node
Sourcepub fn node_count(&self) -> usize
pub fn node_count(&self) -> usize
Get the number of nodes
Sourcepub fn edge_count(&self) -> usize
pub fn edge_count(&self) -> usize
Get the number of edges
Sourcepub fn nodes(&self) -> impl Iterator<Item = &OperatorNode> + '_
pub fn nodes(&self) -> impl Iterator<Item = &OperatorNode> + '_
Get iterator over all nodes
Sourcepub fn compute_depths(&self) -> HashMap<usize, usize>
pub fn compute_depths(&self) -> HashMap<usize, usize>
Compute depth of each node from leaves (leaves have depth 0)
Sourcepub fn descendants(&self, id: usize) -> HashSet<usize>
pub fn descendants(&self, id: usize) -> HashSet<usize>
Get all descendants of a node
Source§impl QueryDag
impl QueryDag
Sourcepub fn topological_iter(&self) -> Result<TopologicalIterator<'_>, DagError>
pub fn topological_iter(&self) -> Result<TopologicalIterator<'_>, DagError>
Create an iterator for topological order traversal
Sourcepub fn dfs_iter(&self, start: usize) -> DfsIterator<'_> ⓘ
pub fn dfs_iter(&self, start: usize) -> DfsIterator<'_> ⓘ
Create an iterator for depth-first search starting from a node
Sourcepub fn bfs_iter(&self, start: usize) -> BfsIterator<'_> ⓘ
pub fn bfs_iter(&self, start: usize) -> BfsIterator<'_> ⓘ
Create an iterator for breadth-first search starting from a node
Trait Implementations§
Source§impl DagDeserializer for QueryDag
impl DagDeserializer for QueryDag
Source§impl DagSerializer for QueryDag
impl DagSerializer for QueryDag
Auto Trait Implementations§
impl Freeze for QueryDag
impl RefUnwindSafe for QueryDag
impl Send for QueryDag
impl Sync for QueryDag
impl Unpin for QueryDag
impl UnsafeUnpin for QueryDag
impl UnwindSafe for QueryDag
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