Skip to content

Commit 47ee673

Browse files
committed
Fix #458 and testing
1 parent 63a96ca commit 47ee673

File tree

3 files changed

+20
-8
lines changed

3 files changed

+20
-8
lines changed

src/DistributedFactorGraphs.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ export updateUserData!, updateRobotData!, updateSessionData!, deleteUserData!, d
5454
export emptyUserData!, emptyRobotData!, emptySessionData!
5555

5656
# Graph Types: exported from modules or @reexport
57-
export InMemoryDFGTypes
57+
export InMemoryDFGTypes, DefaultDFG
5858
# LightDFG
5959
# GraphsDFG
6060

@@ -262,6 +262,7 @@ include("LightDFG/LightDFG.jl")
262262
#supported in Memory fg types
263263
# const InMemoryDFGTypes = Union{GraphsDFG, LightDFG}
264264
const InMemoryDFGTypes = LightDFG
265+
const DefaultDFG = LightDFG
265266

266267
# Common includes
267268
include("services/CommonAccessors.jl")

src/services/AbstractDFG.jl

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -979,13 +979,12 @@ function buildSubgraph(::Type{G},
979979
return destDFG
980980
end
981981

982-
# Perhaps IIF.InMemDFGType should perhaps be incorporated as a DFG value, but this has been much debated in the past and hence just left as breadcrum.
983-
buildSubgraph(dfg::AbstractDFG,
984-
variableFactorLabels::Vector{Symbol},
985-
distance::Int=1;
986-
solvable::Int=0,
987-
sessionId::String = "",
988-
kwargs...) = buildSubgraph(typeof(LightDFG(params=getSolverParams(dfg))), dfg, variableFactorLabels, distance, solvable=solvable, sessionId=sessionId, kwargs...)
982+
function buildSubgraph(dfg::AbstractDFG,
983+
variableFactorLabels::Vector{Symbol},
984+
distance::Int=0;
985+
kwargs...)
986+
return buildSubgraph(DefaultDFG, dfg, variableFactorLabels, distance; kwargs...)
987+
end
989988

990989
"""
991990
$(SIGNATURES)

test/testBlocks.jl

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1136,6 +1136,18 @@ function BuildingSubgraphs(testDFGAPI; VARTYPE=DFGVariable, FACTYPE=DFGFactor)
11361136
end
11371137
end
11381138

1139+
#TODO buildSubgraph default constructors for skeleton and summary
1140+
if VARTYPE == DFGVariable
1141+
dfgSubgraph = buildSubgraph(dfg, [:x1, :x2, :x1x2f1])
1142+
@test issetequal([:x1, :x1x2f1, :x2], [ls(dfgSubgraph)..., lsf(dfgSubgraph)...])
1143+
1144+
dfgSubgraph = buildSubgraph(dfg, [:x2, :x3], 2)
1145+
@test issetequal([:x2, :x3, :x1, :x4, :x3x4f1, :x1x2f1, :x2x3f1], [ls(dfgSubgraph)..., lsf(dfgSubgraph)...])
1146+
1147+
dfgSubgraph = buildSubgraph(dfg, [:x1x2f1], 1)
1148+
@test issetequal([:x1, :x1x2f1, :x2], [ls(dfgSubgraph)..., lsf(dfgSubgraph)...])
1149+
end
1150+
11391151
end
11401152

11411153
#TODO Summaries and Summary Graphs

0 commit comments

Comments
 (0)