Added empty() to BayesTree
parent
5a9e2a42ec
commit
d1246bfe98
|
|
@ -162,6 +162,11 @@ namespace gtsam {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Check if there are any cliques in the tree */
|
||||||
|
inline bool empty() const {
|
||||||
|
return nodes_.empty();
|
||||||
|
}
|
||||||
|
|
||||||
/** return nodes */
|
/** return nodes */
|
||||||
const Nodes& nodes() const { return nodes_; }
|
const Nodes& nodes() const { return nodes_; }
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -93,6 +93,7 @@ TEST( BayesTree, constructor )
|
||||||
|
|
||||||
// Check Size
|
// Check Size
|
||||||
LONGS_EQUAL(4,bayesTree.size());
|
LONGS_EQUAL(4,bayesTree.size());
|
||||||
|
EXPECT(!bayesTree.empty());
|
||||||
|
|
||||||
// Check root
|
// Check root
|
||||||
boost::shared_ptr<IndexConditional> actual_root = bayesTree.root()->conditional();
|
boost::shared_ptr<IndexConditional> actual_root = bayesTree.root()->conditional();
|
||||||
|
|
@ -155,6 +156,7 @@ TEST( BayesTree, removePath )
|
||||||
E(new IndexConditional(_E_, _B_)),
|
E(new IndexConditional(_E_, _B_)),
|
||||||
F(new IndexConditional(_F_, _E_));
|
F(new IndexConditional(_F_, _E_));
|
||||||
SymbolicBayesTree bayesTree;
|
SymbolicBayesTree bayesTree;
|
||||||
|
EXPECT(bayesTree.empty());
|
||||||
// Ordering ord; ord += _A_,_B_,_C_,_D_,_E_,_F_;
|
// Ordering ord; ord += _A_,_B_,_C_,_D_,_E_,_F_;
|
||||||
SymbolicBayesTree::insert(bayesTree, A);
|
SymbolicBayesTree::insert(bayesTree, A);
|
||||||
SymbolicBayesTree::insert(bayesTree, B);
|
SymbolicBayesTree::insert(bayesTree, B);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue