Skip to content

Commit ee07424

Browse files
authored
remove commented code
1 parent 4d460b9 commit ee07424

File tree

1 file changed

+1
-226
lines changed

1 file changed

+1
-226
lines changed

src/Deprecated.jl

Lines changed: 1 addition & 226 deletions
Original file line numberDiff line numberDiff line change
@@ -4,33 +4,9 @@
44

55

66
##==============================================================================
7-
## Remove in 0.8
7+
## Remove in 0.9
88
##==============================================================================
99

10-
# #TODO alias or deprecate
11-
# @deprecate getVariableIds(dfg::AbstractDFG, regexFilter::Union{Nothing, Regex}=nothing; tags::Vector{Symbol}=Symbol[], solvable::Int=0) listVariables(dfg, regexFilter, tags=tags, solvable=solvable)
12-
#
13-
# @deprecate getFactorIds(dfg, regexFilter=nothing; solvable=0) listFactors(dfg, regexFilter, solvable=solvable)
14-
#
15-
# @deprecate listPPE(args...) listPPEs(args...)
16-
#
17-
# export getLabelDict
18-
# getLabelDict(dfg::AbstractDFG) = error("getLabelDict is deprecated, consider using listing functions")
19-
#
20-
# export getAdjacencyMatrix
21-
# """
22-
# $(SIGNATURES)
23-
# Get a matrix indicating relationships between variables and factors. Rows are
24-
# all factors, columns are all variables, and each cell contains either nothing or
25-
# the symbol of the relating factor. The first row and first column are factor and
26-
# variable headings respectively.
27-
# """
28-
# function getAdjacencyMatrix(dfg::AbstractDFG; solvable::Int=0)::Matrix{Union{Nothing, Symbol}}
29-
# error("Deprecated function, please use getBiadjacencyMatrix")
30-
# end
31-
#
32-
# @deprecate getAdjacencyMatrixSparse(dfg::AbstractDFG; solvable::Int=0) getBiadjacencyMatrix(dfg, solvable=solvable)
33-
3410

