LAL: Linear Arrangement Library 24.10.00
A library focused on algorithms on linear arrangements of graphs.
Loading...
Searching...
No Matches
lal::detail::crossings::stack_based Namespace Reference

Namespace for the stack-based algorithm to calculate \(C\). More...

Typedefs

typedef std::pair< uint64_t, edgeindexed_edge
 Useful typedef.
 

Functions

template<class graph_t , class arrangement_t >
void fill_adjP_adjN (const graph_t &g, const arrangement_t &arr, std::vector< neighbourhood > &adjP, std::vector< std::vector< indexed_edge > > &adjN, uint64_t *const size_adjN_u) noexcept
 Auxiliary function to sort edges as a function of the arrangement.
 
template<bool decide_upper_bound, class graph_t , class arrangement_t >
uint64_t compute_C_stack_based (const graph_t &g, const arrangement_t &arr, uint64_t *const size_adjN_u, uint64_t upper_bound) noexcept
 Stack based computation of \(C\) for undirected graphs.
 

Detailed Description

Namespace for the stack-based algorithm to calculate \(C\).

See [9].

Function Documentation

◆ compute_C_stack_based()

template<bool decide_upper_bound, class graph_t , class arrangement_t >
uint64_t lal::detail::crossings::stack_based::compute_C_stack_based ( const graph_t & g,
const arrangement_t & arr,
uint64_t *const size_adjN_u,
uint64_t upper_bound )
nodiscardnoexcept

Stack based computation of \(C\) for undirected graphs.

When template parameter decide_upper_bound is false, the function returns the number of crossings.

Template Parameters
decide_upper_boundBoolean value to choose the nature of the return type.
graph_tType of graph.
arrangement_tType of arrangement.
Parameters
gInput graph.
arrInput arrangement.
size_adjN_uSee [9] for details.
upper_boundUpper bound on the number of crossings.
Returns
When decide_upper_bound is true, the return value is:
  • one unit larger than the upper bound passed as parameter if \(C>\) upper bound.
  • \(C\) if the number of crossings is less or equal than the upper bound.

◆ fill_adjP_adjN()

template<class graph_t , class arrangement_t >
void lal::detail::crossings::stack_based::fill_adjP_adjN ( const graph_t & g,
const arrangement_t & arr,
std::vector< neighbourhood > & adjP,
std::vector< std::vector< indexed_edge > > & adjN,
uint64_t *const size_adjN_u )
noexcept

Auxiliary function to sort edges as a function of the arrangement.

See [9] for details on the correctness and behaviour.

Template Parameters
graph_tType of graph.
arrangement_tType of arrangement.
Parameters
gInput graph.
arrInput arrangement.
adjPadjP[v] contains the list of vertices u that form edges (u,v) such that arr[u] < arr[v] sorted nondecreasingly by edge length.
adjNadjN[v] contains the list of vertices u that form edges (u,v) such that arr[v] < arr[u] sorted nonincreasingly by edge length.
size_adjN_uAuxiliary memory array of size n.