Operation

Types

ComputableDAGs.AppliedOperationType
AppliedOperation

An 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!.

source
ComputableDAGs.NodeReductionType
NodeReduction <: Operation

The 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.

is_valid_node_reduction_input can be used to @assert these requirements.

See also: can_reduce

source
ComputableDAGs.NodeSplitType
NodeSplit <: Operation

The 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.

is_valid_node_split_input can be used to @assert these requirements.

See also: can_split

source

Find

ComputableDAGs.generate_operationsMethod
generate_operations(graph::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.

source
ComputableDAGs.nr_insertion!Method
nr_insertion!(operations::PossibleOperations, nodeReductions::Vector{Vector{NodeReduction}})

Insert the node reductions into the graph and the nodes' caches. Employs multithreading for speedup.

source
ComputableDAGs.ns_insertion!Method
ns_insertion!(operations::PossibleOperations, nodeSplits::Vector{Vector{NodeSplits}})

Insert the node splits into the graph and the nodes' caches. Employs multithreading for speedup.

source

Apply

ComputableDAGs.apply_all!Method
apply_all!(graph::DAG)

Apply all unapplied operations in the DAG. Is automatically called in all functions that require the latest state of the DAG.

source
ComputableDAGs.apply_operation!Method
apply_operation!(graph::DAG, operation::Operation)

Fallback implementation of apply_operation! for unimplemented operation types, throwing an error.

source
ComputableDAGs.revert_operation!Method
revert_operation!(graph::DAG, operation::AppliedOperation)

Fallback implementation of operation reversion for unimplemented operation types, throwing an error.

source

Get

Clean

ComputableDAGs.clean_node!Method
clean_node!(graph::DAG, node::Node)

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.

source
ComputableDAGs.find_splits!Method
find_splits!(graph::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.

source

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.

source
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.

source
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.

source
Base.delete!Method
delete!(operations::PossibleOperations, op::NodeReduction)

Delete the given node reduction from the possible operations.

source
Base.delete!Method
delete!(operations::PossibleOperations, op::NodeSplit)

Delete the given node split from the possible operations.

source
Base.isemptyMethod
isempty(operations::PossibleOperations)

Return whether operations is empty, i.e. all of its fields are empty.

source
Base.lengthMethod
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'.

source

Print

Base.showMethod
show(io::IO, op::NodeReduction)

Print a string representation of the node reduction to io.

source
Base.showMethod
show(io::IO, op::NodeSplit)

Print a string representation of the node split to io.

source
Base.showMethod
show(io::IO, ops::PossibleOperations)

Print a string representation of the set of possible operations to io.

source

Validate