51#include <lal/graphs/rooted_tree.hpp>
52#include <lal/graphs/free_tree.hpp>
53#include <lal/detail/type_traits/is_pointer_iterator.hpp>
54#include <lal/detail/pairs_utils.hpp>
71 std::enable_if_t< std::is_base_of_v<graphs::tree, tree_t>,
bool> =
true
78 uint64_t *
const sizes
84 if constexpr (std::is_base_of_v<graphs::rooted_tree, tree_t>) {
85 for (
const node w : t.get_out_neighbors(v)) {
86 if (w == u) {
continue; }
90 for (
const node w : t.get_in_neighbors(v)) {
91 if (w == u) {
continue; }
97 for (
const node w : t.get_neighbors(v)) {
98 if (w == u) {
continue; }
100 sizes[v] += sizes[w];
118 std::enable_if_t< std::is_base_of_v<graphs::tree, tree_t>,
bool> =
true
123 uint64_t *
const sizes
128 assert(sizes !=
nullptr);
161 std::is_base_of_v<graphs::tree, tree_t>
178 if constexpr (std::is_base_of_v<graphs::rooted_tree, tree_t>) {
179 for (
const node w : t.get_out_neighbors(v)) {
180 if (w == u) {
continue; }
183 for (
const node w : t.get_in_neighbors(v)) {
184 if (w == u) {
continue; }
189 for (
const node w : t.get_neighbors(v)) {
190 if (w == u) {
continue; }
195 *it++ = {
edge(u,v), s};
196 *it++ = {
edge(v,u), n - s};
237 std::is_base_of_v<graphs::tree, tree_t>
250 if constexpr (std::is_base_of_v<graphs::rooted_tree, tree_t>) {
251 for (
const node y : t.get_out_neighbors(x)) {
254 for (
const node y : t.get_in_neighbors(x)) {
259 for (
const node y : t.get_neighbors(x)) {
void get_size_subtrees(const tree_t &t, const node u, const node v, uint64_t *const sizes) noexcept
Calculate the size of every subtree of the tree t.
Definition size_subtrees.hpp:74
constexpr bool is_pointer_iterator_v
Shorthand for is_pointer_iterator.
Definition is_pointer_iterator.hpp:68
uint64_t calculate_bidirectional_sizes(const tree_t &t, const uint64_t n, const node u, const node v, iterator_t &it) noexcept
Calculates the values for the edges reachable from in the subtree .
Definition size_subtrees.hpp:168
Main namespace of the library.
Definition basic_types.hpp:48
std::pair< node, node > edge
See Edge page for further details.
Definition basic_types.hpp:56
uint64_t node
Node type. See Node / Vertex page for further details.
Definition basic_types.hpp:51