Add GraphProperties and property caching

This commit is contained in:
2023-08-28 13:32:22 +02:00
parent 065236be22
commit 7387fa86b1
18 changed files with 300 additions and 101 deletions

View File

@ -40,6 +40,9 @@ function apply_operation!(graph::DAG, operation::NodeFusion)
operation.input[2],
operation.input[3],
)
graph.properties += GraphProperties(diff)
return AppliedNodeFusion(operation, diff)
end
@ -52,6 +55,9 @@ Return an [`AppliedNodeReduction`](@ref) object generated from the graph's [`Dif
"""
function apply_operation!(graph::DAG, operation::NodeReduction)
diff = node_reduction!(graph, operation.input)
graph.properties += GraphProperties(diff)
return AppliedNodeReduction(operation, diff)
end
@ -64,6 +70,9 @@ Return an [`AppliedNodeSplit`](@ref) object generated from the graph's [`Diff`](
"""
function apply_operation!(graph::DAG, operation::NodeSplit)
diff = node_split!(graph, operation.input)
graph.properties += GraphProperties(diff)
return AppliedNodeSplit(operation, diff)
end
@ -127,6 +136,9 @@ function revert_diff!(graph::DAG, diff::Diff)
for edge in diff.removedEdges
insert_edge!(graph, edge.edge[1], edge.edge[2], false)
end
graph.properties -= GraphProperties(diff)
return nothing
end