-f1 = addFactor!(dfg, [:l0; :x1], LinearRelative(Normal(-10.0,5.0)), solvable=1)</code></pre><p>The produced factor graph is:</p><p><img src="../imgs/initialgraph.jpg" alt="imgs/initialgraph.jpg"/></p><p>(For more information on producing plots of the graph, please refer to the <a href="../DrawingGraphs/">Drawing Graphs</a> section).</p><h2 id="Listing-Variables-and-Factors"><a class="docs-heading-anchor" href="#Listing-Variables-and-Factors">Listing Variables and Factors</a><a id="Listing-Variables-and-Factors-1"></a><a class="docs-heading-anchor-permalink" href="#Listing-Variables-and-Factors" title="Permalink"></a></h2><p>Reading, updating, and deleting all use DFG functions (as opposed to adding, where using the IncrementalInference functions are recommended).</p><p>Each variable and factor is uniquely identified by its label. The list of variable and factor labels can be retrieved with the <a href="../services_ref/#DistributedFactorGraphs.ls-Union{Tuple{G}, Tuple{G, Union{Nothing, Regex}}} where G<:AbstractDFG"><code>ls</code></a>/<a href="../services_ref/#DistributedFactorGraphs.listVariables"><code>listVariables</code></a> and <a href="../services_ref/#DistributedFactorGraphs.lsf-Union{Tuple{G}, Tuple{G, Union{Nothing, Regex}}} where G<:AbstractDFG"><code>lsf</code></a>/<a href="../services_ref/#DistributedFactorGraphs.listFactors"><code>listFactors</code></a> functions:</p><p>For example listing the variables in the graph we created above:</p><pre><code class="language-julia hljs">ls(dfg)</code></pre><p>Or listing the factors:</p><pre><code class="language-julia hljs">lsf(dfg)</code></pre><p>To list all variables or factors (instead of just their labels), use the <code>getVariables</code> and <code>getFactors</code> functions:</p><ul><li><a href="../services_ref/#DistributedFactorGraphs.getVariables-Union{Tuple{G}, Tuple{G, Union{Nothing, Regex}}} where G<:AbstractDFG"><code>getVariables</code></a></li><li><a href="../services_ref/#DistributedFactorGraphs.getFactors-Union{Tuple{G}, Tuple{G, Union{Nothing, Regex}}} where G<:AbstractDFG"><code>getFactors</code></a></li></ul><p>Traversing and Querying functions for finding the relationships and building subtraphs include: </p><ul><li><a href="../services_ref/#DistributedFactorGraphs.listNeighbors-Tuple{AbstractDFG, Symbol}"><code>listNeighbors</code></a></li><li><a href="../services_ref/#DistributedFactorGraphs.buildSubgraph-Union{Tuple{G}, Tuple{Type{G}, AbstractDFG, Vector{Symbol}}, Tuple{Type{G}, AbstractDFG, Vector{Symbol}, Int64}} where G<:AbstractDFG"><code>buildSubgraph</code></a></li><li><a href="../services_ref/#DistributedFactorGraphs.getBiadjacencyMatrix-Tuple{AbstractDFG}"><code>getBiadjacencyMatrix</code></a></li></ul><h2 id="Getting-(Reading)-Variables-and-Factors"><a class="docs-heading-anchor" href="#Getting-(Reading)-Variables-and-Factors">Getting (Reading) Variables and Factors</a><a id="Getting-(Reading)-Variables-and-Factors-1"></a><a class="docs-heading-anchor-permalink" href="#Getting-(Reading)-Variables-and-Factors" title="Permalink"></a></h2><p>Individual variables and factors can be retrieved from their labels using the following functions:</p><ul><li><a href="../services_ref/#DistributedFactorGraphs.getVariable-Tuple{AbstractDFG, Symbol, Symbol}"><code>getVariable</code></a></li><li><a href="../services_ref/#DistributedFactorGraphs.getFactor-Tuple{AbstractDFG, Symbol}"><code>getFactor</code></a></li></ul><p>It is worth noting that <code>getVariable</code> allows a user to retrieve only a single solver entry, so that subsets of the solver data can be retrieved individually (say, in the case that there are many solutions). These can then be updated independently using the functions as discussed in the update section below.</p><h2 id="Updating-Variables-and-Factors"><a class="docs-heading-anchor" href="#Updating-Variables-and-Factors">Updating Variables and Factors</a><a id="Updating-Variables-and-Factors-1"></a><a class="docs-heading-anchor-permalink" href="#Updating-Variables-and-Factors" title="Permalink"></a></h2><p>Full variables and factors can be updated using the following functions:</p><ul><li><a href="../services_ref/#DistributedFactorGraphs.mergeVariable!-Tuple{AbstractDFG, AbstractDFGVariable}"><code>mergeVariable!</code></a></li><li><a href="../services_ref/#DistributedFactorGraphs.mergeFactor!-Tuple{AbstractDFG, AbstractDFGFactor}"><code>mergeFactor!</code></a></li></ul><p><strong>NOTE</strong>: Skeleton and summary variables are read-only. To perform updates you should use the full factors and variables.</p><p><strong>NOTE</strong>: <code>updateVariable</code>/<code>updateFactor</code> performs a complete update of the respective node. It's not a very efficient way to edit fine-grain detail. There are other methods to perform smaller in-place changes. This is discussed in more detail in <a href="../DataStructure/">Data Structure</a>.</p><h2 id="Deleting-Variables-and-Factors"><a class="docs-heading-anchor" href="#Deleting-Variables-and-Factors">Deleting Variables and Factors</a><a id="Deleting-Variables-and-Factors-1"></a><a class="docs-heading-anchor-permalink" href="#Deleting-Variables-and-Factors" title="Permalink"></a></h2><p>Variables and factors can be deleted using the following functions:</p><ul><li><a href="../services_ref/#DistributedFactorGraphs.deleteVariable!-Tuple{AbstractDFG, AbstractDFGVariable}"><code>deleteVariable!</code></a></li><li><a href="../services_ref/#DistributedFactorGraphs.deleteFactor!-Tuple{AbstractDFG, Symbol}"><code>deleteFactor!</code></a></li></ul></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="../DataStructure/">« DFG Data Structures</a><a class="docs-footer-nextpage" href="../GraphData/">Using Graph Elements »</a><div class="flexbox-break"></div><p class="footer-message">Powered by <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> and the <a href="https://julialang.org/">Julia Programming Language</a>.</p></nav></div><div class="modal" id="documenter-settings"><div class="modal-background"></div><div class="modal-card"><header class="modal-card-head"><p class="modal-card-title">Settings</p><button class="delete"></button></header><section class="modal-card-body"><p><label class="label">Theme</label><div class="select"><select id="documenter-themepicker"><option value="auto">Automatic (OS)</option><option value="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option><option value="catppuccin-latte">catppuccin-latte</option><option value="catppuccin-frappe">catppuccin-frappe</option><option value="catppuccin-macchiato">catppuccin-macchiato</option><option value="catppuccin-mocha">catppuccin-mocha</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 1.13.0 on <span class="colophon-date" title="Sunday 29 June 2025 20:15">Sunday 29 June 2025</span>. Using Julia version 1.10.9.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html>
0 commit comments