LAL: Linear Arrangement Library 23.01.00
A library focused on algorithms on linear arrangements of graphs.
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | List of all members
lal::generate::rand_arrangements Class Reference

Random generation of arrangements of any graph. More...

#include <rand_arrangements.hpp>

Public Member Functions

 rand_arrangements (const lal::graphs::graph &g, uint64_t seed=0) noexcept
 Constructor with graph. More...
 
 rand_arrangements (uint64_t n, uint64_t seed=0) noexcept
 Constructor with number of vertices. More...
 
const linear_arrangementget_arrangement () noexcept
 Returns a linear arrangement constructed uniformly at random.
 
const linear_arrangementyield_arrangement () noexcept
 Returns a linear arrangement constructed uniformly at random.
 

Private Attributes

const uint64_t m_n
 Number of vertices.
 
std::mt19937 m_gen
 Random number generator.
 
linear_arrangement m_arr
 The arrangement generated by this class. More...
 

Detailed Description

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:

// given a tree T (or any other graph)
for (int i = 0; i < 100; ++i) {
const linear_arrangement arr = Gen.get_arrangement();
// ...
}
Random generation of arrangements of any graph.
Definition: rand_arrangements.hpp:83
Linear arrangement of vertices.
Definition: linear_arrangement.hpp:103

Equivalently,

// given a tree T (or any other graph)
for (int i = 0; i < 100; ++i) {
const linear_arrangement arr = Gen.yield_arrangement();
// ...
}

Constructor & Destructor Documentation

◆ rand_arrangements() [1/2]

lal::generate::rand_arrangements::rand_arrangements ( const lal::graphs::graph g,
uint64_t  seed = 0 
)
inlinenoexcept

Constructor with graph.

Parameters
gInput graph. Only its number of vertices is used.
seedSeed of the random number generator. When 0, a random seed is used.

◆ rand_arrangements() [2/2]

lal::generate::rand_arrangements::rand_arrangements ( uint64_t  n,
uint64_t  seed = 0 
)
inlinenoexcept

Constructor with number of vertices.

Parameters
nNumber of vertices of the arrangements.
seedSeed of the random number generator. When 0, a random seed is used.

Member Data Documentation

◆ m_arr

linear_arrangement lal::generate::rand_arrangements::m_arr
private

The arrangement generated by this class.

Actually, generated by the std::next_permutation algorithm.


The documentation for this class was generated from the following file: