Skip to content

Commit 2fda4d9

Browse files
committed
Merge branch 'master' into feature/20Q1/VNDCondition
2 parents 61a9886 + ebac912 commit 2fda4d9

38 files changed

+2597
-2341
lines changed

Project.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,25 +10,29 @@ Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f"
1010
DocStringExtensions = "ffbed154-4ef7-542d-bbb7-c09d3a79fcae"
1111
GraphPlot = "a2cc645c-3eea-5389-862e-a155d0052231"
1212
Graphs = "86223c79-3864-5bf0-83f7-82e725a168b6"
13+
JSON = "682c06a0-de6a-54ab-a142-c8b1cf79cde6"
1314
JSON2 = "2535ab7d-5cd8-5a07-80ac-9b1792aadce3"
1415
LightGraphs = "093fc24a-ae57-5d10-9952-331d41423f4d"
1516
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
1617
Neo4j = "d2adbeaf-5838-5367-8a2f-e46d570981db"
1718
Reexport = "189a3867-3050-52da-a836-e630ba90ab69"
1819
Requires = "ae029012-a4dd-5104-9daa-d747884805df"
1920
SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
21+
Unmarshal = "cbff2730-442d-58d7-89d1-8e530c41eb02"
2022

2123
[compat]
2224
Colors = "0.8, 0.9, 0.10, 0.11"
2325
Distributions = "0.18, 0.19, 0.20, 0.21, 0.22, 0.23, 0.24, 0.25, 1"
2426
DocStringExtensions = "0.8, 0.9, 0.10, 1"
2527
GraphPlot = "0.3.1, 0.4"
2628
Graphs = "0.10.2, 0.11, 1"
29+
JSON = "0.21"
2730
JSON2 = "0.3.1"
2831
LightGraphs = "1.2, 1.3"
2932
Neo4j = "2"
3033
Reexport = "0.2, 0.3, 0.4, 0.5, 1"
3134
Requires = "0.5, 0.6, 0.7, 0.8, 0.9, 0.10, 1"
35+
Unmarshal = "0.3"
3236
julia = "0.7, 1"
3337

3438
[extras]

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ add DistributedFactorGraphs
2222

2323
# Usage
2424
DistributedFactorGraphs (DFG) currently supports two implementations:
25-
* An in-memory factor graph based on Graphs.jl
25+
* An in-memory factor graphs based on Graphs.jl and LightGraphs.jl
2626
* A Neo4j-based factor graph based on Neo4j.jl
2727

2828
The in-memory implementation is the default. The Neo4j driver can be enabled by importing Neo4j before DFG:

docs/Project.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
[deps]
22
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
3+
GraphPlot = "a2cc645c-3eea-5389-862e-a155d0052231"
34
LightGraphs = "093fc24a-ae57-5d10-9952-331d41423f4d"
45

56
[compat]

docs/make.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using Documenter
2+
using GraphPlot
23
using DistributedFactorGraphs
34

