LAL: Linear Arrangement Library 21.07.01
A library focused on algorithms on linear arrangements of graphs.
|
Random generation of arrangements of any graph. More...
#include <rand_arrangements.hpp>
Public Member Functions | |
rand_arrangements (const lal::graphs::graph &g, uint32_t seed=0) noexcept | |
Constructor with graph. | |
rand_arrangements (uint32_t n, uint32_t seed=0) noexcept | |
Constructor with number of vertices. | |
const linear_arrangement & | get_arrangement () noexcept |
Returns a linear arrangement constructed uniformly at random. | |
const linear_arrangement & | yield_arrangement () noexcept |
Returns a linear arrangement constructed uniformly at random. | |
Private Attributes | |
const uint32_t | m_n |
Number of vertices. | |
std::mt19937 | m_gen |
Random number generator. | |
linear_arrangement | m_arr |
The arrangement generated by this class. | |
Random generation of arrangements of any graph.
This class generates linear arrangements uniformly at random. Unlike other random generators (e.g., lal::generate::rand_projective_arrangements) The arrangements are not generatee
This class is a wrapper over the C++'s std::shuffle algorithm.
A possible usage of this class is the following:
Equivalently,
|
inlinenoexcept |
Constructor with graph.
g | Input graph. Only its number of vertices is used. |
seed | Seed of the random number generator. When 0, a random seed is used. |
|
inlinenoexcept |
Constructor with number of vertices.
n | Number of vertices of the arrangements. |
seed | Seed of the random number generator. When 0, a random seed is used. |
|
private |
The arrangement generated by this class.
Actually, generated by the std::next_permutation algorithm.