LAL: Linear Arrangement Library 24.10.00
A library focused on algorithms on linear arrangements of graphs.
Loading...
Searching...
No Matches
lal::detail::level_signature< t > Class Template Reference

A class that implements level signatures of an array. More...

#include <level_signature.hpp>

Public Member Functions

 level_signature () noexcept=default
 Default constructor.
 
 level_signature (const level_signature &) noexcept=default
 Default copy constructor.
 
 level_signature (level_signature &&) noexcept=default
 Default move constructor.
 
level_signatureoperator= (const level_signature &) noexcept=default
 Default copy assignment operator.
 
level_signatureoperator= (level_signature &&) noexcept=default
 Default move assignment operator.
 
 level_signature (const std::size_t n) noexcept
 Constructor with size.
 
void init (const std::size_t n) noexcept
 Initializes this level signature.
 
template<typename T >
int64_t operator[] (const T i) const noexcept
 Access position 'i'.
 
template<typename T >
int64_t & operator[] (const T i) noexcept
 Access position 'i'.
 
template<level_signature_type st = t>
bool operator== (const level_signature< st > &L) const noexcept
 Equality test.
 
template<level_signature_type st = t, std::enable_if_t< st==level_signature_type::per_vertex, bool > = true>
int64_t get_vertex_level (const node u) const noexcept
 Gets the level value of a vertex.
 
template<level_signature_type st = t, std::enable_if_t< st==level_signature_type::per_vertex, bool > = true>
void set_vertex_level (const node u, const int64_t l) noexcept
 Sets the level value of a vertex.
 
template<level_signature_type st = t, std::enable_if_t< st==level_signature_type::per_position, bool > = true>
int64_t get_position_level (const position p) const noexcept
 Gets the level value of a position.
 
template<level_signature_type st = t, std::enable_if_t< st==level_signature_type::per_position, bool > = true>
void set_position_level (const position p, const int64_t l) noexcept
 Sets the level value of a position.
 
void mirror () noexcept
 Mirrors this level signature.
 

Private Attributes

array< int64_t > m_data
 The signature of level values.
 

Detailed Description

template<level_signature_type t>
class lal::detail::level_signature< t >

A class that implements level signatures of an array.

This class is just an array of signed integer values, each corresponding to a level value.

In case the template parameter t is equal to lal::detail::level_signature_type::per_vertex, the level values are defined per vertex, that is, level values have to be accessed using a vertex 'u' via the operator [], L[u].

In case the template parameter t is equal to lal::detail::level_signature_type::per_position, the level values are defined per position, that is, level values have to be accessed using a position 'p' via the operator [], L[p].

Constructor & Destructor Documentation

◆ level_signature()

template<level_signature_type t>
lal::detail::level_signature< t >::level_signature ( const std::size_t n)
inlinenoexcept

Constructor with size.

All level values are initialized at 0.

Member Function Documentation

◆ get_position_level()

template<level_signature_type t>
template<level_signature_type st = t, std::enable_if_t< st==level_signature_type::per_position, bool > = true>
int64_t lal::detail::level_signature< t >::get_position_level ( const position p) const
inlinenodiscardnoexcept

Gets the level value of a position.

Only usable when the type of this level signature is lal::detail::level_signature_type::per_position.

Parameters
pInput position.
Returns
The level value of the input position.

◆ get_vertex_level()

template<level_signature_type t>
template<level_signature_type st = t, std::enable_if_t< st==level_signature_type::per_vertex, bool > = true>
int64_t lal::detail::level_signature< t >::get_vertex_level ( const node u) const
inlinenodiscardnoexcept

Gets the level value of a vertex.

Only usable when the type of this level signature is lal::detail::level_signature_type::per_vertex.

Parameters
uInput vertex.
Returns
The level value of the input vertex.

◆ mirror()

template<level_signature_type t>
void lal::detail::level_signature< t >::mirror ( )
inlinenoexcept

Mirrors this level signature.

The operation is equivalent to recalculating the level signature for the mirrored arrangement.

◆ operator==()

template<level_signature_type t>
template<level_signature_type st = t>
bool lal::detail::level_signature< t >::operator== ( const level_signature< st > & L) const
inlinenodiscardnoexcept

Equality test.

Two level signatures of two arrangements of the same tree are equal if their values are equal position-wise, regardless of the type of level signature.

Parameters
LOther level signature.
Returns
Whether this and L are equal or not.
Precondition
Both level signatures must be of arrangements of the same tree.

◆ set_position_level()

template<level_signature_type t>
template<level_signature_type st = t, std::enable_if_t< st==level_signature_type::per_position, bool > = true>
void lal::detail::level_signature< t >::set_position_level ( const position p,
const int64_t l )
inlinenoexcept

Sets the level value of a position.

Only usable when the type of this level signature is lal::detail::level_signature_type::per_position.

Parameters
pInput position.
lLevel value.

◆ set_vertex_level()

template<level_signature_type t>
template<level_signature_type st = t, std::enable_if_t< st==level_signature_type::per_vertex, bool > = true>
void lal::detail::level_signature< t >::set_vertex_level ( const node u,
const int64_t l )
inlinenoexcept

Sets the level value of a vertex.

Only usable when the type of this level signature is lal::detail::level_signature_type::per_vertex.

Parameters
uInput vertex.
lLevel value.

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