Skip to content

Commit 33e558a

Browse files
authored
Merge pull request #455 from JuliaRobotics/bugfix/20q2/deprbuildSubgraphFromLabels!
buildSubgraphFromLabels!: rather error with notes of replacement functions
2 parents 01b8b7a + 846c532 commit 33e558a

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
@@ -18,51 +18,21 @@ include("../attic/GraphsDFG/GraphsDFG.jl")
1818
export buildSubgraphFromLabels!
1919

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

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

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

0 commit comments

Comments
 (0)