45
makedocs(

docs/src/BuildingGraphs.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -111,16 +111,16 @@ Reading, updating, and deleting all use DFG functions (as opposed to adding,
111111
where using the IncrementalInference functions are recommended).
112112

113113
Each variable and factor is uniquely identified by its label. The list of
114-
variable and factor labels can be retrieved with the `ls`/`getVariableIds` and
115-
`lsf`/`getFactorIds` functions:
114+
variable and factor labels can be retrieved with the `ls`/`listVariables` and
115+
`lsf`/`listFactors` functions:
116116

117117
```@docs
118-
getVariableIds
118+
listVariables
119119
ls
120120
```
121121

122122
```@docs
123-
getFactorIds
123+
listFactors
124124
lsf
125125
```
126126

docs/src/GraphData.md

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -43,27 +43,24 @@ Labels are the principle identifier of a variable or factor.
4343
getLabel
4444
```
4545

46-
```@docs
47-
getLabel
48-
```
49-
5046
#### Timestamps
5147

5248
Each variable or factor can have a timestamp associated with it.
5349

5450
```@docs
5551
getTimestamp
56-
setTimestamp!
52+
setTimestamp
5753
```
5854

5955
#### Tags
6056

6157
Tags are a set of symbols that contain identifiers for the variable or factor.
6258

6359
```@docs
64-
addTag
60+
listTags
6561
mergeTags!
66-
deleteTags!
62+
removeTags!
63+
emptyTags!
6764
```
6865

6966
### Solvable
@@ -95,7 +92,6 @@ For each PPE structure, there are accessors for getting individual values:
9592
getMaxPPE
9693
getMeanPPE
9794
getSuggestedPPE
98-
getPPE
9995
```
10096

10197
Related functions for getting, adding/updating, and deleting PPE structures:
@@ -106,6 +102,7 @@ getPPE
106102
addPPE!
107103
updatePPE!
108104
deletePPE!
105+
mergePPEs!
109106
```
110107

111108
Example of PPE operations:
@@ -139,6 +136,7 @@ getVariableSolverData
139136
addVariableSolverData!
140137
updateVariableSolverData!
141138
deleteVariableSolverData!
139+
mergeVariableSolverData!
142140
```
143141

144142
Example of solver data operations:
@@ -163,7 +161,7 @@ itself, large entries will slow the graph down, so if data should exceed a
163161
few bytes/kb, it should rather be saved in bigData.
164162

165163
```@docs
166-
getSmallData,
164+
getSmallData
167165
setSmallData!
168166
```
169167

docs/src/TraversingAndQuerying.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,5 @@
44
getNeighbors
55
getSubgraphAroundNode
66
getSubgraph
7-
getIncidenceMatrix
8-
getIncidenceMatrixSparse
7+
getBiadjacencyMatrix
98
```

docs/src/func_ref.md

Lines changed: 2 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -7,67 +7,6 @@ Pages = [
77
Depth = 3
88
```
99

10-
### Graph Types
11-
```@docs
12-
GraphsDFG
13-
```
14-
15-
### Creating DFG Factor Graphs
16-
```@docs
17-
addVariable!
18-
addFactor!
19-
```
20-
21-
### Getting Factor Graph Nodes
22-
```@docs
23-
getVariables
24-
getFactors
25-
getVariable
26-
getFactor
27-
getNeighbors
28-
ls
29-
lsf
30-
```
31-
32-
### Updating Factor Graph Nodes
33-
```@docs
34-
updateVariable!
35-
updateFactor!
36-
```
37-
38-
### Deleting Factor Graph Nodes
39-
```@docs
40-
deleteVariable!
41-
deleteFactor!
42-
```
43-
44-
### Getting Adjacency Matrix
45-
```@docs
46-
getIncidenceMatrix
47-
getIncidenceMatrixSparse
48-
```
49-
50-
### Validating Factor Graph Connectivity
51-
```@docs
52-
isFullyConnected
53-
hasOrphans
54-
```
55-
56-
### Copying Subgraphs
57-
```@docs
58-
getSubgraphAroundNode
59-
getSubgraph
60-
```
61-
62-
### Summaries
63-
```@docs
64-
getSummary
65-
getSummaryGraph
66-
```
67-
68-
### Visualization and Plotting
69-
```@docs
70-
toDot
71-
toDotFile
72-
dfgplot
10+
```@autodocs
11+
Modules = [DistributedFactorGraphs, LightDFGs, DFGPlots]
7312
```

docs/src/index.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,17 @@
11
# Introduction
22

3-
This package is a specialized Julia graphing wrapper.
3+
DistributedFactorGraphs.jl provides a flexible factor graph API for use in the [Caesar.jl](https://github.com/JuliaRobotics/Caesar.jl) ecosystem. The package supplies:
4+
* A standardized API for interacting with factor graphs
5+
* Implementations of the API for in-memory and database-driven operation
6+
* Visualization extensions to validate the underlying graph
7+
8+
**Note** this package is still under initial development, and will adopt parts of the functionality currently contained in [IncrementalInference.jl](http://www.github.com/JuliaRobotics/IncrementalInference.jl).
49

510
## Installation
6-
This package is not yet registered with JuliaLang/METADATA.jl, but can be easily installed in Julia 0.6 with:
11+
12+
DistributedFactorGraphs can be installed from Julia packages using:
713
```julia
8-
julia> ]add https://github.com/GearsAD/GraffSDK.jl.git
14+
julia> ]add DistributedFactorGraphs
915
```
1016

1117
## Manual Outline

src/BigData/services/AbstractBigDataEntries.jl

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,96 @@ end
1515
function ==(a::FileBigDataEntry, b::FileBigDataEntry)
1616
return a.key == b.key && a.filename == b.filename
1717
end
18+
19+
"""
20+
$(SIGNATURES)
21+
Add Big Data Entry to a DFG variable
22+
"""
23+
function addBigDataEntry!(var::AbstractDFGVariable, bde::AbstractBigDataEntry)::AbstractBigDataEntry
24+
haskey(var.bigData,bde.key) && error("BigData entry $(bde.key) already exists in variable")
25+
var.bigData[bde.key] = bde
26+
return bde
27+
end
28+
29+
"""
30+
$(SIGNATURES)
31+
Add Big Data Entry to distributed factor graph.
32+
Should be extended if DFG variable is not returned by reference.
33+
"""
34+
function addBigDataEntry!(dfg::AbstractDFG, label::Symbol, bde::AbstractBigDataEntry)::AbstractBigDataEntry
35+
return addBigDataEntry!(getVariable(dfg, label), bde)
36+
end
37+
38+
"""
39+
$(SIGNATURES)
40+
Get big data entry
41+
"""
42+
function getBigDataEntry(var::AbstractDFGVariable, key::Symbol)::Union{Nothing, AbstractBigDataEntry}
43+
!haskey(var.bigData, key) && (error("BigData entry $(key) does not exist in variable"); return nothing)
44+
return var.bigData[key]
45+
end
46+
47+
function getBigDataEntry(dfg::AbstractDFG, label::Symbol, key::Symbol)::Union{Nothing, AbstractBigDataEntry}
48+
return getBigDataEntry(getVariable(dfg, label), key)
49+
end
50+
51+
"""
52+
$(SIGNATURES)
53+
Update big data entry
54+
"""
55+
function updateBigDataEntry!(var::AbstractDFGVariable, bde::AbstractBigDataEntry)::Union{Nothing, AbstractBigDataEntry}
56+
!haskey(var.bigData,bde.key) && (@warn "$(bde.key) does not exist in variable, adding")
57+
var.bigData[bde.key] = bde
58+
return bde
59+
end
60+
function updateBigDataEntry!(dfg::AbstractDFG, label::Symbol, bde::AbstractBigDataEntry)::Union{Nothing, AbstractBigDataEntry}
61+
# !isVariable(dfg, label) && return nothing
62+
return updateBigDataEntry!(getVariable(dfg, label), bde)
63+
end
64+
65+
"""
66+
$(SIGNATURES)
67+
Delete big data entry from the factor graph.
68+
Note this doesn't remove it from any data stores.
69+
"""
70+
function deleteBigDataEntry!(var::AbstractDFGVariable, key::Symbol)::Union{Nothing, AbstractDFGVariable} #users responsibility to delete big data in db before deleting entry
71+
bde = getBigDataEntry(var, key)
72+
bde == nothing && return nothing
73+
delete!(var.bigData, key)
74+
return var
75+
end
76+
function deleteBigDataEntry!(dfg::AbstractDFG, label::Symbol, key::Symbol)::Union{Nothing, AbstractDFGVariable} #users responsibility to delete big data in db before deleting entry
77+
!isVariable(dfg, label) && return nothing
78+
return deleteBigDataEntry!(getVariable(dfg, label), key)
79+
end
80+
81+
function deleteBigDataEntry!(var::AbstractDFGVariable, entry::AbstractBigDataEntry)::Union{Nothing, AbstractDFGVariable} #users responsibility to delete big data in db before deleting entry
82+
return deleteBigDataEntry!(var, entry.key)
83+
end
84+
85+
"""
86+
$(SIGNATURES)
87+
Get big data entries, Vector{AbstractBigDataEntry}
88+
"""
89+
function getBigDataEntries(var::AbstractDFGVariable)::Vector{AbstractBigDataEntry}
90+
#or should we return the iterator, Base.ValueIterator{Dict{Symbol,AbstractBigDataEntry}}?
91+
collect(values(var.bigData))
92+
end
93+
function getBigDataEntries(dfg::AbstractDFG, label::Symbol)::Union{Nothing, Vector{AbstractBigDataEntry}}
94+
!isVariable(dfg, label) && return nothing
95+
#or should we return the iterator, Base.ValueIterator{Dict{Symbol,AbstractBigDataEntry}}?
96+
getBigDataEntries(getVariable(dfg, label))
97+
end
98+
99+
100+
"""
101+
$(SIGNATURES)
102+
getBigDataKeys
103+
"""
104+
function getBigDataKeys(var::AbstractDFGVariable)::Vector{Symbol}
105+
collect(keys(var.bigData))
106+
end
107+
function getBigDataKeys(dfg::AbstractDFG, label::Symbol)::Union{Nothing, Vector{Symbol}}
108+
!isVariable(dfg, label) && return nothing
109+
getBigDataKeys(getVariable(dfg, label))
110+
end

0 commit comments

Comments
 (0)