48#include <lal/graphs/rooted_tree.hpp>
49#include <lal/generate/tree_generator.hpp>
50#include <lal/numeric/integer.hpp>
51#include <lal/internal/data_array.hpp>
131 std::uniform_real_distribution<
double>
m_unif;
138 std::vector<numeric::integer>
m_rn;
161 virtual
void init(uint32_t seed = 0) noexcept;
174 std::pair<uint32_t,uint32_t>
175 ranrut(uint32_t n, uint32_t lr, uint32_t nt) noexcept;
185 const numeric::integer&
get_rn(uint32_t n) noexcept;
252 inline graphs::rooted_tree yield_tree() noexcept {
Uniformly random generation of unlabelled rooted trees.
Definition rand_ulab_rooted_trees.hpp:67
void init_rn() noexcept
Initialiases m_rn with 31 values from the OEIS (see OEIS_A000081).
const uint32_t m_n
Number of nodes of the tree.
Definition rand_ulab_rooted_trees.hpp:126
virtual ~_rand_ulab_rooted_trees()=default
Destructor.
std::vector< numeric::integer > m_rn
The number of unlabelled rooted trees.
Definition rand_ulab_rooted_trees.hpp:138
std::pair< uint32_t, uint32_t > ranrut(uint32_t n, uint32_t lr, uint32_t nt) noexcept
Generates uniformly at random a rooted unlabelled tree of n nodes.
std::pair< uint32_t, uint32_t > choose_jd_from_T(uint32_t n) noexcept
Chooses uniformly at random a pair , according to some probability.
virtual void init(uint32_t seed=0) noexcept
Sets the size of the unlabelled trees to generate.
_rand_ulab_rooted_trees(_rand_ulab_rooted_trees &&Gen)=default
Move constructor.
_rand_ulab_rooted_trees(uint32_t n, uint32_t seed=0) noexcept
Constructor with size of tree and seed for the random number generator.
std::mt19937 m_gen
Random number generator.
Definition rand_ulab_rooted_trees.hpp:129
graphs::rooted_tree get_tree() noexcept
Generates uniformly at random a free unlabelled tree.
std::uniform_real_distribution< double > m_unif
Distribution of the numbers.
Definition rand_ulab_rooted_trees.hpp:131
internal::data_array< uint32_t > m_head_vector
The head vector of the tree under construction.
Definition rand_ulab_rooted_trees.hpp:149
void clear() noexcept
Clears the memory occupied.
const numeric::integer & get_rn(uint32_t n) noexcept
Computes all the values for .
Base class for tree generators.
Definition tree_generator.hpp:87
Uniformly random generation of unlabelled rooted trees.
Definition rand_ulab_rooted_trees.hpp:224
rand_ulab_rooted_trees(rand_ulab_rooted_trees &&Gen)=default
Move constructor.
~rand_ulab_rooted_trees() noexcept=default
Default destructor.
rand_ulab_rooted_trees(const rand_ulab_rooted_trees &Gen)=default
Copy constructor.
graphs::rooted_tree __get_tree() noexcept
Returns an unlabelled rooted tree chosen uniformly at random.
Definition rand_ulab_rooted_trees.hpp:263
_rand_ulab_rooted_trees m_Gen
See _rand_ulab_rooted_trees for details.
Definition rand_ulab_rooted_trees.hpp:267
rand_ulab_rooted_trees(uint32_t n, uint32_t seed=0) noexcept
Constructor with size of tree and seed for the random number generator.
Definition rand_ulab_rooted_trees.hpp:235
Rooted tree graph class.
Definition rooted_tree.hpp:107
Main namespace of the library.
Definition definitions.hpp:48