3511
Base.getproperty(x::DFGFactor,f::Symbol) = begin
3612
if f == :solvable
@@ -72,204 +48,3 @@ Base.setproperty!(x::DFGVariable,f::Symbol, val) = begin
7248
setfield!(x,f,val)
7349
end
7450
end
75-
76-
# #NOTE deprecate in favor of constructors because its not lossless: https://docs.julialang.org/en/v1/manual/conversion-and-promotion/#Conversion-vs.-Construction-1
77-
# function Base.convert(::Type{DFGVariableSummary}, v::DFGVariable)
78-
# Base.depwarn("convert to type DFGVariableSummary is deprecated use the constructor", :convert)
79-
# return DFGVariableSummary(v)
80-
# end
81-
#
82-
# function Base.convert(::Type{SkeletonDFGVariable}, v::VariableDataLevel1)
83-
# Base.depwarn("convert to type SkeletonDFGVariable is deprecated use the constructor", :convert)
84-
# return SkeletonDFGVariable(v)
85-
# end
86-
#
87-
# function Base.convert(::Type{DFGFactorSummary}, f::DFGFactor)
88-
# Base.depwarn("convert to type DFGFactorSummary is deprecated use the constructor", :convert)
89-
# return DFGFactorSummary(f)
90-
# end
91-
#
92-
# function Base.convert(::Type{SkeletonDFGFactor}, f::FactorDataLevel1)
93-
# Base.depwarn("convert to type SkeletonDFGFactor is deprecated use the constructor", :convert)
94-
# return SkeletonDFGFactor(f)
95-
# end
96-
97-
98-
# @deprecate hasOrphans(dfg) !isConnected(dfg)
99-
# @deprecate isFullyConnected(dfg) isConnected(dfg)
100-
101-
# ##==============================================================================
102-
# ## WIP on consolidated subgraph functions, aim to remove in 0.8
103-
# ##==============================================================================
104-
# # Deprecate in favor of buildSubgraph, mergeGraph
105-
# export getSubgraph, getSubgraphAroundNode
106-
# export buildSubgraphFromLabels!
107-
#
108-
# """
109-
# $(SIGNATURES)
110-
# Common function for copying nodes from one graph into another graph.
111-
# This is overridden in specialized implementations for performance.
112-
# NOTE: copyGraphMetadata not supported yet.
113-
# """
114-
# function _copyIntoGraph!(sourceDFG::G, destDFG::H, variableFactorLabels::Vector{Symbol}, includeOrphanFactors::Bool=false; copyGraphMetadata::Bool=false)::Nothing where {G <: AbstractDFG, H <: AbstractDFG}
115-
# # Split into variables and factors
116-
# Base.depwarn("_copyIntoGraph! is deprecated use copyGraph/deepcopyGraph[!]", :_copyIntoGraph!)
117-
#
118-
# includeOrphanFactors && (@error "Adding orphaned factors is not supported")
119-
#
120-
# sourceVariables = map(vId->getVariable(sourceDFG, vId), intersect(listVariables(sourceDFG), variableFactorLabels))
121-
# sourceFactors = map(fId->getFactor(sourceDFG, fId), intersect(listFactors(sourceDFG), variableFactorLabels))
122-
# if length(sourceVariables) + length(sourceFactors) != length(variableFactorLabels)
123-
# rem = symdiff(map(v->v.label, sourceVariables), variableFactorLabels)
124-
# rem = symdiff(map(f->f.label, sourceFactors), variableFactorLabels)
125-
# error("Cannot copy because cannot find the following nodes in the source graph: $rem")
126-
# end
127-
#
128-
# # Now we have to add all variables first,
129-
# for variable in sourceVariables
130-
# if !exists(destDFG, variable)
131-
# addVariable!(destDFG, deepcopy(variable))
132-
# end
133-
# end
134-
# # And then all factors to the destDFG.
135-
# for factor in sourceFactors
136-
# # Get the original factor variables (we need them to create it)
137-
# sourceFactorVariableIds = getNeighbors(sourceDFG, factor)
138-
# # Find the labels and associated variables in our new subgraph
139-
# factVariableIds = Symbol[]
140-
# for variable in sourceFactorVariableIds
141-
# if exists(destDFG, variable)
142-
# push!(factVariableIds, variable)
143-
# end
144-
# end
145-
# # Only if we have all of them should we add it (otherwise strange things may happen on evaluation)
146-
# if includeOrphanFactors || length(factVariableIds) == length(sourceFactorVariableIds)
147-
# if !exists(destDFG, factor)
148-
# addFactor!(destDFG, deepcopy(factor))
149-
# end
150-
# end
151-
# end
152-
#
153-
# if copyGraphMetadata
154-
# setUserData(destDFG, getUserData(sourceDFG))
155-
# setRobotData(destDFG, getRobotData(sourceDFG))
156-
# setSessionData(destDFG, getSessionData(sourceDFG))
157-
# end
158-
# return nothing
159-
# end
160-
#
161-
# """
162-
# $(SIGNATURES)
163-
# Retrieve a deep subgraph copy around a given variable or factor.
164-
# Optionally provide a distance to specify the number of edges should be followed.
165-
# Optionally provide an existing subgraph addToDFG, the extracted nodes will be copied into this graph. By default a new subgraph will be created.
166-
# 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.
167-
# Note: Always returns the node at the center, but filters around it if solvable is set.
168-
# """
169-
# function getSubgraphAroundNode(dfg::AbstractDFG, node::DFGNode, distance::Int=1, includeOrphanFactors::Bool=false, addToDFG::AbstractDFG=_getDuplicatedEmptyDFG(dfg); solvable::Int=0)::AbstractDFG
170-
#
171-
# Base.depwarn("getSubgraphAroundNode is deprecated use buildSubgraph", :getSubgraphAroundNode)
172-
#
173-
# if !exists(dfg, node.label)
174-
# error("Variable/factor with label '$(node.label)' does not exist in the factor graph")
175-
# end
176-
#
177-
# neighbors = getNeighborhood(dfg, node.label, distance)
178-
#
179-
# # for some reason: always returns the node at the center with || (nlbl == node.label)
180-
# solvable != 0 && filter!(nlbl -> (getSolvable(dfg, nlbl) >= solvable) || (nlbl == node.label), neighbors)
181-
#
182-
# # Copy the section of graph we want
183-
# _copyIntoGraph!(dfg, addToDFG, neighbors, includeOrphanFactors)
184-
# return addToDFG
185-
# end
186-
#
187-
# """
188-
# $(SIGNATURES)
189-
# Get a deep subgraph copy from the DFG given a list of variables and factors.
190-
# Optionally provide an existing subgraph addToDFG, the extracted nodes will be copied into this graph. By default a new subgraph will be created.
191-
# 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.
192-
# """
193-
# function getSubgraph(dfg::G,
194-
# variableFactorLabels::Vector{Symbol},
195-
# includeOrphanFactors::Bool=false,
196-
# addToDFG::H=_getDuplicatedEmptyDFG(dfg))::H where {G <: AbstractDFG, H <: AbstractDFG}
197-
#
198-
# Base.depwarn("getSubgraph is deprecated use buildSubgraph", :getSubgraph)
199-
#
200-
# for label in variableFactorLabels
201-
# if !exists(dfg, label)
202-
# error("Variable/factor with label '$(label)' does not exist in the factor graph")
203-
# end
204-
# end
205-
#
206-
# _copyIntoGraph!(dfg, addToDFG, variableFactorLabels, includeOrphanFactors)
207-
# return addToDFG
208-
# end
209-
#
210-
#
211-
# # TODO needsahome: home should be in IIF, calling just deepcopyGraph, or copyGraph
212-
# # Into, Labels, Subgraph are all implied from the parameters.
213-
# # can alies names but like Sam suggested only on copy is needed.
214-
#
215-
#
216-
# """
217-
# $SIGNATURES
218-
# Construct a new factor graph object as a subgraph of `dfg <: AbstractDFG` based on the
219-
# variable labels `syms::Vector{Symbols}`.
220-
#
221-
# SamC: Can we not just use _copyIntoGraph! for this? Looks like a small refactor to make it work.
222-
# Will paste in as-is for now and we can figure it out as we go.
223-
# 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`...
224-
#
225-
# Notes
226-
# - Slighly messy internals, but gets the job done -- some room for performance improvement.
227-
# - Defaults to GraphDFG, but likely to change to LightDFG in future.
228-
# - since DFG v0.6 LightDFG is the default.
229-
#
230-
# DevNotes
231-
# - TODO: still needs to be consolidated with `DFG._copyIntoGraph`
232-
#
233-
# Related
234-
#
235-
# listVariables, _copyIntoGraph!
236-
# """
237-
# function buildSubgraphFromLabels!(dfg::G,
238-
# syms::Vector{Symbol};
239-
# subfg::AbstractDFG=(G <: InMemoryDFGTypes ? G : GraphsDFG)(params=getSolverParams(dfg)),
240-
# solvable::Int=0,
241-
# allowedFactors::Union{Nothing, Vector{Symbol}}=nothing )::AbstractDFG where G <: AbstractDFG
242-
# #
243-
# Base.depwarn("buildSubgraphFromLabels! is deprecated use copyGraph, buildSubgraph or buildCliqueSubgraph!(IIF)", :buildSubgraphFromLabels!)
244-
# # add a little too many variables (since we need the factors)
245-
# for sym in syms
246-
# if solvable <= getSolvable(dfg, sym)
247-
# getSubgraphAroundNode(dfg, getVariable(dfg, sym), 2, false, subfg, solvable=solvable)
248-
# end
249-
# end
250-
#
251-
# # remove excessive variables that were copied by neighbors distance 2
252-
# currVars = listVariables(subfg)
253-
# toDelVars = setdiff(currVars, syms)
254-
# for dv in toDelVars
255-
# # delete any neighboring factors first
256-
# for fc in lsf(subfg, dv)
257-
# deleteFactor!(subfg, fc)
258-
# end
259-
#
260-
# # and the variable itself
261-
# deleteVariable!(subfg, dv)
262-
# end
263-
#
264-
# # delete any factors not in the allowed list
265-
# if allowedFactors != nothing
266-
# delFcts = setdiff(lsf(subfg), allowedFactors)
267-
# for dfct in delFcts
268-
# deleteFactor!(subfg, dfct)
269-
# end
270-
# end
271-
#
272-
# # orphaned variables are allowed, but not orphaned factors
273-
#
274-
# return subfg
275-
# end

0 commit comments

Comments
 (0)