LAL: Linear Arrangement Library 24.10.00
A library focused on algorithms on linear arrangements of graphs.
Loading...
Searching...
No Matches
C.hpp
1/*********************************************************************
2 *
3 * Linear Arrangement Library - A library that implements a collection
4 * algorithms for linear arrangments of graphs.
5 *
6 * Copyright (C) 2019 - 2024
7 *
8 * This file is part of Linear Arrangement Library. The full code is available
9 * at:
10 * https://github.com/LAL-project/linear-arrangement-library.git
11 *
12 * Linear Arrangement Library is free software: you can redistribute it
13 * and/or modify it under the terms of the GNU Affero General Public License
14 * as published by the Free Software Foundation, either version 3 of the
15 * License, or (at your option) any later version.
16 *
17 * Linear Arrangement Library is distributed in the hope that it will be
18 * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU Affero General Public License for more details.
21 *
22 * You should have received a copy of the GNU Affero General Public License
23 * along with Linear Arrangement Library. If not, see <http://www.gnu.org/licenses/>.
24 *
25 * Contact:
26 *
27 * LluĂ­s Alemany Puig (lluis.alemany.puig@upc.edu)
28 * LQMC (Quantitative, Mathematical, and Computational Linguisitcs)
29 * CQL (Complexity and Quantitative Linguistics Lab)
30 * Jordi Girona St 1-3, Campus Nord UPC, 08034 Barcelona. CATALONIA, SPAIN
31 * Webpage: https://cqllab.upc.edu/people/lalemany/
32 *
33 * Ramon Ferrer i Cancho (rferrericancho@cs.upc.edu)
34 * LQMC (Quantitative, Mathematical, and Computational Linguisitcs)
35 * CQL (Complexity and Quantitative Linguistics Lab)
36 * Office 220, Omega building
37 * Jordi Girona St 1-3, Campus Nord UPC, 08034 Barcelona. CATALONIA, SPAIN
38 * Webpage: https://cqllab.upc.edu/people/rferrericancho/
39 *
40 ********************************************************************/
41
42#pragma once
43
44// C++ includes
45#include <vector>
46
47// lal includes
48#include <lal/linear_arrangement.hpp>
49#include <lal/graphs/directed_graph.hpp>
50#include <lal/graphs/undirected_graph.hpp>
51#include <lal/linarr/C/algorithms_C.hpp>
52#include <lal/numeric/rational.hpp>
53
54namespace lal {
55namespace linarr {
56
69[[nodiscard]] uint64_t num_crossings
71noexcept;
84[[nodiscard]] uint64_t num_crossings
86noexcept;
87
101[[nodiscard]] uint64_t num_crossings
102(
103 const graphs::directed_graph& G,
104 const linear_arrangement& arr,
106)
107noexcept;
123 const linear_arrangement& arr,
125)
126noexcept;
127
143[[nodiscard]] std::vector<uint64_t> num_crossings_list
144(
145 const graphs::directed_graph& G,
146 const std::vector<linear_arrangement>& arrs,
148)
149noexcept;
165[[nodiscard]] std::vector<uint64_t> num_crossings_list
166(
168 const std::vector<linear_arrangement>& arrs,
170)
171noexcept;
172
192[[nodiscard]] uint64_t is_num_crossings_lesseq_than
193(
194 const graphs::directed_graph& G,
195 const uint64_t upper_bound,
197)
198noexcept;
218[[nodiscard]] uint64_t is_num_crossings_lesseq_than
219(
221 const uint64_t upper_bound,
223)
224noexcept;
225
246[[nodiscard]] uint64_t is_num_crossings_lesseq_than
247(
248 const graphs::directed_graph& G,
249 const linear_arrangement& arr,
250 const uint64_t upper_bound,
252)
253noexcept;
274[[nodiscard]] uint64_t is_num_crossings_lesseq_than
275(
277 const linear_arrangement& arr,
278 const uint64_t upper_bound,
280)
281noexcept;
282
305[[nodiscard]] std::vector<uint64_t> is_num_crossings_lesseq_than_list
306(
307 const graphs::directed_graph& G,
308 const std::vector<linear_arrangement>& arrs,
309 const uint64_t upper_bound,
311)
312noexcept;
334[[nodiscard]] std::vector<uint64_t> is_num_crossings_lesseq_than_list
335(
337 const std::vector<linear_arrangement>& arrs,
338 const uint64_t upper_bound,
340)
341noexcept;
342
367[[nodiscard]] std::vector<uint64_t> is_num_crossings_lesseq_than_list
368(
369 const graphs::directed_graph& G,
370 const std::vector<linear_arrangement>& arrs,
371 const std::vector<uint64_t>& upper_bounds,
373)
374noexcept;
399[[nodiscard]] std::vector<uint64_t> is_num_crossings_lesseq_than_list
400(
402 const std::vector<linear_arrangement>& arrs,
403 const std::vector<uint64_t>& upper_bounds,
405)
406noexcept;
407
408/* ---------------------------------------- */
409/* APPROXIMATION OF THE NUMBER OF CROSSINGS */
410
423(const graphs::undirected_graph& g, const linear_arrangement& arr = {}) noexcept;
424
437(const graphs::directed_graph& g, const linear_arrangement& arr = {}) noexcept;
438
447[[nodiscard]] double predicted_num_crossings
448(const graphs::undirected_graph& g, const linear_arrangement& arr = {}) noexcept;
449
458[[nodiscard]] double predicted_num_crossings
459(const graphs::directed_graph& g, const linear_arrangement& arr = {}) noexcept;
460
461} // -- namespace linarr
462} // -- namespace lal
Directed graph class.
Definition directed_graph.hpp:67
Undirected graph class.
Definition undirected_graph.hpp:66
Linear arrangement of vertices.
Definition linear_arrangement.hpp:103
Exact rational number.
Definition rational.hpp:63
uint64_t num_crossings(const graphs::directed_graph &G, const algorithms_C &A=algorithms_C::ladder) noexcept
Computes the number of edge crossings in a linear arrangement.
numeric::rational predicted_num_crossings_rational(const graphs::undirected_graph &g, const linear_arrangement &arr={}) noexcept
Predicts the number of crossings.
std::vector< uint64_t > is_num_crossings_lesseq_than_list(const graphs::directed_graph &G, const std::vector< linear_arrangement > &arrs, const uint64_t upper_bound, const algorithms_C &A=algorithms_C::ladder) noexcept
Is the number of crossings in the linear arrangement less than a constant?
std::vector< uint64_t > num_crossings_list(const graphs::directed_graph &G, const std::vector< linear_arrangement > &arrs, const algorithms_C &A=algorithms_C::ladder) noexcept
Computes the number of edge crossings in a linear arrangement.
double predicted_num_crossings(const graphs::undirected_graph &g, const linear_arrangement &arr={}) noexcept
Approximates the number of crossings.
algorithms_C
The different algorithms for computing the number of crossings.
Definition algorithms_C.hpp:57
@ ladder
Dynamic programming algorithm Alemany2019a.
uint64_t is_num_crossings_lesseq_than(const graphs::directed_graph &G, const uint64_t upper_bound, const algorithms_C &A=algorithms_C::ladder) noexcept
Is the number of crossings in the linear arrangement less than a constant?
Main namespace of the library.
Definition basic_types.hpp:48