@@ -200,13 +200,6 @@ function deleteVariable!(dfg::GraphsDFG, label::Symbol)::DFGVariable
200200 return variable
201201end
202202
203- # Alias
204- """
205- $(SIGNATURES)
206- Delete a referenced DFGVariable from the DFG.
207- """
208- deleteVariable! (dfg:: GraphsDFG , variable:: DFGVariable ):: DFGVariable = deleteVariable! (dfg, variable. label)
209-
210203"""
211204 $(SIGNATURES)
212205Delete a DFGFactor from the DFG using its label.
@@ -221,13 +214,6 @@ function deleteFactor!(dfg::GraphsDFG, label::Symbol)::DFGFactor
221214 return factor
222215end
223216
224- # Alias
225- """
226- $(SIGNATURES)
227- Delete the referened DFGFactor from the DFG.
228- """
229- deleteFactor! (dfg:: GraphsDFG , factor:: DFGFactor ):: DFGFactor = deleteFactor! (dfg, factor. label)
230-
231217"""
232218 $(SIGNATURES)
233219List the DFGVariables in the DFG.
@@ -245,34 +231,6 @@ function getVariables(dfg::GraphsDFG, regexFilter::Union{Nothing, Regex}=nothing
245231 return variables
246232end
247233
248- """
249- $(SIGNATURES)
250- Get a list of IDs of the DFGVariables in the DFG.
251- Optionally specify a label regular expression to retrieves a subset of the variables.
252-
253- Example
254- ```julia
255- getVariableIds(dfg, r"l", tags=[:APRILTAG;])
256- ```
257-
258- Related
259-
260- ls
261- """
262- function getVariableIds (dfg:: GraphsDFG , regexFilter:: Union{Nothing, Regex} = nothing ; tags:: Vector{Symbol} = Symbol[]):: Vector{Symbol}
263- vars = getVariables (dfg, regexFilter, tags= tags)
264- # mask = map(v -> length(intersect(v.tags, tags)) > 0, vars )
265- map (v -> v. label, vars)
266- end
267-
268- # Alias
269- """
270- $(SIGNATURES)
271- List the DFGVariables in the DFG.
272- Optionally specify a label regular expression to retrieves a subset of the variables.
273- """
274- ls (dfg:: GraphsDFG , regexFilter:: Union{Nothing, Regex} = nothing ; tags:: Vector{Symbol} = Symbol[]):: Vector{Symbol} = getVariableIds (dfg, regexFilter, tags= tags)
275-
276234"""
277235 $(SIGNATURES)
278236List the DFGFactors in the DFG.
@@ -286,29 +244,6 @@ function getFactors(dfg::GraphsDFG, regexFilter::Union{Nothing, Regex}=nothing):
286244 return factors
287245end
288246
289- """
290- $(SIGNATURES)
291- Get a list of the IDs of the DFGFactors in the DFG.
292- Optionally specify a label regular expression to retrieves a subset of the factors.
293- """
294- getFactorIds (dfg:: GraphsDFG , regexFilter:: Union{Nothing, Regex} = nothing ):: Vector{Symbol} = map (f -> f. label, getFactors (dfg, regexFilter))
295-
296- """
297- $(SIGNATURES)
298- List the DFGFactors in the DFG.
299- Optionally specify a label regular expression to retrieves a subset of the factors.
300- """
301- # Alias
302- lsf (dfg:: GraphsDFG , regexFilter:: Union{Nothing, Regex} = nothing ):: Vector{Symbol} = getFactorIds (dfg, regexFilter)
303-
304- """
305- $(SIGNATURES)
306- Alias for getNeighbors - returns neighbors around a given node label.
307- """
308- function lsf (dfg:: GraphsDFG , label:: Symbol ):: Vector{Symbol}
309- return getNeighbors (dfg, label)
310- end
311-
312247"""
313248 $(SIGNATURES)
314249Checks if the graph is fully connected, returns true if so.
@@ -317,14 +252,6 @@ function isFullyConnected(dfg::GraphsDFG)::Bool
317252 return length (Graphs. connected_components (dfg. g)) == 1
318253end
319254
320- # Alias
321- """
322- $(SIGNATURES)
323- Checks if the graph is not fully connected, returns true if it is not contiguous.
324- """
325- hasOrphans (dfg:: GraphsDFG ):: Bool = ! isFullyConnected (dfg)
326-
327-
328255"""
329256 $(SIGNATURES)
330257Retrieve a list of labels of the immediate neighbors around a given variable or factor.
@@ -369,56 +296,40 @@ function getNeighbors(dfg::GraphsDFG, label::Symbol; ready::Union{Nothing, Int}=
369296 return map (n -> n. dfgNode. label, neighbors)
370297end
371298
372- # Aliases
373- """
374- $(SIGNATURES)
375- Retrieve a list of labels of the immediate neighbors around a given variable or factor.
376- """
377- function ls (dfg:: GraphsDFG , node:: T ):: Vector{Symbol} where T <: DFGNode
378- return getNeighbors (dfg, node)
379- end
380- """
381- $(SIGNATURES)
382- Retrieve a list of labels of the immediate neighbors around a given variable or factor specified by its label.
383- """
384- function ls (dfg:: GraphsDFG , label:: Symbol ):: Vector{Symbol} where T <: DFGNode
385- return getNeighbors (dfg, label)
386- end
387-
388- function _copyIntoGraph! (sourceDFG:: GraphsDFG , destDFG:: GraphsDFG , variableFactorLabels:: Vector{Symbol} , includeOrphanFactors:: Bool = false ):: Nothing
389- # Split into variables and factors
390- verts = map (id -> sourceDFG. g. vertices[sourceDFG. labelDict[id]], variableFactorLabels)
391- sourceVariables = filter (n -> n. dfgNode isa DFGVariable, verts)
392- sourceFactors = filter (n -> n. dfgNode isa DFGFactor, verts)
393-
394- # Now we have to add all variables first,
395- for variable in sourceVariables
396- if ! haskey (destDFG. labelDict, variable. dfgNode. label)
397- addVariable! (destDFG, deepcopy (variable. dfgNode))
398- end
399- end
400- # And then all factors to the destDFG.
401- for factor in sourceFactors
402- if ! haskey (destDFG. labelDict, factor. dfgNode. label)
403- # Get the original factor variables (we need them to create it)
404- neighVarIds = getNeighbors (sourceDFG, factor. dfgNode. label) # OLD: in_neighbors(factor, sourceDFG.g)
405- # Find the labels and associated neighVarIds in our new subgraph
406- factVariables = DFGVariable[]
407- for neighVarId in neighVarIds
408- if haskey (destDFG. labelDict, neighVarId)
409- push! (factVariables, getVariable (destDFG, neighVarId))
410- # otherwise ignore
411- end
412- end
413-
414- # Only if we have all of them should we add it (otherwise strange things may happen on evaluation)
415- if includeOrphanFactors || length (factVariables) == length (neighVarIds)
416- addFactor! (destDFG, factVariables, deepcopy (factor. dfgNode))
417- end
418- end
419- end
420- return nothing
421- end
299+ # function _copyIntoGraph!(sourceDFG::GraphsDFG, destDFG::GraphsDFG, variableFactorLabels::Vector{Symbol}, includeOrphanFactors::Bool=false)::Nothing
300+ # # Split into variables and factors
301+ # verts = map(id -> sourceDFG.g.vertices[sourceDFG.labelDict[id]], variableFactorLabels)
302+ # sourceVariables = filter(n -> n.dfgNode isa DFGVariable, verts)
303+ # sourceFactors = filter(n -> n.dfgNode isa DFGFactor, verts)
304+ #
305+ # # Now we have to add all variables first,
306+ # for variable in sourceVariables
307+ # if !haskey(destDFG.labelDict, variable.dfgNode.label)
308+ # addVariable!(destDFG, deepcopy(variable.dfgNode))
309+ # end
310+ # end
311+ # # And then all factors to the destDFG.
312+ # for factor in sourceFactors
313+ # if !haskey(destDFG.labelDict, factor.dfgNode.label)
314+ # # Get the original factor variables (we need them to create it)
315+ # neighVarIds = getNeighbors(sourceDFG, factor.dfgNode.label) #OLD: in_neighbors(factor, sourceDFG.g)
316+ # # Find the labels and associated neighVarIds in our new subgraph
317+ # factVariables = DFGVariable[]
318+ # for neighVarId in neighVarIds
319+ # if haskey(destDFG.labelDict, neighVarId)
320+ # push!(factVariables, getVariable(destDFG, neighVarId))
321+ # #otherwise ignore
322+ # end
323+ # end
324+ #
325+ # # Only if we have all of them should we add it (otherwise strange things may happen on evaluation)
326+ # if includeOrphanFactors || length(factVariables) == length(neighVarIds)
327+ # addFactor!(destDFG, factVariables, deepcopy(factor.dfgNode))
328+ # end
329+ # end
330+ # end
331+ # return nothing
332+ # end
422333
423334"""
424335 $(SIGNATURES)
0 commit comments