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

Utilities for the various minimum linear arrangement algorithms. More...

Functions

template<bool make_arrangement>
uint64_t arrange (const std::vector< std::vector< node_size > > &L, const node r, const Dopt_utils::place r_place, position ini, position fin, linear_arrangement &arr) noexcept
 Make a minimum projective arrangement using the sorted, rooted adjacency list L.
 
template<bool make_arrangement>
uint64_t arrange_projective (const uint64_t n, const std::vector< std::vector< node_size > > &L, const node r, linear_arrangement &arr) noexcept
 Wrapper method for the recursive method arrange.
 
template<bool make_arrangement>
uint64_t embed_branch (const std::vector< std::vector< node_size > > &L, const node v, int64_t base, const int64_t dir, array< int64_t > &rel_pos) noexcept
 Embed a tree's branch.
 
template<bool make_arrangement>
uint64_t embed (const std::vector< std::vector< node_size > > &L, const node r, linear_arrangement &arr) noexcept
 Embed a tree's branch.
 

Detailed Description

Utilities for the various minimum linear arrangement algorithms.

Functions useful to calculate the minimum sum of edge lengths.

Function Documentation

◆ arrange()

template<bool make_arrangement>
uint64_t lal::detail::Dmin_utils::arrange ( const std::vector< std::vector< node_size > > & L,
const node r,
const Dopt_utils::place r_place,
position ini,
position fin,
linear_arrangement & arr )
nodiscardnoexcept

Make a minimum projective arrangement using the sorted, rooted adjacency list L.

The full details of this algorithm can be found in [6].

Template Parameters
make_arrangementWhether or not the arrangement is to be constructed.
Parameters
LAdjacency list-like data structure. \(L[u]\) is a list of pairs \((v, n_u(v))\) where \(v\) is a neighbour of \(u\) and \(n_u(v)=|V(T^u_v)|\) is the size of the subtree \(T^u_v\) in vertices.
rThe vertex root of the subtree whose interval is to be made
r_placeWhere, respect to its parent, node 'r' has been placed in the arrangement. Possible values: PLACE_LEFT_OF, PLACE_RIGHT_OF, PLACE_NONE_OF. The latter value is only valid for the root of the whole tree.
iniLeft limit of the positions of the arrangement in which the tree has to be arranged. Note that the limits are included [ini,fin].
finRight limit of the positions of the arrangement in which the tree has to be arranged. Note that the limits are included [ini,fin].
[out]arrthe arrangement of the tree
Returns
The sum of the length of the outgoing edges from vertex 'r' plus the length of the anchor of the edge from 'r' to its parent. Such length is defined as the number of vertices to the left of 'r' if 'r_place' is RIGHT_PLACE, or as the number of vertices to the right of 'r' if 'r_place' is LEFT_PLACE.
Precondition
L is sorted decreasingly.

◆ arrange_projective()

template<bool make_arrangement>
uint64_t lal::detail::Dmin_utils::arrange_projective ( const uint64_t n,
const std::vector< std::vector< node_size > > & L,
const node r,
linear_arrangement & arr )
inlinenodiscardnoexcept

Wrapper method for the recursive method arrange.

A call to this function is done when the goal is to construct a linear arrangement.

Template Parameters
make_arrangementShould the arrangement be constructed?
Parameters
nNumber of vertices.
LAdjacency list-like data structure. \(L[u]\) is a list of pairs \((v, n_u(v))\) where \(v\) is a neighbour of \(u\) and \(n_u(v)=|V(T^u_v)|\) is the size of the subtree \(T^u_v\) in vertices.
rRoot of the tree represented by L.
[out]arrMinimum projective linear arrangement.
Returns
The cost of a minimum projective linear arrangement.
Precondition
L is sorted decreasingly.

◆ embed()

template<bool make_arrangement>
uint64_t lal::detail::Dmin_utils::embed ( const std::vector< std::vector< node_size > > & L,
const node r,
linear_arrangement & arr )
nodiscardnoexcept

Embed a tree's branch.

Implementation of procedure 'embed' as defined by Hochberg and Stallmann in [30] and with the correction in [6].

Template Parameters
make_arrangementWhether or not the arrangement is to be constructed.
Parameters
LAdjacency list-like data structure. \(L[u]\) is a list of pairs \((v, n_u(v))\) where \(v\) is a neighbour of \(u\) and \(n_u(v)=|V(T^u_v)|\) is the size of the subtree \(T^u_v\) in vertices.
rThe vertex root used to construct L.
[out]arrThe optimal arrangement.
Returns
The cost of a minimum linear arrangement of the corresponding branch.
Precondition
L is sorted decreasingly.

◆ embed_branch()

template<bool make_arrangement>
uint64_t lal::detail::Dmin_utils::embed_branch ( const std::vector< std::vector< node_size > > & L,
const node v,
int64_t base,
const int64_t dir,
array< int64_t > & rel_pos )
nodiscardnoexcept

Embed a tree's branch.

Implementation of procedure 'embed' as defined by Hochberg and Stallmann in [30] and with the correction in [6].

Template Parameters
make_arrangementWhether or not the arrangement is to be constructed.
Parameters
LAdjacency list-like data structure. \(L[u]\) is a list of pairs \((v, n_u(v))\) where \(v\) is a neighbour of \(u\) and \(n_u(v)=|V(T^u_v)|\) is the size of the subtree \(T^u_v\) in vertices.
vThe current branch of the tree to be arranged.
baseThe displacement for the starting position of the subtree arrangement
dirWhether or not v is to the left or to the right of its parent
[out]rel_posthe displacement from the root of all nodes of the subtree
Returns
The cost of a minimum linear arrangement of the corresponding branch.
Precondition
L is sorted decreasingly.