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

Namespace for the dynamic programming algorithm to calculate \(C\). More...

Functions

template<bool decide_upper_bound, class graph_t , class arrangement_t >
uint64_t compute (const graph_t &g, const arrangement_t &arr, unsigned char *const __restrict__ bn, uint64_t *const __restrict__ M, uint64_t *const __restrict__ K, const uint64_t upper_bound) noexcept
 Dynamic programming computation of \(C\) for undirected graphs.
 

Detailed Description

Namespace for the dynamic programming algorithm to calculate \(C\).

See [9].

Function Documentation

◆ compute()

template<bool decide_upper_bound, class graph_t , class arrangement_t >
uint64_t lal::detail::crossings::dyn_prog::compute ( const graph_t & g,
const arrangement_t & arr,
unsigned char *const __restrict__ bn,
uint64_t *const __restrict__ M,
uint64_t *const __restrict__ K,
const uint64_t upper_bound )
nodiscardnoexcept

Dynamic programming 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.
arrangement_tType of arrangement.
Parameters
gInput graph.
arrInput arrangement.
bnArray of size n. Boolean neighbourhood of a vertex u: bn[i] is 1 if vertex u and vertex i are adjacent.
MSee [9] for details. Also, see the end of the corresponding file.
KSee [9] for details. Also, see the end of the corresponding file.
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.