7#ifndef NATTER_UTILS_TREE_HELPER_H_
8#define NATTER_UTILS_TREE_HELPER_H_
15#include "natter/minhcast_level_number.h"
17namespace natter::minhcast {
26constexpr bool childFromNode(LevelNumber own_node, LevelNumber initial_node) {
27 const auto [own_level, own_number, fanout] = own_node;
28 const auto [initial_level, initial_number, initial_fanout] = initial_node;
29 assert(fanout == initial_fanout);
30 uint32_t parent = own_number;
31 if (own_level <= initial_level)
return false;
32 for (uint32_t current_level = own_level; current_level > initial_level; current_level--) {
33 parent = parent / fanout;
34 if ((current_level - 1) == initial_level && parent == initial_number)
return true;
44std::set<LevelNumber> calculateRRT(LevelNumber node);
51std::set<LevelNumber> calculateLRT(LevelNumber node);
53std::string toLevelNumberPair(LevelNumber node);
54LevelNumber fromStringToLevelNumber(
const std::string &node);