Skip to content

Commit

Permalink
remove variables_by_node which became redundant
Browse files Browse the repository at this point in the history
  • Loading branch information
guyvdbroeck committed Mar 29, 2021
1 parent c101701 commit 220009a
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 13 deletions.
10 changes: 1 addition & 9 deletions src/queries/queries.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using DataFrames: DataFrame

export variables_by_node,
issmooth,
export issmooth,
isdecomposable,
isstruct_decomposable,
isdeterministic,
Expand Down Expand Up @@ -93,13 +92,6 @@ function variables(root::LogicCircuit, cache=nothing)::BitSet
foldup(root, f_con, f_lit, f_inner, f_inner, BitSet, cache)
end

"Get the variable scope of each node in the circuit"
function variables_by_node(root::LogicCircuit)::Dict{LogicCircuit,BitSet}
scope = Dict{Node,BitSet}()
variables(root, scope)
scope
end

"Get the variable in the circuit with the largest index"
function max_variable(root::LogicCircuit, cache=nothing)::Var
f_con(n) = Var(0)
Expand Down
7 changes: 6 additions & 1 deletion src/sdd/sdd_functions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,12 @@ compile(::Type{<:Sdd}, mgr::SddMgr, arg::LogicCircuit) = compile(mgr, arg)

"Compile a circuit (e.g., CNF or DNF) into an SDD, bottom up by distributing circuit nodes over vtree nodes"

compile(mgr::SddMgr, c::LogicCircuit, scopes=variables_by_node(c)) =
compile(mgr::SddMgr, c::LogicCircuit) = begin
scopes = Dict{LogicCircuit, BitSet}()
variables(c, scopes) # populate scopes dict
compile(mgr, c, GateType(c), scopes)
end
compile(mgr::SddMgr, c::LogicCircuit, scopes) =
compile(mgr, c, GateType(c), scopes)
compile(mgr::SddMgr, c::LogicCircuit, ::ConstantGate, _) =
compile(mgr, constant(c))
Expand Down
2 changes: 0 additions & 2 deletions test/queries/queries_test.jl
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ include("../helper/plain_logic_circuits.jl")
@test isstruct_decomposable(compile(PlainLogicCircuit, Lit(1)))

@test variables(r1) == BitSet(1:10)
@test variables_by_node(r1)[r1] == BitSet(1:10)
@test variables_by_node(r1)[children(children(r1)[1])[5]] == BitSet(5)

@test num_variables(r1) == 10
@test issmooth(r1)
Expand Down
1 change: 0 additions & 1 deletion test/structured/structured_logic_nodes_test.jl
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ using DataFrames: DataFrame
@test isdecomposable(f)

@test variables(f) == BitSet(1:10)
@test variables_by_node(f)[f] == BitSet(1:10)

@test num_variables(f) == 10
@test issmooth(f)
Expand Down

0 comments on commit 220009a

Please sign in to comment.