Skip to content

Commit aa7ac5d

Browse files
authored
Merge pull request #21 from JuliaRobotics/feature/hasfctvar
new functions for Graphs
2 parents c26793b + 58c8195 commit aa7ac5d

File tree

3 files changed

+24
-1
lines changed

3 files changed

+24
-1
lines changed

src/DistributedFactorGraphs.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,7 @@ include("services/GraphsDFG.jl")
3131
include("services/AbstractDFG.jl")
3232
include("services/DFGVariable.jl")
3333

34+
# not sure where to put
35+
include("NeedsAHome.jl")
36+
3437
end

src/NeedsAHome.jl

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
2+
export hasFactor, hasVariable
3+
4+
"""
5+
$SIGNATURES
6+
7+
Return boolean whether a factor `label` is present in `<:AbstractDFG`.
8+
"""
9+
function hasFactor(dfg::G, label::Symbol)::Bool where {G <: AbstractDFG}
10+
return haskey(dfg.labelDict, label)
11+
end
12+
13+
"""
14+
$(SIGNATURES)
15+
16+
Return `::Bool` on whether `dfg` contains the variable `lbl::Symbol`.
17+
"""
18+
function hasVariable(dfg::G, label::Symbol)::Bool where {G <: AbstractDFG}
19+
return haskey(dfg.labelDict, label) # haskey(vertices(dfg.g), label)
20+
end

src/services/GraphsDFG.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ function lsf(dfg::GraphsDFG, regexFilter::Union{Nothing, Regex}=nothing)::Vector
293293
return factors
294294
end
295295
function lsf(dfg::GraphsDFG, label::Symbol)::Vector{Symbol}
296-
return GraphsJl.getNeighbors(dfg, label)
296+
return getNeighbors(dfg, label)
297297
end
298298

299299
# Alias

0 commit comments

Comments
 (0)