53#ifndef TTK_ENABLE_KAMIKAZE
55 std::cerr <<
"[DynamicTree]: DynTree remove edge in root node"
67 std::vector<DynTreeNode> nodes_{};
73 inline void alloc(
const std::size_t nbNodes) {
74 nodes_.resize(nbNodes);
88 return node - &nodes_[0];
98 inline bool insertEdge(
const std::size_t n1,
const std::size_t n2) {
128 inline int removeEdge(
const std::size_t nid1,
const std::size_t nid2) {
136 for(
size_t nId = 0; nId < nodes_.size(); nId++) {
137 if(nodes_[nId].parent_ ==
nullptr)
138 nbccIds.emplace_back(nId);
142 return std::count_if(
143 nodes_.begin(), nodes_.end(),
144 [](
const DynTreeNode &dtn) { return dtn.parent_ == nullptr; });
149 std::string
print()
const;
Implements the Dynamic Tree data-structure (or ST-Tree)
void alloc(const std::size_t nbNodes)
bool insertEdge(DynTreeNode *const n1, DynTreeNode *const n2)
DynTreeNode * getNode(const std::size_t nid)
get the node with the id: nid
void removeEdge(const std::size_t nid)
remove the link btwn n and its parent
const DynTreeNode * getNode(const std::size_t nid) const
void removeEdge(DynTreeNode *const n)
remove the link btwn n and its parent
bool insertEdge(const std::size_t n1, const std::size_t n2)
inert or replace existing edge between n1 and n2
std::size_t getNodeId(DynTreeNode *node)
get the id of the node: node
std::size_t getCCFromNode(const std::size_t n0) const
std::string print() const
int removeEdge(const std::size_t nid1, const std::size_t nid2)
void retrieveNbCC(std::vector< size_t > &nbccIds) const
std::string printNbCC() const
int removeEdge(DynTreeNode *const n1, DynTreeNode *const n2)
class representing a node of a tree and the link to its parent if not the root
bool insertEdge(DynTreeNode *const n)
DynTreeNode * findRoot() const
Get representative node.
void evert()
Make this node the root of its tree.