A factor graph is considered connected if there is a path between every pair of nodes. For
example, for a factor graph containing four pose nodes, connected consecutively by three
factors, there are paths in the factor graph from one node in the graph to any other node
in the graph.
If the graph does not contain node 3, although there is still a path from node 1 to node 2,
there is no path from node 1 or node 2 to node 4.
A fully connected factor graph is important for optimization. If the factor graph is not fully
connected, then the optimization occurs separately for each of the disconnected graphs,
which may produce undesired results. The connectivity of graphs can become more complex
when you specify certain subsets of pose node IDs to optimize. This is because the
optimize
function optimizes parts of the factor graph by using the specified IDs to identify which
factors to use to create a partial factor graph. optimize
adds a
factor to the partial factor graph if that factor connects to any of the specified pose
nodes and does not connect to any unspecified pose nodes. The function also adds any
non-pose nodes that the added factors connect to, but does not add other factors connected
to those nodes. For example, for this factor graph there are three pose nodes, two
non-pose nodes, and the factors that connect the nodes.
If you specify nodes 1 and 2, then factors 1, 3, 4, and 5 form a factor graph for the
optimization because they connect to pose nodes 1 and 2. The optimization includes nodes 4
and 5 because they connect to factors that relate to the specified pose node IDs.
If you specify poseNodeIDs
as [1 3]
, then the
optimize
function optimizes each separated graph separately
because the formed factor graph does not contain a path between nodes 1 and 3.