You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/Deprecated.jl
+196-1Lines changed: 196 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -95,4 +95,199 @@ Base.setproperty!(x::DFGFactor,f::Symbol, val) = begin
95
95
end
96
96
97
97
98
-
#
98
+
#NOTE deprecate in favor of constructors because its not lossless: https://docs.julialang.org/en/v1/manual/conversion-and-promotion/#Conversion-vs.-Construction-1
99
+
function Base.convert(::Type{DFGVariableSummary}, v::DFGVariable)
100
+
Base.depwarn("convert to type DFGVariableSummary is deprecated use the constructor", :convert)
101
+
returnDFGVariableSummary(v)
102
+
end
103
+
104
+
function Base.convert(::Type{SkeletonDFGVariable}, v::VariableDataLevel1)
105
+
Base.depwarn("convert to type SkeletonDFGVariable is deprecated use the constructor", :convert)
106
+
returnSkeletonDFGVariable(v)
107
+
end
108
+
109
+
function Base.convert(::Type{DFGFactorSummary}, f::DFGFactor)
110
+
Base.depwarn("convert to type DFGFactorSummary is deprecated use the constructor", :convert)
111
+
returnDFGFactorSummary(f)
112
+
end
113
+
114
+
function Base.convert(::Type{SkeletonDFGFactor}, f::FactorDataLevel1)
115
+
Base.depwarn("convert to type SkeletonDFGFactor is deprecated use the constructor", :convert)
Retrieve a deep subgraph copy around a given variable or factor.
182
+
Optionally provide a distance to specify the number of edges should be followed.
183
+
Optionally provide an existing subgraph addToDFG, the extracted nodes will be copied into this graph. By default a new subgraph will be created.
184
+
Note: By default orphaned factors (where the subgraph does not contain all the related variables) are not returned. Set includeOrphanFactors to return the orphans irrespective of whether the subgraph contains all the variables.
185
+
Note: Always returns the node at the center, but filters around it if solvable is set.
Get a deep subgraph copy from the DFG given a list of variables and factors.
208
+
Optionally provide an existing subgraph addToDFG, the extracted nodes will be copied into this graph. By default a new subgraph will be created.
209
+
Note: By default orphaned factors (where the subgraph does not contain all the related variables) are not returned. Set includeOrphanFactors to return the orphans irrespective of whether the subgraph contains all the variables.
210
+
"""
211
+
functiongetSubgraph(dfg::G,
212
+
variableFactorLabels::Vector{Symbol},
213
+
includeOrphanFactors::Bool=false,
214
+
addToDFG::H=_getDuplicatedEmptyDFG(dfg))::Hwhere {G <:AbstractDFG, H <:AbstractDFG}
215
+
216
+
Base.depwarn("getSubgraph is deprecated use buildSubgraph", :getSubgraph)
217
+
218
+
for label in variableFactorLabels
219
+
if!exists(dfg, label)
220
+
error("Variable/factor with label '$(label)' does not exist in the factor graph")
#TODO needsahome: home should be in IIF, calling just deepcopyGraph, or copyGraph
230
+
# Into, Labels, Subgraph are all implied from the parameters.
231
+
# can alies names but like Sam suggested only on copy is needed.
232
+
233
+
234
+
"""
235
+
$SIGNATURES
236
+
Construct a new factor graph object as a subgraph of `dfg <: AbstractDFG` based on the
237
+
variable labels `syms::Vector{Symbols}`.
238
+
239
+
SamC: Can we not just use _copyIntoGraph! for this? Looks like a small refactor to make it work.
240
+
Will paste in as-is for now and we can figure it out as we go.
241
+
DF: Absolutely agree that subgraph functions should use `DFG._copyIntoGraph!` as a single dependency in the code base. There have been a repeated new rewrites of IIF.buildSubGraphFromLabels (basic wrapper is fine) but nominal should be to NOT duplicate DFG functionality in IIF -- rather use/improve the existing features in DFG. FYI, I have repeatedly refactored this function over and over to use DFG properly but somehow this (add/delete/Variable/Factor) version keeps coming back without using `_copyIntoGraph`!!??? See latest effort commented out below `buildSubgraphFromLabels!_SPECIAL`...
242
+
243
+
Notes
244
+
- Slighly messy internals, but gets the job done -- some room for performance improvement.
245
+
- Defaults to GraphDFG, but likely to change to LightDFG in future.
246
+
- since DFG v0.6 LightDFG is the default.
247
+
248
+
DevNotes
249
+
- TODO: still needs to be consolidated with `DFG._copyIntoGraph`
250
+
251
+
Related
252
+
253
+
listVariables, _copyIntoGraph!
254
+
"""
255
+
functionbuildSubgraphFromLabels!(dfg::G,
256
+
syms::Vector{Symbol};
257
+
subfg::AbstractDFG=(G <:InMemoryDFGTypes? G : GraphsDFG)(params=getSolverParams(dfg)),
258
+
solvable::Int=0,
259
+
allowedFactors::Union{Nothing, Vector{Symbol}}=nothing )::AbstractDFGwhere G <:AbstractDFG
260
+
#
261
+
Base.depwarn("buildSubgraphFromLabels! is deprecated use copyGraph, buildSubgraph or buildCliqueSubgraph!(IIF)", :buildSubgraphFromLabels!)
262
+
# add a little too many variables (since we need the factors)
@@ -255,42 +255,6 @@ function getNeighbors(dfg::GraphsDFG, label::Symbol; solvable::Int=0)::Vector{Sy
255
255
returnmap(n -> n.dfgNode.label, neighbors)
256
256
end
257
257
258
-
#NOTE Replaced by abstract function in services/AbstractDFG.jl
259
-
# """
260
-
# $(SIGNATURES)
261
-
# Retrieve a deep subgraph copy around a given variable or factor.
262
-
# Optionally provide a distance to specify the number of edges should be followed.
263
-
# Optionally provide an existing subgraph addToDFG, the extracted nodes will be copied into this graph. By default a new subgraph will be created.
264
-
# Note: By default orphaned factors (where the subgraph does not contain all the related variables) are not returned. Set includeOrphanFactors to return the orphans irrespective of whether the subgraph contains all the variables.
265
-
# """
266
-
# function getSubgraphAroundNode(dfg::GraphsDFG{P}, node::T, distance::Int64=1, includeOrphanFactors::Bool=false, addToDFG::GraphsDFG=GraphsDFG{P}(); solvable::Int=0)::GraphsDFG where {P <: AbstractParams, T <: DFGNode}
267
-
# if !haskey(dfg.labelDict, node.label)
268
-
# error("Variable/factor with label '$(node.label)' does not exist in the factor graph")
269
-
# end
270
-
#
271
-
# # Build a list of all unique neighbors inside 'distance'
0 commit comments