Operation
Types
ComputableDAGs.AppliedNodeReduction — Type
AppliedNodeReduction <: AppliedOperationThe applied version of the NodeReduction.
ComputableDAGs.AppliedNodeSplit — Type
AppliedNodeSplit <: AppliedOperationThe applied version of the NodeSplit.
ComputableDAGs.AppliedOperation — Type
AppliedOperationAn abstract base class for already applied operations. An applied operation can be reversed iff it is the last applied operation on the DAG. Every applied operation stores a Diff from when it was initially applied to be able to revert the operation.
See also: revert_operation!.
ComputableDAGs.NodeReduction — Type
NodeReduction <: OperationThe NodeReduction operation. Represents the reduction of two or more nodes with one another. Only one of the input nodes is kept, while all others are deleted and their parents are accumulated in the kept node's parents instead.
After the node reduction is applied, the graph has length(nr.input) - 1 fewer nodes.
Requirements for successful application
A vector of nodes can be reduced if:
- All nodes are in the graph.
- All nodes have the same task type.
- All nodes have the same set of children.
See also: can_reduce
ComputableDAGs.NodeSplit — Type
NodeSplit <: OperationThe NodeSplit operation. Represents the split of its input node into one node for each of its parents. It is the reverse operation to the NodeReduction.
Requirements for successful application
A node can be split if:
- It is in the graph.
- It has at least 2 parents.
See also: can_split
ComputableDAGs.Operation — Type
OperationAn abstract base class for operations. An operation can be applied to a DAG, changing its nodes and edges.
Possible operations on a DAG can be retrieved using operations.
See also: push_operation!, pop_operation!
Find
ComputableDAGs.generate_operations — Method
generate_operations(dag::DAG)Generate all possible operations on the graph. Used initially when the graph is freshly assembled or parsed. Uses multithreading for speedup.
Safely inserts all the found operations into the graph and its nodes.
ComputableDAGs.nr_insertion! — Method
nr_insertion!(dag::DAG, operations::PossibleOperations, node_reductions::Vector{Vector{NodeReduction}})Insert the node reductions into the graph and the nodes' caches. Employs multithreading for speedup.
ComputableDAGs.ns_insertion! — Method
ns_insertion!(operations::PossibleOperations, node_splits::Vector{Vector{NodeSplits}})Insert the node splits into the graph and the nodes' caches. Employs multithreading for speedup.
Apply
ComputableDAGs.apply_all! — Method
apply_all!(dag::DAG)Apply all unapplied operations in the DAG. Is automatically called in all functions that require the latest state of the DAG.
ComputableDAGs.apply_operation! — Method
apply_operation!(dag::DAG, operation::NodeReduction)Apply the given NodeReduction to the graph. Generic wrapper around node_reduction!.
Return an AppliedNodeReduction object generated from the graph's Diff.
ComputableDAGs.apply_operation! — Method
apply_operation!(dag::DAG, operation::NodeSplit)Apply the given NodeSplit to the graph. Generic wrapper around node_split!.
Return an AppliedNodeSplit object generated from the graph's Diff.
ComputableDAGs.apply_operation! — Method
apply_operation!(dag::DAG, operation::Operation)Fallback implementation of apply_operation! for unimplemented operation types, throwing an error.
ComputableDAGs.node_reduction! — Method
node_reduction!(dag::DAG, nodes::Vector{Node})Reduce the given nodes together into one node, return the applied difference to the graph.
For details see NodeReduction.
ComputableDAGs.node_split! — Method
node_split!(dag::DAG, n1::Node)Split the given node into one node per parent, return the applied difference to the graph.
For details see NodeSplit.
ComputableDAGs.revert_diff! — Method
revert_diff!(dag::DAG, diff::Diff)Revert the given diff on the graph. Used to revert the individual AppliedOperations with revert_operation!.
ComputableDAGs.revert_operation! — Method
revert_operation!(dag::DAG, operation::AppliedNodeReduction)Revert the applied node reduction on the graph. Return the original NodeReduction operation.
ComputableDAGs.revert_operation! — Method
revert_operation!(dag::DAG, operation::AppliedNodeSplit)Revert the applied node split on the graph. Return the original NodeSplit operation.
ComputableDAGs.revert_operation! — Method
revert_operation!(dag::DAG, operation::AppliedOperation)Fallback implementation of operation reversion for unimplemented operation types, throwing an error.
Get
ComputableDAGs.operations — Method
operations(dag::DAG)Return the PossibleOperations of the graph at the current state.
Clean
ComputableDAGs.clean_node! — Method
clean_node!(dag::DAG, node_id::UUID)Sort this node's parent and child sets, then find reductions and splits involving it. Needs to be called after the node was changed in some way.
ComputableDAGs.find_reductions! — Method
find_reductions!(dag::DAG, node::Node)Find node reductions involving the given node. The function pushes the found NodeReduction (if any) everywhere it needs to be and returns nothing.
ComputableDAGs.find_splits! — Method
find_splits!(dag::DAG, node::Node)Find the node split of the given node. The function pushes the found NodeSplit (if any) everywhere it needs to be and returns nothing.
Utility
Base.:(==) — Method
==(op1::NodeReduction, op2::NodeReduction)Equality comparison between two node reductions. Two node reductions are considered equal when they have the same inputs.
Base.:(==) — Method
==(op1::NodeSplit, op2::NodeSplit)Equality comparison between two node splits. Two node splits are considered equal if they have the same input node.
Base.:(==) — Method
==(op1::Operation, op2::Operation)Fallback implementation of operation equality. Return false. Actual comparisons are done by the overloads of same type operation comparisons.
Base.delete! — Method
delete!(operations::PossibleOperations, op::NodeReduction)Delete the given node reduction from the possible operations.
Base.delete! — Method
delete!(operations::PossibleOperations, op::NodeSplit)Delete the given node split from the possible operations.
Base.isempty — Method
isempty(operations::PossibleOperations)Return whether operations is empty, i.e. all of its fields are empty.
Base.length — Method
length(operations::PossibleOperations)Return a named tuple with the number of each of the operation types as a named tuple. The fields are named the same as the PossibleOperations'.
ComputableDAGs.can_reduce — Method
can_reduce(n1::Node, n2::Node)Return whether the given two nodes can be reduced. See NodeReduction for the requirements.
ComputableDAGs.can_split — Method
can_split(n1::Node)Return whether the given node can be split. See NodeSplit for the requirements.