Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/qualitative_networks.jl
Original file line number Diff line number Diff line change
Expand Up @@ -239,10 +239,10 @@ function update_functions_to_interaction_graph(
graph[entity] = Entity{Int}(fn, domain)
end

for (e1, f) in zip(entities, update_functions)
for (dst, f) in zip(entities, update_functions)
input_entities = collect(Leaves(f))
for e2 in input_entities
add_edge!(graph, e1, e2)
for src in input_entities
add_edge!(graph, src, dst)
end
end

Expand Down
13 changes: 13 additions & 0 deletions test/qn_test.jl
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,19 @@ end
@test issubset(Set(constants), Set(g.rules))
end

@testitem "QN Graph Correctness" begin
entities = [:a, :b, :c]
target_fns = Union{Expr,Integer,Symbol}[:(-c), :a, :b]
domains = [0:2 for _ = 1:3]

qn = QN(entities, target_fns, domains)
g = get_graph(qn)

@test haskey(g, :c, :a)
@test haskey(g, :a, :b)
@test haskey(g, :b, :c)
end

@testitem "QN Sampling" setup = [RandomSetup, ExampleQN] begin
using Graphs: ne, nv
graph = get_graph(qn)
Expand Down
Loading