48#include <lal/basic_types.hpp>
49#include <lal/graphs/free_tree.hpp>
50#include <lal/generate/tree_generator.hpp>
51#include <lal/detail/array.hpp>
115 void init(
const uint64_t n,
const uint64_t seed = 0) noexcept {
120 std::random_device rd;
121 m_gen = std::mt19937(rd());
124 m_gen = std::mt19937(seed);
126 m_unif = std::uniform_int_distribution<uint64_t>(0,
m_n - 1);
149 std::uniform_int_distribution<uint64_t>
m_unif;
221 void init(
const uint64_t n,
const uint64_t seed = 0) noexcept {
244 {
return m_Gen.get_tree(); }
Uniformly random selection of labelled free trees.
Definition rand_lab_free_trees.hpp:68
_rand_lab_free_trees(_rand_lab_free_trees &&Gen) noexcept=default
Move constructor.
_rand_lab_free_trees() noexcept
Default constructor.
Definition rand_lab_free_trees.hpp:73
_rand_lab_free_trees(const _rand_lab_free_trees &Gen) noexcept=default
Copy constructor.
_rand_lab_free_trees(const uint64_t n, const uint64_t seed=0) noexcept
Constructor with size of tree and seed for the random number generator.
Definition rand_lab_free_trees.hpp:83
void init(const uint64_t n, const uint64_t seed=0) noexcept
Initializes the generator with the number of nodes and a seed.
Definition rand_lab_free_trees.hpp:115
graphs::free_tree get_tree() noexcept
Returns a labelled free tree chosen uniformly at random.
void clear() noexcept
Clears the memory used.
Definition rand_lab_free_trees.hpp:133
_rand_lab_free_trees & operator=(const _rand_lab_free_trees &g) noexcept=default
Copy assignment operator.
std::uniform_int_distribution< uint64_t > m_unif
Distribution of the numbers.
Definition rand_lab_free_trees.hpp:149
~_rand_lab_free_trees()=default
Default destructor.
uint64_t m_n
Number of nodes of the tree.
Definition rand_lab_free_trees.hpp:144
std::mt19937 m_gen
Random number generator.
Definition rand_lab_free_trees.hpp:147
detail::array< uint64_t > m_Prufer_seq
Prüfer sequence.
Definition rand_lab_free_trees.hpp:151
Base class for tree generators.
Definition tree_generator.hpp:123
void clear() noexcept
Clears the memory used by the generator.
Definition tree_generator.hpp:166
void init(const uint64_t n) noexcept
Initializes the tree generator.
Definition tree_generator.hpp:160
Uniformly random selection of labelled free trees.
Definition rand_lab_free_trees.hpp:178
void clear() noexcept
Clear the memory used by the generator.
Definition rand_lab_free_trees.hpp:227
rand_lab_free_trees(const rand_lab_free_trees &Gen)=default
Copy constructor.
_rand_lab_free_trees m_Gen
See _rand_lab_free_trees.
Definition rand_lab_free_trees.hpp:248
graphs::free_tree yield_tree() noexcept
Yields a tree, advancing the generator if necessary.
Definition rand_lab_free_trees.hpp:232
rand_lab_free_trees(rand_lab_free_trees &&Gen)=default
Move constructor.
graphs::free_tree __get_tree() noexcept
Returns a labelled free tree chosen uniformly at random.
Definition rand_lab_free_trees.hpp:243
rand_lab_free_trees(const uint64_t n, const uint64_t seed=0) noexcept
Constructor with size of tree and seed for the random number generator.
Definition rand_lab_free_trees.hpp:193
rand_lab_free_trees() noexcept
Empty constructor.
Definition rand_lab_free_trees.hpp:183
void init(const uint64_t n, const uint64_t seed=0) noexcept
Initializes the generator with the number of nodes and a seed.
Definition rand_lab_free_trees.hpp:221
~rand_lab_free_trees()=default
Default destructor.
Free tree graph class.
Definition free_tree.hpp:60
Main namespace of the library.
Definition basic_types.hpp:48
void resize(const std::size_t new_size) noexcept
Resize the array.
Definition array.hpp:187
void clear() noexcept
Clear the contents of the array.
Definition array.hpp:174