LAL: Linear Arrangement Library 23.01.00
A library focused on algorithms on linear arrangements of graphs.
Loading...
Searching...
No Matches
algorithms_crossings.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 - 2023
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 (lalemany@cs.upc.edu)
28 * LARCA (Laboratory for Relational Algorithmics, Complexity and Learning)
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 * LARCA (Laboratory for Relational Algorithmics, Complexity and Learning)
35 * CQL (Complexity and Quantitative Linguistics Lab)
36 * Office S124, 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/graph.hpp>
50#include <lal/graphs/directed_graph.hpp>
51#include <lal/graphs/undirected_graph.hpp>
52
53namespace lal {
54namespace detail {
55
56/*
57 * This file is a summary of the functions that implement the different
58 * algorithms to calculate the number of edge crossings.
59 */
60
72template <class graph_t>
74(const graph_t& g, const linear_arrangement& arr)
75noexcept;
76
90template <class graph_t>
91std::vector<uint64_t> n_C_brute_force
92(const graph_t& g, const std::vector<linear_arrangement>& arrs)
93noexcept;
94
110template <class graph_t>
112 const graph_t& g,
113 const linear_arrangement& arr,
114 uint64_t upper_bound
115) noexcept;
116
135template <class graph_t>
136std::vector<uint64_t> is_n_C_brute_force_lesseq_than(
137 const graph_t& g,
138 const std::vector<linear_arrangement>& arrs,
139 uint64_t upper_bound
140) noexcept;
141
161template <class graph_t>
162std::vector<uint64_t> is_n_C_brute_force_lesseq_than(
163 const graph_t& g,
164 const std::vector<linear_arrangement>& arrs,
165 const std::vector<uint64_t>& upper_bounds
166) noexcept;
167
168// -----------------------------------------------------------------------------
169
181template <class graph_t>
183(const graph_t& g, const linear_arrangement& arr)
184noexcept;
185
199template <class graph_t>
200std::vector<uint64_t> n_C_dynamic_programming(
201 const graph_t& g,
202 const std::vector<linear_arrangement>& arrs
203) noexcept;
204
223template <class graph_t>
225 const graph_t& g,
226 const linear_arrangement& arr,
227 uint64_t upper_bound
228) noexcept;
229
249template <class graph_t>
251 const graph_t& g,
252 const std::vector<linear_arrangement>& arrs,
253 uint64_t upper_bound
254) noexcept;
255
275template <class graph_t>
277 const graph_t& g,
278 const std::vector<linear_arrangement>& arrs,
279 const std::vector<uint64_t>& upper_bounds
280) noexcept;
281
282// -----------------------------------------------------------------------------
283
295template <class graph_t>
297(const graph_t& g, const linear_arrangement& arr)
298noexcept;
299
313template <class graph_t>
314std::vector<uint64_t> n_C_ladder(
315 const graph_t& g,
316 const std::vector<linear_arrangement>& arrs
317) noexcept;
318
334template <class graph_t>
336 const graph_t& g,
337 const linear_arrangement& arr,
338 uint64_t upper_bound
339) noexcept;
340
360template <class graph_t>
361std::vector<uint64_t> is_n_C_ladder_lesseq_than(
362 const graph_t& g,
363 const std::vector<linear_arrangement>& arrs,
364 uint64_t upper_bound
365) noexcept;
366
386template <class graph_t>
387std::vector<uint64_t> is_n_C_ladder_lesseq_than(
388 const graph_t& g,
389 const std::vector<linear_arrangement>& arrs,
390 const std::vector<uint64_t>& upper_bounds
391) noexcept;
392
393// -----------------------------------------------------------------------------
394
406template <class graph_t>
408(const graph_t& g, const linear_arrangement& arr)
409noexcept;
410
424template <class graph_t>
425std::vector<uint64_t> n_C_stack_based(
426 const graph_t& g,
427 const std::vector<linear_arrangement>& arrs
428) noexcept;
429
445template <class graph_t>
447 const graph_t& g,
448 const linear_arrangement& arr,
449 uint64_t upper_bound
450) noexcept;
451
471template <class graph_t>
472std::vector<uint64_t> is_n_C_stack_based_lesseq_than(
473 const graph_t& g,
474 const std::vector<linear_arrangement>& arrs,
475 uint64_t upper_bound
476) noexcept;
477
497template <class graph_t>
498std::vector<uint64_t> is_n_C_stack_based_lesseq_than(
499 const graph_t& g,
500 const std::vector<linear_arrangement>& arrs,
501 const std::vector<uint64_t>& upper_bounds
502) noexcept;
503
504} // -- namespace detail
505} // -- namespace lal
Linear arrangement of vertices.
Definition: linear_arrangement.hpp:103
uint64_t is_n_C_dynamic_programming_lesseq_than(const graph_t &g, const linear_arrangement &arr, uint64_t upper_bound) noexcept
Fast calculation of if it is less than or equal to an upper bound.
uint64_t n_C_ladder(const graph_t &g, const linear_arrangement &arr) noexcept
Is the number of crossings in the linear arrangement less than a constant?
uint64_t is_n_C_ladder_lesseq_than(const graph_t &g, const linear_arrangement &arr, uint64_t upper_bound) noexcept
Fast calculation of if it is less than or equal to an upper bound.
uint64_t n_C_stack_based(const graph_t &g, const linear_arrangement &arr) noexcept
Is the number of crossings in the linear arrangement less than a constant?
uint64_t is_n_C_brute_force_lesseq_than(const graph_t &g, const linear_arrangement &arr, uint64_t upper_bound) noexcept
Returns whether the number of crossings is less than a given constant.
uint64_t is_n_C_stack_based_lesseq_than(const graph_t &g, const linear_arrangement &arr, uint64_t upper_bound) noexcept
Fast calculation of if it is less than or equal to an upper bound.
uint64_t n_C_brute_force(const graph_t &g, const linear_arrangement &arr) noexcept
Is the number of crossings in the linear arrangement less than a constant?
uint64_t n_C_dynamic_programming(const graph_t &g, const linear_arrangement &arr) noexcept
Is the number of crossings in the linear arrangement less than a constant?
Main namespace of the library.
Definition: basic_types.hpp:50