3#include <Core/Containers/AlignedStdVector.hpp>
4#include <Core/Containers/VectorArray.hpp>
23 enum class ConsistencyStatus {
25 IncompatibleChildrenAndParentList,
28 InconsistentParentIndex,
29 NonLeafNodeWithoutChild
51 uint addNode(
const uint parent );
70 inline uint size()
const;
78 ConsistencyStatus computeConsistencyStatus()
const;
80 inline bool isEmpty()
const {
return ( size() == 0 ); }
82 inline bool isRoot(
const uint i )
const;
84 inline bool isLeaf(
const uint i )
const;
86 inline bool isBranch(
const uint i )
const;
88 inline bool isJoint(
const uint i )
const;
90 inline bool isEdge(
const uint i,
const uint j )
const;
92 inline const Adjacency& children()
const {
return m_child; }
94 inline const ParentList& parents()
const {
return m_parent; }
110 CORE_ASSERT( m_parent.
size() == m_child.
size(),
"List size inconsistency" );
111 return m_parent.
size();
120 CORE_ASSERT( i <
size(),
" Index i out of bounds " );
121 return ( m_parent[i] == -1 );
125 CORE_ASSERT( i <
size(),
" Index i out of bounds " );
126 return ( m_child[i].
size() == 0 );
130 CORE_ASSERT( i <
size(),
" Index i out of bounds " );
131 return ( m_child[i].
size() > 1 );
135 CORE_ASSERT( i <
size(),
" Index i out of bounds " );
136 return ( m_child[i].
size() == 1 );
140 CORE_ASSERT( i <
size(),
" Index i out of bounds " );
141 CORE_ASSERT( j <
size(),
" Index j out of bounds " );
142 for (
const auto& item : m_child[i] ) {
143 if ( item == j )
return true;
void clear()
Clear the vectors.
uint size() const
Return the number of nodes in the graph.
bool isJoint(const uint i) const
Return true if the node is a joint node. ( |child| == 1 )
bool isLeaf(const uint i) const
Return true if the node is a leaf node.
bool isBranch(const uint i) const
Return true if the node is a branch node. ( |child| > 1 )
bool isRoot(const uint i) const
Return true if a node is a root node.
bool isEmpty() const
Return true if the graph is empty.
bool isEdge(const uint i, const uint j) const
Return true if the edge { i, j } exists.
This class implements ContainerIntrospectionInterface for AlignedStdVector.
std::vector< T, Eigen::aligned_allocator< T > > AlignedStdVector
hepler function to manage enum as underlying types in VariableSet