57#include <lal/linear_arrangement.hpp>
58#include <lal/graphs/rooted_tree.hpp>
59#include <lal/detail/data_array.hpp>
60#include <lal/iterators/E_iterator.hpp>
61#include <lal/detail/graphs/size_subtrees.hpp>
62#include <lal/detail/sorting/counting_sort.hpp>
63#include <lal/detail/properties/tree_centroid.hpp>
64#include <lal/detail/macros/basic_convert.hpp>
65#include <lal/detail/linarr/Dopt_utils.hpp>
73using namespace Dopt_utils;
105template <place r_place,
bool make_arrangement>
108 const std::vector<std::vector<node_size>>& L,
119 if constexpr (make_arrangement) {
120 if constexpr (r_place == PLACE_LEFT_OF) {
133 const auto& children = L[r];
136 uint64_t acc_size = 0;
145 position next_ini = 0, next_fin = 0;
147 constexpr place next_place =
148 (r_place == PLACE_LEFT_OF ? PLACE_RIGHT_OF : PLACE_LEFT_OF);
152 for (
const auto& [vi, ni] : children) {
154 if constexpr (make_arrangement) {
155 if constexpr (r_place == PLACE_LEFT_OF) {
156 next_ini = ini + acc_size + 1;
157 next_fin = next_ini + ni - 1;
164 next_fin = fin - acc_size - 1;
165 next_ini = next_fin - ni + 1;
170 D += arrange<next_place, make_arrangement>(L, vi, next_ini, next_fin, arr);
176 if constexpr (r_place != PLACE_NONE_OF) {
198 uint64_t n,
const std::vector<std::vector<node_size>>& L,
203 return arrange<PLACE_NONE_OF, true>(L, r, 0, n-1, arr);
220(uint64_t n,
const std::vector<std::vector<node_size>>& L,
node r)
224 return arrange<PLACE_NONE_OF, false>(L, r, 0, n-1, arr);
Linear arrangement of vertices.
Definition: linear_arrangement.hpp:103
uint64_t arrange_projective(uint64_t n, const std::vector< std::vector< node_size > > &L, node r, linear_arrangement &arr) noexcept
Wrapper method for the recursive method arrange.
Definition: DMax_utils.hpp:197
uint64_t arrange(const std::vector< std::vector< node_size > > &L, const node r, position ini, position fin, linear_arrangement &arr) noexcept
Make a maximum projective arrangement using the sorted, rooted adjacency list L.
Definition: DMax_utils.hpp:107
unsigned char place
Useful typedef to denote relative position.
Definition: Dopt_utils.hpp:72
Main namespace of the library.
Definition: basic_types.hpp:50
uint64_t position
Node's position type.
Definition: basic_types.hpp:55
uint64_t node
Node type. See Node / Vertex page for further details.
Definition: basic_types.hpp:53