3#include <Core/Containers/AlignedStdVector.hpp>
4#include <Core/Containers/VectorArray.hpp>
5#include <Core/RaCore.hpp>
26 enum class ConsistencyStatus {
28 IncompatibleChildrenAndParentList,
31 InconsistentParentIndex,
32 NonLeafNodeWithoutChild
54 uint addNode(
const uint parent );
73 inline uint size()
const;
81 ConsistencyStatus computeConsistencyStatus()
const;
83 inline bool isEmpty()
const {
return ( size() == 0 ); }
85 inline bool isRoot(
const uint i )
const;
87 inline bool isLeaf(
const uint i )
const;
89 inline bool isBranch(
const uint i )
const;
91 inline bool isJoint(
const uint i )
const;
93 inline bool isEdge(
const uint i,
const uint j )
const;
95 inline const Adjacency& children()
const {
return m_child; }
97 inline const ParentList& parents()
const {
return m_parent; }
113 CORE_ASSERT( m_parent.
size() == m_child.
size(),
"List size inconsistency" );
114 return m_parent.
size();
123 CORE_ASSERT( i <
size(),
" Index i out of bounds " );
124 return ( m_parent[i] == -1 );
128 CORE_ASSERT( i <
size(),
" Index i out of bounds " );
129 return ( m_child[i].
size() == 0 );
133 CORE_ASSERT( i <
size(),
" Index i out of bounds " );
134 return ( m_child[i].
size() > 1 );
138 CORE_ASSERT( i <
size(),
" Index i out of bounds " );
139 return ( m_child[i].
size() == 1 );
143 CORE_ASSERT( i <
size(),
" Index i out of bounds " );
144 CORE_ASSERT( j <
size(),
" Index j out of bounds " );
145 for (
const auto& item : m_child[i] ) {
146 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