Skip to content

Commit 5d284c9

Browse files
authored
Merge pull request #380 from JuliaRobotics/feature/20Q2/ls2
Feature ls2 close #332
2 parents 0ce1d5c + 7208abc commit 5d284c9

File tree

3 files changed

+13
-3
lines changed

3 files changed

+13
-3
lines changed

src/DistributedFactorGraphs.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ export mergeVariableData!, mergeGraphVariableData!
191191
export natural_lt, sortDFG
192192

193193
## List
194-
export ls, lsf
194+
export ls, lsf, ls2
195195
export lsTypes, lsfTypes
196196
export lsWho, lsfWho
197197
export isPrior, lsfPriors
@@ -224,7 +224,7 @@ export
224224
compareFactorGraphs
225225

226226

227-
## Deprecated exports should be listed in Deprecated.jl if possible, otherwise here
227+
## Deprecated exports should be listed in Deprecated.jl if possible, otherwise here
228228

229229

230230
## needsahome.jl

src/services/AbstractDFG.jl

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -538,6 +538,15 @@ function lsf(dfg::G, ::Type{T}) where {G <: AbstractDFG, T <: FunctorInferenceTy
538538
ls(dfg, T)
539539
end
540540

541+
"""
542+
$(SIGNATURES)
543+
Helper to return neighbors at distance 2 around a given node label.
544+
"""
545+
function ls2(dfg::AbstractDFG, label::Symbol)
546+
l2 = getNeighborhood(dfg, label, 2)
547+
l1 = getNeighborhood(dfg, label, 1)
548+
return setdiff(l2, l1)
549+
end
541550

542551
"""
543552
$SIGNATURES

test/testBlocks.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ end
3030
Base.:(==)(a::TestCCW, b::TestCCW) = a.usrfnc! == b.usrfnc!
3131

3232

33-
global testDFGAPI = LightDFG
3433
global testDFGAPI = GraphsDFG
34+
global testDFGAPI = LightDFG
3535

3636
#test Specific definitions
3737
# struct TestInferenceVariable1 <: InferenceVariable end
@@ -731,6 +731,7 @@ function testGroup!(fg, v1, v2, f0, f1)
731731
@test getVariableType(v1) == TestSofttype1()
732732
@test getVariableType(fg,:a) == TestSofttype1()
733733

734+
@test ls2(fg, :a) == [:b]
734735

735736
#TODO what is lsTypes supposed to return?
736737
@test_broken lsTypes(fg)

0 commit comments

Comments
 (0)