DiscreteJunctionTree.cpp
Go to the documentation of this file.
1 /* ----------------------------------------------------------------------------
2 
3  * GTSAM Copyright 2010, Georgia Tech Research Corporation,
4  * Atlanta, Georgia 30332-0415
5  * All Rights Reserved
6  * Authors: Frank Dellaert, et al. (see THANKS for the full author list)
7 
8  * See LICENSE for the license information
9 
10  * -------------------------------------------------------------------------- */
11 
22 
23 namespace gtsam {
24 
25 // Instantiate base classes
26 template class EliminatableClusterTree<DiscreteBayesTree, DiscreteFactorGraph>;
27 template class JunctionTree<DiscreteBayesTree, DiscreteFactorGraph>;
28 
29 /* ************************************************************************* */
31  const DiscreteEliminationTree& eliminationTree)
32  : Base(eliminationTree) {}
33 /* ************************************************************************* */
34 
35 void DiscreteJunctionTree::print(const std::string& s,
36  const KeyFormatter& keyFormatter) const {
37  auto visitor = [&keyFormatter](
38  const std::shared_ptr<DiscreteJunctionTree::Cluster>& node,
39  const std::string& parentString) {
40  // Print the current node
41  node->print(parentString + "-", keyFormatter);
42  node->factors.print(parentString + "-", keyFormatter);
43  std::cout << std::endl;
44  return parentString + "| "; // Increment the indentation
45  };
46  std::string parentString = s;
47  treeTraversal::DepthFirstForest(*this, parentString, visitor);
48 }
49 
50 } // namespace gtsam
s
RealScalar s
Definition: level1_cplx_impl.h:126
gtsam::DiscreteEliminationTree
Elimination tree for discrete factors.
Definition: DiscreteEliminationTree.h:31
gtsam::KeyFormatter
std::function< std::string(Key)> KeyFormatter
Typedef for a function to format a key, i.e. to convert it to a string.
Definition: Key.h:35
DiscreteJunctionTree.h
gtsam::treeTraversal::DepthFirstForest
void DepthFirstForest(FOREST &forest, DATA &rootData, VISITOR_PRE &visitorPre, VISITOR_POST &visitorPost)
Definition: treeTraversal-inst.h:77
DiscreteEliminationTree.h
gtsam
traits
Definition: SFMdata.h:40
gtsam::JunctionTree< DiscreteBayesTree, DiscreteFactorGraph >
JunctionTree-inst.h
The junction tree, template bodies.
gtsam::DiscreteJunctionTree::print
void print(const std::string &name="DiscreteJunctionTree: ", const KeyFormatter &formatter=DefaultKeyFormatter) const
Definition: DiscreteJunctionTree.cpp:35
gtsam::DiscreteJunctionTree::DiscreteJunctionTree
DiscreteJunctionTree(const DiscreteEliminationTree &eliminationTree)
Definition: DiscreteJunctionTree.cpp:30


gtsam
Author(s):
autogenerated on Wed Mar 19 2025 03:01:36