LAL: Linear Arrangement Library 23.01.00
A library focused on algorithms on linear arrangements of graphs.
|
Uniformly random generation of labelled rooted trees. More...
#include <rand_lab_rooted_trees.hpp>
Public Member Functions | |
_rand_lab_rooted_trees () noexcept | |
Empty constructor. | |
_rand_lab_rooted_trees (uint64_t n, uint64_t seed=0) noexcept | |
Constructor with size of tree and seed for the random number generator. More... | |
_rand_lab_rooted_trees (const _rand_lab_rooted_trees &Gen)=default | |
Copy constructor. More... | |
_rand_lab_rooted_trees (_rand_lab_rooted_trees &&Gen)=default | |
Move constructor. More... | |
~_rand_lab_rooted_trees ()=default | |
Default destructor. | |
_rand_lab_rooted_trees & | operator= (const _rand_lab_rooted_trees &g) noexcept=default |
Copy assignment operator. | |
_rand_lab_rooted_trees & | operator= (_rand_lab_rooted_trees &&g) noexcept=default |
Move assignment operator. | |
void | init (uint64_t n, uint64_t seed=0) noexcept |
Initializes the generator with the number of nodes and a seed. More... | |
graphs::rooted_tree | get_tree () noexcept |
Generates uniformly at random a labelled rooted tree. More... | |
void | clear () noexcept |
Clears the memory used. More... | |
Protected Attributes | |
uint64_t | m_n |
Number of nodes of the tree. | |
std::mt19937 | m_gen |
Random number generator. | |
std::uniform_int_distribution< uint64_t > | m_unif |
Distribution of the numbers. | |
detail::data_array< uint64_t > | m_Prufer_seq |
Prüfer sequence. | |
Uniformly random generation of labelled rooted trees.
Users should refrain from using this class. The generation of random labelled trees should be done using the wrapper class rand_lab_rooted_trees. This class, however, contains the actual code to generate labelled rooted trees uniformly at random.
These trees are generated by first generating uniformly at random a free labelled tree. Then, a node of the generated tree is chosen uniformly at random. This node plays the role of the root of the rooted labelled tree. The edges are oriented away from the root.
|
inlinenoexcept |
Constructor with size of tree and seed for the random number generator.
In case the seed given is '0', a random seed will be generated.
n | Number of nodes. |
seed | The seed used for the random generator. |
|
default |
Copy constructor.
Gen | Random labelled rooted tree generator. |
|
default |
Move constructor.
Gen | Random labelled rooted tree generator. |
|
inlinenoexceptinherited |
|
inlinenoexcept |
Generates uniformly at random a labelled rooted tree.
|
inlinenoexcept |
Initializes the generator with the number of nodes and a seed.
n | Number of nodes. |
seed | The seed used for the random generator. If the seed is 0 then a random seed is generated and used. |