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

@ -3,7 +3,7 @@ using Random
function test_known_graph(name::String, n, fusion_test = true)
@testset "Test $name Graph ($n)" begin
graph = parse_abc(joinpath(@__DIR__, "..", "input", "$name.txt"))
props = graph_properties(graph)
props = get_properties(graph)
if (fusion_test)
test_node_fusion(graph)
@ -14,13 +14,13 @@ end
function test_node_fusion(g::DAG)
@testset "Test Node Fusion" begin
props = graph_properties(g)
props = get_properties(g)
options = get_operations(g)
nodes_number = length(g.nodes)
data = props.data
compute_effort = props.compute_effort
compute_effort = props.computeEffort
while !isempty(options.nodeFusions)
fusion = first(options.nodeFusions)
@ -29,13 +29,13 @@ function test_node_fusion(g::DAG)
push_operation!(g, fusion)
props = graph_properties(g)
props = get_properties(g)
@test props.data < data
@test props.compute_effort == compute_effort
@test props.computeEffort == compute_effort
nodes_number = length(g.nodes)
data = props.data
compute_effort = props.compute_effort
compute_effort = props.computeEffort
options = get_operations(g)
end
@ -49,7 +49,7 @@ function test_random_walk(g::DAG, n::Int64)
@test is_valid(g)
properties = graph_properties(g)
properties = get_properties(g)
for i in 1:n
# choose push or pop
@ -82,7 +82,7 @@ function test_random_walk(g::DAG, n::Int64)
@test is_valid(g)
@test properties == graph_properties(g)
@test properties == get_properties(g)
end
end