Skip to content

Commit 846c532

Browse files
committed
buildSubgraphFromLabels!: rather error with notes of replacement on
1 parent 3b74a74 commit 846c532

File tree

1 file changed

+7
-37
lines changed

1 file changed

+7
-37
lines changed

src/Deprecated.jl

Lines changed: 7 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -16,51 +16,21 @@ include("../attic/GraphsDFG/GraphsDFG.jl")
1616

1717

1818
# leave a bit longer
19-
#NOTE buildSubgraphFromLabels! does not have a 1-1 replacement in DFG
20-
# if you have a set of variables and factors use copyGraph
21-
# if you want neighbors automaticallyinclued use buildSubgraph
22-
# if you want a clique subgraph use buildCliqueSubgraph! from IIF
19+
export buildSubgraphFromLabels!
2320
function buildSubgraphFromLabels!(dfg::AbstractDFG,
2421
syms::Vector{Symbol};
2522
subfg::AbstractDFG=LightDFG(params=getSolverParams(dfg)),
2623
solvable::Int=0,
2724
allowedFactors::Union{Nothing, Vector{Symbol}}=nothing )
28-
#
29-
Base.depwarn("buildSubgraphFromLabels! is deprecated use copyGraph, buildSubgraph or buildCliqueSubgraph!(IIF)", :buildSubgraphFromLabels!)
30-
# add a little too many variables (since we need the factors)
31-
for sym in syms
32-
if solvable <= getSolvable(dfg, sym)
33-
getSubgraphAroundNode(dfg, getVariable(dfg, sym), 2, false, subfg, solvable=solvable)
34-
end
35-
end
36-
37-
# remove excessive variables that were copied by neighbors distance 2
38-
currVars = listVariables(subfg)
39-
toDelVars = setdiff(currVars, syms)
40-
for dv in toDelVars
41-
# delete any neighboring factors first
42-
for fc in lsf(subfg, dv)
43-
deleteFactor!(subfg, fc)
44-
end
45-
46-
# and the variable itself
47-
deleteVariable!(subfg, dv)
48-
end
25+
error("""buildSubgraphFromLabels! is deprecated
26+
NOTE buildSubgraphFromLabels! does not have a 1-1 replacement in DFG
27+
- if you have a set of variables and factors use copyGraph
28+
- if you want neighbors automatically included use buildSubgraph
29+
- if you want a clique subgraph use buildCliqueSubgraph! from IIF
30+
""")
4931

50-
# delete any factors not in the allowed list
51-
if allowedFactors != nothing
52-
delFcts = setdiff(lsf(subfg), allowedFactors)
53-
for dfct in delFcts
54-
deleteFactor!(subfg, dfct)
55-
end
56-
end
57-
58-
# orphaned variables are allowed, but not orphaned factors
59-
60-
return subfg
6132
end
6233

63-
6434
## TODO: I think these are handy, so move to Factor and Variable
6535
Base.getproperty(x::DFGFactor,f::Symbol) = begin
6636
if f == :solvable

0 commit comments

Comments
 (0)