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
74(
const tree_t& t,
const node u,
const node v, uint64_t *
const sizes)
79 if constexpr (std::is_base_of_v<graphs::rooted_tree, tree_t>) {
80 for (
const node w : t.get_out_neighbours(v)) {
81 if (w == u) {
continue; }
85 for (
const node w : t.get_in_neighbours(v)) {
86 if (w == u) {
continue; }
92 for (
const node w : t.get_neighbours(v)) {
93 if (w == u) {
continue; }
113 std::enable_if_t< std::is_base_of_v<graphs::tree, tree_t>,
bool> =
true
119 assert(sizes !=
nullptr);
152 std::is_base_of_v<graphs::tree, tree_t>
153 and is_pointer_iterator_v<edge_size, iterator_t>,
158(
const tree_t& t,
const uint64_t n,
const node u,
const node v, iterator_t& it)
162 if constexpr (std::is_base_of_v<graphs::rooted_tree, tree_t>) {
163 for (
const node w : t.get_out_neighbours(v)) {
164 if (w == u) {
continue; }
167 for (
const node w : t.get_in_neighbours(v)) {
168 if (w == u) {
continue; }
173 for (
const node w : t.get_neighbours(v)) {
174 if (w == u) {
continue; }
179 *it++ = {
edge(u,v), s};
180 *it++ = {
edge(v,u), n - s};
221 std::is_base_of_v<graphs::tree, tree_t>
222 and is_pointer_iterator_v<edge_size, iterator_t>,
227(
const tree_t& t,
const uint64_t n,
const node x, iterator_t it)
230 if constexpr (std::is_base_of_v<graphs::rooted_tree, tree_t>) {
231 for (
const node y : t.get_out_neighbours(x)) {
234 for (
const node y : t.get_in_neighbours(x)) {
239 for (
const node y : t.get_neighbours(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
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:158
Main namespace of the library.
Definition: basic_types.hpp:50
std::pair< node, node > edge
See Edge page for further details.
Definition: basic_types.hpp:58
uint64_t node
Node type. See Node / Vertex page for further details.
Definition: basic_types.hpp:53