LAL: Linear Arrangement Library 21.07.01
A library focused on algorithms on linear arrangements of graphs.
|
Namespace for all linear-arrangement-independent algorithms. More...
Functions | |
numeric::rational | exp_num_crossings_rational (const graphs::undirected_graph &g) noexcept |
Computes the the expected number of crossings in unconstrained arrangements, \(\mathbb{E}[C]\). | |
double | exp_num_crossings (const graphs::undirected_graph &g) noexcept |
Computes the the expected number of crossings in unconstrained arrangements, \(\mathbb{E}[C]\). | |
numeric::rational | var_num_crossings_rational (const graphs::undirected_graph &g, bool reuse=true) noexcept |
Computes the variance of the number of crossings of a graph in unconstrained arrangements, \(\mathbb{V}[C]\). | |
double | var_num_crossings (const graphs::undirected_graph &g, bool reuse=true) noexcept |
Computes the variance of the number of crossings of a graph in unconstrained arrangements, \(\mathbb{V}[C]\). | |
numeric::rational | var_num_crossings_forest_rational (const graphs::undirected_graph &g) noexcept |
Computes the variance of the number of crossings of a forest in unconstrained arrangements, \(\mathbb{V}[C]\). | |
double | var_num_crossings_forest (const graphs::undirected_graph &g) noexcept |
Computes the variance of the number of crossings of a forest in unconstrained arrangements, \(\mathbb{V}[C]\). | |
numeric::rational | var_num_crossings_tree_rational (const graphs::free_tree &t) noexcept |
Computes the variance of the number of crossings of a tree in unconstrained arrangements, \(\mathbb{V}[C]\). | |
double | var_num_crossings_tree (const graphs::free_tree &t) noexcept |
Computes the variance of the number of crossings of a tree in unconstrained arrangements, \(\mathbb{V}[C]\). | |
numeric::rational | var_num_crossings_tree_rational (const graphs::rooted_tree &t) noexcept |
Computes the variance of the number of crossings of a tree in unconstrained arrangements, \(\mathbb{V}[C]\). | |
double | var_num_crossings_tree (const graphs::rooted_tree &t) noexcept |
Computes the variance of the number of crossings of a tree in unconstrained arrangements, \(\mathbb{V}[C]\). | |
numeric::rational | exp_sum_edge_lengths_rational (const graphs::undirected_graph &g) noexcept |
Expected sum of edge lengths of an undirected graph in unconstrained arrangments, \(\mathbb{E}[D]\). | |
double | exp_sum_edge_lengths (const graphs::undirected_graph &g) noexcept |
Expected sum of edge lengths of an undirected graph in unconstrained arrangments, \(\mathbb{E}[D]\). | |
numeric::rational | exp_sum_edge_lengths_rational (const graphs::free_tree &t) noexcept |
Expected sum of edge lengths of a free tree in unconstrained arrangments, \(\mathbb{E}[D]\). | |
double | exp_sum_edge_lengths (const graphs::free_tree &t) noexcept |
Expected sum of edge lengths of a free tree in unconstrained arrangments, \(\mathbb{E}[D]\). | |
numeric::rational | exp_sum_edge_lengths_rational (const graphs::rooted_tree &t) noexcept |
Expected sum of edge lengths of a rooted tree in unconstrained arrangments, \(\mathbb{E}[D]\). | |
double | exp_sum_edge_lengths (const graphs::rooted_tree &t) noexcept |
Expected sum of edge lengths of a rooted tree in unconstrained arrangments, \(\mathbb{E}[D]\). | |
numeric::rational | exp_sum_edge_lengths_projective_rational (const graphs::rooted_tree &rt) noexcept |
Expected sum of edge lengths of a tree constrained to projective arrangments, \(\mathbb{E}_{\mathrm{pr}}[D]\). | |
double | exp_sum_edge_lengths_projective (const graphs::rooted_tree &rt) noexcept |
Expected sum of edge lengths of a tree constrained to projective arrangments, \(\mathbb{E}_{\mathrm{pr}}[D]\). | |
numeric::rational | exp_sum_edge_lengths_planar_rational (const graphs::free_tree &t) noexcept |
Expected sum of edge lengths of a tree constrained to planar arrangments, \(\mathbb{E}_{\mathrm{pl}}[D]\). | |
numeric::rational | exp_sum_edge_lengths_planar_rational (const graphs::rooted_tree &rt) noexcept |
Expected sum of edge lengths of a tree constrained to planar arrangments, \(\mathbb{E}_{\mathrm{pl}}[D]\). | |
double | exp_sum_edge_lengths_planar (const graphs::free_tree &t) noexcept |
Expected sum of edge lengths of a tree constrained to planar arrangments, \(\mathbb{E}_{\mathrm{pl}}[D]\). | |
double | exp_sum_edge_lengths_planar (const graphs::rooted_tree &rt) noexcept |
Expected sum of edge lengths of a tree constrained to planar arrangments, \(\mathbb{E}_{\mathrm{pl}}[D]\). | |
numeric::rational | var_sum_edge_lengths_rational (const graphs::undirected_graph &g) noexcept |
Computes the variance of the sum of the length of edges of a graph, \(\mathbb{V}[D]\). | |
double | var_sum_edge_lengths (const graphs::undirected_graph &g) noexcept |
Computes the variance of the sum of the length of edges of a graph, \(\mathbb{V}[D]\). | |
numeric::rational | moment_degree_rational (const graphs::undirected_graph &g, uint32_t p) noexcept |
Computes the \(p\)-th moment of degree about zero of a graph as an exact rational value. | |
double | moment_degree (const graphs::undirected_graph &g, uint32_t p) noexcept |
Computes the \(p\)-th moment of degree about zero of a directed graph as a floating point value. | |
numeric::rational | moment_degree_rational (const graphs::directed_graph &g, uint32_t p) noexcept |
Computes the \(p\)-th moment of degree about zero of a directed graph as an exact rational value. | |
double | moment_degree (const graphs::directed_graph &g, uint32_t p) noexcept |
Computes the \(p\)-th moment of degree about zero of a directed graph as a floating point value. | |
numeric::rational | moment_degree_in_rational (const graphs::directed_graph &g, uint32_t p) noexcept |
Computes the \(p\)-th moment of in-degree about zero of a directed graph as an exact rational value. | |
double | moment_degree_in (const graphs::directed_graph &g, uint32_t p) noexcept |
Computes the \(p\)-th moment of in-degree about zero of a directed graph as a floating point value. | |
numeric::rational | moment_degree_out_rational (const graphs::directed_graph &g, uint32_t p) noexcept |
Computes the \(p\)-th moment of out-degree about zero of a directed graph as an exact rational value. | |
double | moment_degree_out (const graphs::directed_graph &g, uint32_t p) noexcept |
Computes the \(p\)-th moment of out-degree about zero of a directed graph as a floating point value. | |
numeric::rational | hubiness_rational (const graphs::free_tree &t) noexcept |
Computes the hubiness coefficient as an exact rational number. | |
numeric::rational | hubiness_rational (const graphs::rooted_tree &t) noexcept |
Computes the hubiness coefficient as an exact rational number. | |
double | hubiness (const graphs::free_tree &t) noexcept |
Computes the hubiness coefficient as a floating point value. | |
double | hubiness (const graphs::rooted_tree &t) noexcept |
Computes the hubiness coefficient as a floating point value. | |
numeric::rational | mean_hierarchical_distance_rational (const graphs::rooted_tree &t) noexcept |
Mean Hierarchical Distance. | |
double | mean_hierarchical_distance (const graphs::rooted_tree &t) noexcept |
Mean Hierarchical Distance. | |
numeric::integer | num_pairs_independent_edges_integer (const graphs::undirected_graph &g) noexcept |
Compute the size of \(Q(G)\). | |
uint64_t | num_pairs_independent_edges (const graphs::undirected_graph &g) noexcept |
Compute the size of \(Q(G)\). | |
numeric::integer | num_pairs_independent_edges_integer (const graphs::directed_graph &g) noexcept |
Compute the size of \(Q(G)\). | |
uint64_t | num_pairs_independent_edges (const graphs::directed_graph &g) noexcept |
Compute the size of \(Q(G)\). | |
std::pair< node, node > | tree_centre (const graphs::rooted_tree &t) noexcept |
Calculate the centre of a rooted tree. | |
std::pair< node, node > | tree_centre (const graphs::free_tree &t) noexcept |
Calculate the centre of a free tree. | |
std::pair< node, node > | tree_centroid (const graphs::rooted_tree &t) noexcept |
Calculate the centroid of a rooted tree. | |
std::pair< node, node > | tree_centroid (const graphs::free_tree &t) noexcept |
Calculate the centroid of a free tree. | |
uint32_t | tree_diameter (const graphs::free_tree &t) noexcept |
Calculate the diameter of a free tree. | |
uint32_t | tree_diameter (const graphs::rooted_tree &t) noexcept |
Calculate the diameter of a free tree. | |
Namespace for all linear-arrangement-independent algorithms.
This namespace contains functions to calculate properties of graphs that do not depend, whether implicitly or explicitly, on a linear arrangement.
|
inlinenoexcept |
Computes the the expected number of crossings in unconstrained arrangements, \(\mathbb{E}[C]\).
See lal::properties::exp_num_crossings_rational for details.
g | The input graph. |
|
noexcept |
Computes the the expected number of crossings in unconstrained arrangements, \(\mathbb{E}[C]\).
Returns \(\mathbb{E}[C]\) as a rational value.
g | The input graph. |
|
inlinenoexcept |
Expected sum of edge lengths of a free tree in unconstrained arrangments, \(\mathbb{E}[D]\).
See lal::properties::exp_sum_edge_lengths_rational for details.
t | The input free tree. |
|
inlinenoexcept |
Expected sum of edge lengths of a rooted tree in unconstrained arrangments, \(\mathbb{E}[D]\).
See lal::properties::exp_sum_edge_lengths_rational for details.
t | The input rooted tree. |
|
inlinenoexcept |
Expected sum of edge lengths of an undirected graph in unconstrained arrangments, \(\mathbb{E}[D]\).
See lal::properties::exp_sum_edge_lengths_rational for details.
g | The input graph. |
|
inlinenoexcept |
Expected sum of edge lengths of a tree constrained to planar arrangments, \(\mathbb{E}_{\mathrm{pl}}[D]\).
This function uses the formulae derived in [4].
Returns the value \(E_{\mathrm{pl}}[D]\) as a rational value.
t | The input free tree. |
|
inlinenoexcept |
Expected sum of edge lengths of a tree constrained to planar arrangments, \(\mathbb{E}_{\mathrm{pl}}[D]\).
This function uses the formulae derived in [4].
Returns the value \(E_{\mathrm{pl}}[D]\) as a rational value.
rt | The input rooted tree. |
|
noexcept |
Expected sum of edge lengths of a tree constrained to planar arrangments, \(\mathbb{E}_{\mathrm{pl}}[D]\).
This function uses the formulae derived in [4].
Returns the value \(E_{\mathrm{pl}}[D]\) as a rational value.
t | The input free tree. |
|
inlinenoexcept |
Expected sum of edge lengths of a tree constrained to planar arrangments, \(\mathbb{E}_{\mathrm{pl}}[D]\).
This function uses the formulae derived in [4].
Returns the value \(E_{\mathrm{pl}}[D]\) as a rational value.
rt | The input rooted tree. |
|
inlinenoexcept |
Expected sum of edge lengths of a tree constrained to projective arrangments, \(\mathbb{E}_{\mathrm{pr}}[D]\).
See lal::properties::exp_sum_edge_lengths_projective_rational for details.
rt | The input rooted tree. |
|
noexcept |
Expected sum of edge lengths of a tree constrained to projective arrangments, \(\mathbb{E}_{\mathrm{pr}}[D]\).
This function uses the formulae derived in [5].
Returns the value \(E_{\mathrm{pr}}[D]\) as a rational value.
rt | The input rooted tree. |
|
inlinenoexcept |
Expected sum of edge lengths of a free tree in unconstrained arrangments, \(\mathbb{E}[D]\).
This function uses the formulae derived in [21].
Returns the value \(E[D]\) as a rational value.
t | The input rooted tree. |
|
inlinenoexcept |
Expected sum of edge lengths of a rooted tree in unconstrained arrangments, \(\mathbb{E}[D]\).
This function uses the formulae derived in [21].
Returns the value \(E[D]\) as a rational value.
t | The input rooted tree. |
|
inlinenoexcept |
Expected sum of edge lengths of an undirected graph in unconstrained arrangments, \(\mathbb{E}[D]\).
This function uses the formulae derived in [21].
Returns the value \(E[D]\) as a rational value.
g | The input graph. |
|
noexcept |
Computes the hubiness coefficient as a floating point value.
See lal::properties::hubiness_rational for details.
t | Input free tree. |
|
noexcept |
Computes the hubiness coefficient as a floating point value.
See lal::properties::hubiness_rational for details.
t | Input rooted tree. |
|
noexcept |
Computes the hubiness coefficient as an exact rational number.
The hubiness coefficient is defined as.
\(h = \frac{ \langle k^2 \rangle - \langle k^2 \rangle_{linear} } { \langle k^2 \rangle_{star} - \langle k^2 \rangle_{linear} }\),
where \(\langle k^2 \rangle_{star}\) and \(\langle k^2 \rangle_{linear}\) are the second moment of degree about 0 (see lal::properties::moment_degree_rational) of a star and linear tree respectively.
See [12] for further details.
t | Input free tree. |
|
noexcept |
Computes the hubiness coefficient as an exact rational number.
The hubiness coefficient is defined as.
\(h = \frac{ \langle k^2 \rangle - \langle k^2 \rangle_{linear} } { \langle k^2 \rangle_{star} - \langle k^2 \rangle_{linear} }\),
where \(\langle k^2 \rangle_{star}\) and \(\langle k^2 \rangle_{linear}\) are the second moment of degree about 0 (see lal::properties::moment_degree_rational) of a star and linear tree respectively.
See [12] for further details.
t | Input rooted tree. |
|
noexcept |
Mean Hierarchical Distance.
See lal::properties::mean_hierarchical_distance_rational for details.
t | Input rooted tree. |
|
noexcept |
Mean Hierarchical Distance.
The mean hierarchical distance is calculated as a mean of the different hierarchical distances between each vertex and the root of the tree. The hierarchical distance \(HD_u\) of vertex \(u\) is calculated as the number of edges between the tree's root and \(u\). The result of this function is the mean of these distances: \(MHD = \frac{1}{n-1} \sum_{u\in V} HD_u\).
For furhter details see [23].
t | Input rooted tree. |
|
noexcept |
Computes the \(p\)-th moment of degree about zero of a directed graph as a floating point value.
See lal::properties::moment_degree_rational for details.
g | Input graph. |
p | Moment of degree. |
|
noexcept |
Computes the \(p\)-th moment of degree about zero of a directed graph as a floating point value.
See lal::properties::moment_degree_rational for details.
g | Input graph. |
p | Moment of degree. |
|
noexcept |
Computes the \(p\)-th moment of in-degree about zero of a directed graph as a floating point value.
See lal::properties::moment_degree_in_rational for details.
g | Input graph. |
p | Moment of degree. |
|
noexcept |
Computes the \(p\)-th moment of in-degree about zero of a directed graph as an exact rational value.
Computes the \(p\)-th moment of in-degree about zero, \(\langle k_{in}^p \rangle\), of a directed graph using:
\(\langle k_{in}^p \rangle = \frac{1}{n} \sum_{i=1}^n k_{in, i}^p \).
where \(n\) denotes the number of nodes of the graph.
g | Input graph. |
p | Moment of degree. |
|
noexcept |
Computes the \(p\)-th moment of out-degree about zero of a directed graph as a floating point value.
See lal::properties::moment_degree_out_rational for details.
g | Input graph. |
p | Moment of degree. |
|
noexcept |
Computes the \(p\)-th moment of out-degree about zero of a directed graph as an exact rational value.
Computes the \(p\)-th moment of out-degree about zero, \(\langle k_{out}^p \rangle\), of a directed graph using:
\(\langle k_{out}^p \rangle = \frac{1}{n} \sum_{i=1}^n k_{out, i}^p \).
where \(n\) denotes the number of nodes of the graph.
g | Input graph. |
p | Moment of degree. |
|
noexcept |
Computes the \(p\)-th moment of degree about zero of a directed graph as an exact rational value.
Computes the \(p\)-th moment of degree about zero, \(\langle k^p \rangle\), of a graph using:
\(\langle k^p \rangle = \frac{1}{n} \sum_{i=1}^n k_i^p \).
where \(n\) denotes the number of nodes of the graph and \(k_i\) is the in-degree plus the out-degree of vertex \(i\).
g | Input graph. |
p | Moment of degree. |
|
noexcept |
Computes the \(p\)-th moment of degree about zero of a graph as an exact rational value.
Computes the \(p\)-th moment of degree about zero, \(\langle k^p \rangle\), of a graph using:
\(\langle k^p \rangle = \frac{1}{n} \sum_{i=1}^n k_i^p \).
where \(n\) denotes the number of nodes of the graph and \(k_i\) is the degree of vertex \(i\).
g | Input graph. |
p | Moment of degree. |
|
inlinenoexcept |
Compute the size of \(Q(G)\).
See lal::properties::num_pairs_independent_edges_integer for details.
g | Input graph. |
|
inlinenoexcept |
Compute the size of \(Q(G)\).
See lal::properties::num_pairs_independent_edges_integer for details.
g | Input graph. |
|
noexcept |
Compute the size of \(Q(G)\).
The set \(Q(G)\) of a graph \(G\) is the set of pairs of independent edges. Two edges are said to be independent if they do not share vertices. Therefore, this function returns the amount of independent edges of this directed graph.
g | Input graph. |
|
noexcept |
Compute the size of \(Q(G)\).
The set \(Q(G)\) of a graph \(G\) is the set of pairs of independent edges. Two edges are said to be independent if they do not share vertices. Therefore, this function returns the amount of independent edges of this undirected graph.
g | Input graph. |
|
noexcept |
Calculate the centre of a free tree.
Here, "centre" should not be confused with "centroid". The center is the set of (at most) two vertices that have minimum eccentricity. The centroid is the set of (at most) two vertices that have minimum weight, where the weight is the maximum size of the subtrees rooted at that vertex. See [19] (pages 35-36) for further details.
t | Input tree. |
|
noexcept |
Calculate the centre of a rooted tree.
Here, "centre" should not be confused with "centroid". The center is the set of (at most) two vertices that have minimum eccentricity. The centroid is the set of (at most) two vertices that have minimum weight, where the weight is the maximum size of the subtrees rooted at that vertex. See [19] (pages 35-36) for further details.
t | Input tree. |
|
noexcept |
Calculate the centroid of a free tree.
Here, "centre" should not be confused with "centroid". The center is the set of (at most) two vertices that have minimum eccentricity. The centroid is the set of (at most) two vertices that have minimum weight, where the weight is the maximum size of the subtrees rooted at that vertex. See [19] (pages 35-36) for further details.
t | Input tree. |
|
noexcept |
Calculate the centroid of a rooted tree.
Here, "centroid" should not be confused with "centre". The centre is the set of (at most) two vertices that have minimum eccentricity. The centroid is the set of (at most) two vertices that have minimum weight, where the weight is the maximum size of the subtrees rooted at that vertex. In both case, if the set has two vertices then they are adjacent in the tree. See [19] (pages 35-36) for further details.
t | Input tree. |
|
noexcept |
Calculate the diameter of a free tree.
The diameter is defined as the longest shortest distance between every pair of vertices. The distance is calculated in number of edges; two adjacent vertices are at a distance 1 from each other. See [19] (pages 24, 35) for further details.
t | Input tree. |
|
noexcept |
Calculate the diameter of a free tree.
The diameter is defined as the longest shortest distance between every pair of vertices. The distance is calculated in number of edges; two adjacent vertices are at a distance 1 from each other. See [19] (pages 24, 35) for further details.
t | Input tree. |
|
inlinenoexcept |
Computes the variance of the number of crossings of a graph in unconstrained arrangements, \(\mathbb{V}[C]\).
See lal::properties::var_num_crossings_rational for details.
g | Input graph. |
reuse | The algorithm will reuse computations in order to compute the variance faster. Note: this might be too memory-consuming. |
|
inlinenoexcept |
Computes the variance of the number of crossings of a forest in unconstrained arrangements, \(\mathbb{V}[C]\).
See lal::properties::var_num_crossings_forest_rational for details.
g | Input forest. |
|
noexcept |
Computes the variance of the number of crossings of a forest in unconstrained arrangements, \(\mathbb{V}[C]\).
Computes \(\mathbb{V}[C]\) on the given forest. This function implements the algorithm in [3] for forests, which stems from the study in [2].
Complexity: time \(O(n)\), space \(O(n)\).
g | Input forest. |
|
noexcept |
Computes the variance of the number of crossings of a graph in unconstrained arrangements, \(\mathbb{V}[C]\).
Computes \(\mathbb{V}[C]\) on the given graph. This function implements the algorithm in [3] for general graphs, which stems from the study in [2].
Since there are many computations that can be resued, setting reuse to 'true' can help speed up the algorithm. Warning: reusing memory might be too memory-consuming for large graphs (handle with care).
g | Input graph. |
reuse | The algorithm will reuse computations in order to compute the variance faster. Note: this might be too memory-consuming. |
|
inlinenoexcept |
Computes the variance of the number of crossings of a tree in unconstrained arrangements, \(\mathbb{V}[C]\).
See lal::properties::var_num_crossings_tree_rational for details.
t | Input free tree. |
|
inlinenoexcept |
Computes the variance of the number of crossings of a tree in unconstrained arrangements, \(\mathbb{V}[C]\).
This function converts the input rooted tree into a free tree.
See lal::properties::var_num_crossings_tree_rational for details.
t | Input rooted tree. |
|
inlinenoexcept |
Computes the variance of the number of crossings of a tree in unconstrained arrangements, \(\mathbb{V}[C]\).
Computes \(\mathbb{V}[C]\) on the given tree. This function computes the simplified formula of \(V_{rla}[C]\) on general graphs for the case of trees. Complexity: time \(O(n)\), space \(O(n)\).
t | Input free tree. |
|
inlinenoexcept |
Computes the variance of the number of crossings of a tree in unconstrained arrangements, \(\mathbb{V}[C]\).
This function converts the input rooted tree into a free tree.
Computes \(\mathbb{V}[C]\) on the given tree. This function computes the simplified formula of \(V_{rla}[C]\) on general graphs for the case of trees. Complexity: time \(O(n)\), space \(O(n)\).
t | Input rooted tree. |
|
inlinenoexcept |
Computes the variance of the sum of the length of edges of a graph, \(\mathbb{V}[D]\).
See lal::properties::var_sum_edge_lengths_rational for details.
g | The input graph. |
|
noexcept |
Computes the variance of the sum of the length of edges of a graph, \(\mathbb{V}[D]\).
Computes the variance of the sum of edge lengths over all \(n!\) arrangements.
This function uses the formula derived in [21].
g | Input graph. |