Skip to content

Commit 3b32a21

Browse files
authored
Merge pull request #81 from JuliaRobotics/feature/symbolfg
Feature/symbolfg
2 parents f0d776b + 2fb8edc commit 3b32a21

File tree

9 files changed

+1134
-5
lines changed

9 files changed

+1134
-5
lines changed

src/DistributedFactorGraphs.jl

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,10 @@ include("FileDFG/FileDFG.jl")
4747
# Include the LightGraphs.jl (MetaGraphs.jl) API.
4848
include("LightGraphsDFG/LightGraphsDFG.jl")
4949

50+
include("SymbolDFG/SymbolDFG.jl")
51+
@reexport using .SymbolDFGs
52+
53+
5054
export saveDFG, loadDFG
5155

5256
function __init__()
@@ -58,7 +62,7 @@ function __init__()
5862
Rows are all factors, columns are all variables, and each cell contains either nothing or the symbol of the relating factor.
5963
The first column is the factor headings.
6064
"""
61-
function getAdjacencyMatrixDataFrame(dfg::Union{GraphsDFG, LightGraphsDFG})::Main.DataFrames.DataFrame
65+
function getAdjacencyMatrixDataFrame(dfg::Union{GraphsDFG, LightGraphsDFG, SymbolDFG})::Main.DataFrames.DataFrame
6266
varLabels = sort(map(v->v.label, getVariables(dfg)))
6367
factLabels = sort(map(f->f.label, getFactors(dfg)))
6468
adjDf = DataFrames.DataFrame(:Factor => Union{Missing, Symbol}[])

src/LightGraphsDFG/services/LightGraphsDFG.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -331,8 +331,8 @@ end
331331

332332
function _isbackendset(dfg::LightGraphsDFG, idx::Int, backendset::Int)::Bool
333333
p = props(dfg.g, idx)
334-
haskey(p, :variable) && (return p[:variable].ready == backendset)
335-
haskey(p, :factor) && (return p[:factor].ready == backendset)
334+
haskey(p, :variable) && (return p[:variable].backendset == backendset)
335+
haskey(p, :factor) && (return p[:factor].backendset == backendset)
336336

337337
#TODO should this be an error?
338338
@warn "Node not a factor or variable"

src/SymbolDFG/SymbolDFG.jl

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
module SymbolDFGs
2+
3+
using LightGraphs
4+
using DocStringExtensions
5+
6+
# import DFG functions to exstend
7+
import ...DistributedFactorGraphs: setSolverParams,
8+
getInnerGraph,
9+
getFactor,
10+
setDescription,
11+
getLabelDict,
12+
addVariable!,
13+
getVariable,
14+
getAddHistory,
15+
addFactor!,
16+
getSolverParams,
17+
exists,
18+
getDescription,
19+
updateVariable!,
20+
updateFactor!,
21+
deleteVariable!,
22+
deleteFactor!,
23+
getVariables,
24+
getVariableIds,
25+
ls,
26+
getFactors,
27+
getFactorIds,
28+
lsf,
29+
isFullyConnected,
30+
hasOrphans,
31+
getNeighbors,
32+
getSubgraphAroundNode,
33+
getSubgraph,
34+
getAdjacencyMatrix
35+
36+
include("SymbolFactorGraphs/SymbolFactorGraphs.jl")
37+
using .SymbolFactorGraphs
38+
39+
# export SymbolEdge, is_directed, has_edge
40+
# Imports
41+
include("entities/SymbolDFG.jl")
42+
include("services/SymbolDFG.jl")
43+
44+
# Exports
45+
export SymbolDFG
46+
47+
export exists
48+
export getLabelDict, getDescription, setDescription, getInnerGraph, getAddHistory, getSolverParams, setSolverParams
49+
#
50+
export getAddHistory, getDescription, getLabelDict
51+
export addVariable!, addFactor!
52+
export ls, lsf, getVariables, getFactors, getVariableIds, getFactorIds
53+
export getVariable, getFactor
54+
export updateVariable!, updateFactor!
55+
export deleteVariable!, deleteFactor!
56+
export getAdjacencyMatrix
57+
export getAdjacencyMatrixDataFrame
58+
export getNeighbors
59+
export getSubgraphAroundNode
60+
export getSubgraph
61+
export isFullyConnected, hasOrphans
62+
export toDot, toDotFile
63+
64+
end

0 commit comments

Comments
 (0)