LAL: Linear Arrangement Library 24.10.00
A library focused on algorithms on linear arrangements of graphs.
|
Exhaustive enumeration of projective arrangements of a rooted tree. More...
#include <all_projective_arrangements.hpp>
Public Member Functions | |
all_projective_arrangements (const graphs::rooted_tree &T) noexcept | |
Constructor with rooted tree. | |
all_projective_arrangements (const graphs::free_tree &T, const node root) noexcept | |
Constructor with free tree and a root vertex. | |
all_projective_arrangements (const all_projective_arrangements &Gen) noexcept=default | |
Default copy constructor. | |
all_projective_arrangements (all_projective_arrangements &&Gen) noexcept=default | |
Default move constructor. | |
~all_projective_arrangements () noexcept=default | |
Default destructor. | |
bool | end () const noexcept |
Returns whether there are more arrangements to generate. | |
linear_arrangement | get_arrangement () const noexcept |
Constructs the current arrangement. | |
void | next () noexcept |
Generates the next arrangement. | |
void | reset () noexcept |
Sets the generator to its initial state. | |
linear_arrangement | yield_arrangement () noexcept |
Returns the current arrangement and advances the generator. | |
Private Member Functions | |
void | initialize_intervals_tree () noexcept |
Initialize the interval every node of the tree, starting at r. | |
void | initialize_interval_node (const node u) noexcept |
Initialize the interval of node u. | |
Private Attributes | |
const graphs::rooted_tree & | m_rT |
Constant reference to rooted tree. | |
detail::array< detail::array< node > > | m_intervals |
The interval of every node of the tree. | |
bool | m_reached_end = false |
Has the end of the generation been reached? | |
Exhaustive enumeration of projective arrangements of a rooted tree.
This class does not take into account the symmetries between arrangements produced by swapping leaves of the tree connected to the same parent. That is, the arrangements produced can be seen as arrangements of labelled trees. Therefore, this class will generate \(n!\) arrangements for a star tree of \(n\) vertices.
See Types of arrangements for the definition of projective arrangements.
In order to use this class, you must first provide the tree object in the constructor. Arrangements are generated internally, i.e., they are encoded in the internal state of the generator. Said state is updated using method next(), which updates it to encode the next arrangement in the generation. In order to retrieve an arrangement, use method get_arrangement(). Upon initialisation, the generator encodes the first arrangement, which has to be retrieved using method get_arrangement().
This class implements the algorithm outlined in [25] and [24].
A possible usage of this class is the following:
Alternatively, this class can be used in a for loop:
This class also has method yield_arrangement() which is aimed at simplifying this class' usage:
|
noexcept |
Constructor with rooted tree.
T | Rooted tree |
|
inlinenoexcept |
Constructor with free tree and a root vertex.
T | Free tree |
root | Root vertex |
|
defaultnoexcept |
Default copy constructor.
Gen | Exhaustive projective arrangement generator. |
|
defaultnoexcept |
Default move constructor.
Gen | Exhaustive projective arrangement generator. |
|
inlinenodiscardnoexcept |
Returns whether there are more arrangements to generate.
|
nodiscardnoexcept |
|
noexcept |
Generates the next arrangement.
Modifies the internal state so that the next arrangement can be retrieved using method get_arrangement.
|
inlinenodiscardnoexcept |
Returns the current arrangement and advances the generator.