LAL: Linear Arrangement Library 21.07.01
A library focused on algorithms on linear arrangements of graphs.
Loading...
Searching...
No Matches
lal::generate::rand_planar_arrangements Class Reference

Uniformly random generation of planar arrangements of a labeled rooted tree. More...

#include <rand_planar_arrangements.hpp>

Public Member Functions

 rand_planar_arrangements (const graphs::free_tree &T, uint32_t seed=0) noexcept
 Constructor with a constant reference to a free tree.
 
 rand_planar_arrangements (const graphs::rooted_tree &T, uint32_t seed=0) noexcept
 Constructor with a constant reference to a rooted tree.
 
 rand_planar_arrangements (const rand_planar_arrangements &Gen)=default
 Default copy constructor.
 
 rand_planar_arrangements (rand_planar_arrangements &&Gen)=default
 Default move constructor.
 
 ~rand_planar_arrangements ()=default
 Default destructor.
 
linear_arrangement get_arrangement () noexcept
 Make a random planar arrangement of a rooted tree.
 
linear_arrangement yield_arrangement () noexcept
 Returns a random planar arrangement.
 

Private Attributes

graphs::free_tree m_T_copy
 A copy of a free tree.
 
const graphs::free_treem_T
 The free tree of which we are making planar arrangements uniformly at random.
 
std::vector< std::vector< node > > m_rdata
 The random data for all vertices.
 
std::mt19937 m_gen
 Random number generator.
 

Detailed Description

Uniformly random generation of planar arrangements of a labeled rooted tree.

A planar arrangement of a directed rooted tree is one in which the root is not covered by any of the tree's edges and there are no edge crossings.

An example of usage of this class is

// given a rooted tree T
lal::generate::rand_planar_arrgements Gen(T);
for (int i = 0; i < 100; ++i) {
const lal::linear_arrangement arr = Gen.get_arrangement();
// ...
}
std::vector< position > linear_arrangement
A linear arrangement of the nodes of a graph.
Definition definitions.hpp:72

Equivalently,

// given a rooted tree T
for (int i = 0; i < 100; ++i) {
const linear_arrangement arr = Gen.yield_arrangement();
// ...
}
Uniformly random generation of planar arrangements of a labeled rooted tree.
Definition rand_planar_arrangements.hpp:79

Constructor & Destructor Documentation

◆ rand_planar_arrangements() [1/4]

lal::generate::rand_planar_arrangements::rand_planar_arrangements ( const graphs::free_tree & T,
uint32_t seed = 0 )
noexcept

Constructor with a constant reference to a free tree.

Parameters
TInput free tree
seedThe seed used for the random generator. If the seed is 0 then a random seed is generated and used.
Precondition
The object t must be a tree (see lal::graphs::free_tree::is_tree).

◆ rand_planar_arrangements() [2/4]

lal::generate::rand_planar_arrangements::rand_planar_arrangements ( const graphs::rooted_tree & T,
uint32_t seed = 0 )
noexcept

Constructor with a constant reference to a rooted tree.

Parameters
TInput rooted tree.
seedThe seed used for the random generator. If the seed is 0 then a random seed is generated and used.
Precondition
The object t must be a tree (see lal::graphs::free_tree::is_tree).

◆ rand_planar_arrangements() [3/4]

lal::generate::rand_planar_arrangements::rand_planar_arrangements ( const rand_planar_arrangements & Gen)
default

Default copy constructor.

Parameters
GenRandom planar arrangement generator.

◆ rand_planar_arrangements() [4/4]

lal::generate::rand_planar_arrangements::rand_planar_arrangements ( rand_planar_arrangements && Gen)
default

Default move constructor.

Parameters
GenRandom planar arrangement generator.

Member Function Documentation

◆ get_arrangement()

linear_arrangement lal::generate::rand_planar_arrangements::get_arrangement ( )
noexcept

Make a random planar arrangement of a rooted tree.

Returns
A planar arrangement chosen uniformly at random chosen amongst all planar arrangements of t.

Member Data Documentation

◆ m_rdata

std::vector<std::vector<node> > lal::generate::rand_planar_arrangements::m_rdata
private

The random data for all vertices.

This is a member of the class to avoid its initialisation at every call to get_arrangement.

◆ m_T_copy

graphs::free_tree lal::generate::rand_planar_arrangements::m_T_copy
private

A copy of a free tree.

Used only when this class is constructed with a rooted tree.


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