Skip to content

Commit ccf1bbe

Browse files
committed
some more @example with output
1 parent 3e77289 commit ccf1bbe

File tree

2 files changed

+21
-12
lines changed

2 files changed

+21
-12
lines changed

docs/Project.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ Cairo = "159f3aea-2a34-519c-b102-8c37f9878175"
33
Compose = "a81c6b42-2e10-5240-aca2-a61377ecd94b"
44
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
55
GraphPlot = "a2cc645c-3eea-5389-862e-a155d0052231"
6+
IncrementalInference = "904591bb-b899-562f-9e6f-b8df64c7d480"
67
LightGraphs = "093fc24a-ae57-5d10-9952-331d41423f4d"
78

89
[compat]

docs/src/BuildingGraphs.md

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
In this section constructing DFG graphs will be discussed. To start, bring DistributedFactorGraphs into your workspace:
44

5-
```julia
5+
```@example buildingGraphs; continued = true
66
using DistributedFactorGraphs
77
```
88

@@ -13,6 +13,8 @@ So for the following examples, IncrementalInference will be used to create the v
1313
```julia
1414
using Pkg
1515
Pkg.add("IncrementalInference")
16+
```
17+
```@example buildingGraphs; continued = true
1618
using IncrementalInference
1719
```
1820

@@ -28,16 +30,16 @@ To continue the example, run one of the following to create a DFG driver:
2830

2931
### Creating a LightDFG Graph
3032

31-
```julia
33+
```@example buildingGraphs; continued = true
3234
# Create a DFG with default solver parameters using the LightGraphs.jl driver.
33-
dfg = LightDFG{SolverParams}(params=SolverParams())
35+
dfg = LightDFG{SolverParams}(solverParams=SolverParams())
3436
```
3537

3638
### Creating a CloudGraphsDFG Graph
3739

3840
```julia
3941
# Create a DFG with no solver parameters (just to demonstrate the difference) using the CloudGraphs driver, and connect it to a local Neo4j instance.
40-
dfg = CloudGraphsDFG{NoSolverParams}("localhost", 7474, "neo4j", "test",
42+
cfg = CloudGraphsDFG{NoSolverParams}("localhost", 7474, "neo4j", "test",
4143
"testUser", "testRobot", "testSession")
4244
```
4345

@@ -60,7 +62,7 @@ In addition, the following optional parameters are provided:
6062

6163
Three variables are added:
6264

63-
```julia
65+
```@example buildingGraphs; continued = true
6466
v1 = addVariable!(dfg, :x0, ContinuousScalar, labels = [:POSE], solvable=1)
6567
v2 = addVariable!(dfg, :x1, ContinuousScalar, labels = [:POSE], solvable=1)
6668
v3 = addVariable!(dfg, :l0, ContinuousScalar, labels = [:LANDMARK], solvable=1)
@@ -79,7 +81,7 @@ Additionally, the solvable flag is also set to indicate that the factor can be u
7981

8082
Four factors are added: a prior, a linear conditional relationship with a normal distribution between x0 and x1, and a pair of linear conditional relationships between each pose and the landmark.
8183

82-
```julia
84+
```@example buildingGraphs; continued = true
8385
prior = addFactor!(dfg, [:x0], Prior(Normal(0,1)))
8486
f1 = addFactor!(dfg, [:x0; :x1], LinearConditional(Normal(50.0,2.0)), solvable=1)
8587
f1 = addFactor!(dfg, [:l0; :x0], LinearConditional(Normal(40.0,5.0)), solvable=1)
@@ -99,13 +101,19 @@ Reading, updating, and deleting all use DFG functions (as opposed to adding,
99101
where using the IncrementalInference functions are recommended).
100102

101103
Each variable and factor is uniquely identified by its label. The list of
102-
variable and factor labels can be retrieved with the `ls`/`listVariables` and
103-
`lsf`/`listFactors` functions:
104+
variable and factor labels can be retrieved with the [`ls`](@ref)/[`listVariables`](@ref) and
105+
[`lsf`](@ref)/[`listFactors`](@ref) functions:
106+
107+
For example listing the variables in the graph we created above:
108+
```@example buildingGraphs
109+
ls(dfg)
110+
```
111+
112+
Or listing the factors:
113+
```@example buildingGraphs
114+
lsf(dfg)
115+
```
104116

105-
- [`listVariables`](@ref)
106-
- [`ls`](@ref)
107-
- [`listFactors`](@ref)
108-
- [`lsf`](@ref)
109117

110118
To list all variables or factors (instead of just their labels), use the
111119
`getVariables` and `getFactors` functions:

0 commit comments

Comments
 (0)