LAL: Linear Arrangement Library 24.10.00
A library focused on algorithms on linear arrangements of graphs.
Loading...
Searching...
No Matches
DMax.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// lal includes
45#include <lal/linear_arrangement.hpp>
46#include <lal/graphs/free_tree.hpp>
47#include <lal/graphs/rooted_tree.hpp>
48#include <lal/properties/bipartite_graph_coloring.hpp>
49#include <lal/properties/branchless_path.hpp>
50
51namespace lal {
52namespace linarr {
53
54/* ----------------------------- Unconstrained ------------------------------ */
55
75[[nodiscard]] std::pair<uint64_t, std::vector<linear_arrangement>>
77(
78 const graphs::free_tree& t,
79 const std::vector<std::vector<node>>& orbits,
81 const std::vector<properties::branchless_path>& bps,
82 const std::size_t num_threads = 1
83)
84noexcept;
85
104[[nodiscard]] std::pair<uint64_t, std::vector<linear_arrangement>>
106(
107 const graphs::free_tree& t,
108 const std::vector<std::vector<node>>& orbits,
109 const std::vector<properties::branchless_path>& bps,
110 const std::size_t num_threads = 1
111)
112noexcept;
113
132[[nodiscard]] std::pair<uint64_t, std::vector<linear_arrangement>>
134(
135 const graphs::free_tree& t,
136 const properties::bipartite_graph_coloring& c,
137 const std::vector<properties::branchless_path>& bps,
138 const std::size_t num_threads = 1
139)
140noexcept;
141
160[[nodiscard]] std::pair<uint64_t, std::vector<linear_arrangement>>
162(
163 const graphs::free_tree& t,
164 const std::vector<std::vector<node>>& orbits,
165 const properties::bipartite_graph_coloring& c,
166 const std::size_t num_threads = 1
167)
168noexcept;
169
187[[nodiscard]] std::pair<uint64_t, std::vector<linear_arrangement>>
189(
190 const graphs::free_tree& t,
191 const std::vector<properties::branchless_path>& bps,
192 const std::size_t num_threads = 1
193)
194noexcept;
195
213[[nodiscard]] std::pair<uint64_t, std::vector<linear_arrangement>>
215(
216 const graphs::free_tree& t,
217 const properties::bipartite_graph_coloring& c,
218 const std::size_t num_threads = 1
219)
220noexcept;
221
239[[nodiscard]] std::pair<uint64_t, std::vector<linear_arrangement>>
241(
242 const graphs::free_tree& t,
243 const std::vector<std::vector<node>>& orbits,
244 const std::size_t num_threads = 1
245)
246noexcept;
247
264[[nodiscard]] std::pair<uint64_t, std::vector<linear_arrangement>>
266(const graphs::free_tree& t, const std::size_t num_threads = 1)
267noexcept;
268
269/* ------------------------ Non-BIPARTITE CONSTRAINT ------------------------ */
270
287(
288 const graphs::free_tree& t,
289 const properties::bipartite_graph_coloring& c,
290 const std::vector<properties::branchless_path>& bps
291)
292noexcept;
309(const graphs::free_tree& t, const std::vector<properties::branchless_path>& bps)
310noexcept;
326(const graphs::free_tree& t, const properties::bipartite_graph_coloring& c)
327noexcept;
341[[nodiscard]] std::pair<uint64_t, linear_arrangement>
343(const graphs::free_tree& t)
344noexcept;
345
361(const graphs::free_tree& t, const std::vector<properties::branchless_path>& bps)
362noexcept;
376[[nodiscard]] std::pair<uint64_t, linear_arrangement>
378(const graphs::free_tree& t)
379noexcept;
380
381/* -------------------------- BIPARTITE CONSTRAINT -------------------------- */
382
397[[nodiscard]] std::pair<uint64_t, linear_arrangement> max_sum_edge_lengths_bipartite
398(const graphs::undirected_graph& g, const properties::bipartite_graph_coloring& c)
399noexcept;
413[[nodiscard]] std::pair<uint64_t, linear_arrangement> max_sum_edge_lengths_bipartite
414(const graphs::undirected_graph& g)
415noexcept;
433[[nodiscard]] std::pair<uint64_t, linear_arrangement> max_sum_edge_lengths_bipartite
434(const graphs::directed_graph& g, const properties::bipartite_graph_coloring& c)
435noexcept;
452[[nodiscard]] std::pair<uint64_t, linear_arrangement> max_sum_edge_lengths_bipartite
453(const graphs::directed_graph& g)
454noexcept;
455
456/* ------------------- PROJECTIVE AND PLANAR CONSTRAINTS -------------------- */
457
475[[nodiscard]] std::pair<uint64_t, linear_arrangement> max_sum_edge_lengths_planar
476(const graphs::free_tree& t)
477noexcept;
498[[nodiscard]] inline std::pair<uint64_t, linear_arrangement> max_sum_edge_lengths_planar
499(const graphs::rooted_tree& t)
500noexcept
501{
502 return max_sum_edge_lengths_planar(t.to_free_tree());
503}
504
522[[nodiscard]] std::pair<std::vector<uint64_t>, node> max_sum_edge_lengths_projective_roots
523(const graphs::free_tree& t)
524noexcept;
545[[nodiscard]] inline std::pair<std::vector<uint64_t>, node>
547(const graphs::rooted_tree& t)
548noexcept
549{
550 return max_sum_edge_lengths_projective_roots(t.to_free_tree());
551}
552
570[[nodiscard]] std::pair<uint64_t, linear_arrangement>
572(const graphs::rooted_tree& t)
573noexcept;
574
575} // -- namespace linarr
576} // -- namespace lal
Free tree graph class.
Definition free_tree.hpp:60
Rooted tree graph class.
Definition rooted_tree.hpp:109
Linear arrangement of vertices.
Definition linear_arrangement.hpp:103
A class to represent a coloring of the vertices of a bipartite graph.
Definition bipartite_graph_coloring.hpp:60
std::pair< uint64_t, linear_arrangement > max_sum_edge_lengths_projective(const graphs::rooted_tree &t) noexcept
Computes the maximum value of in rooted trees under the projectivity constraint.
std::pair< uint64_t, linear_arrangement > max_sum_edge_lengths_bipartite(const graphs::undirected_graph &g, const properties::bipartite_graph_coloring &c) noexcept
Calculates the solution to Bipartite MaxLA as defined in Alemany2024a.
std::pair< std::vector< uint64_t >, node > max_sum_edge_lengths_projective_roots(const graphs::free_tree &t) noexcept
Computes the maximum value of in trees under the projectivity constraint at every vertex of the tree...
std::pair< uint64_t, std::vector< linear_arrangement > > max_sum_edge_lengths_all(const graphs::free_tree &t, const std::vector< std::vector< node > > &orbits, const properties::bipartite_graph_coloring &c, const std::vector< properties::branchless_path > &bps, const std::size_t num_threads=1) noexcept
Calculates all the linear arrangements that yield the maximum sum of edge lengths.
std::pair< uint64_t, linear_arrangement > max_sum_edge_lengths_1_eq_thistle(const graphs::free_tree &t, const std::vector< properties::branchless_path > &bps) noexcept
Calculates the solution to -thistle MaxLA.
std::pair< uint64_t, linear_arrangement > max_sum_edge_lengths_1_le_thistle(const graphs::free_tree &t, const properties::bipartite_graph_coloring &c, const std::vector< properties::branchless_path > &bps) noexcept
Calculates the solution to -thistle MaxLA.
std::pair< uint64_t, linear_arrangement > max_sum_edge_lengths_planar(const graphs::free_tree &t) noexcept
Computes the maximum value of in trees under the planarity constraint.
Main namespace of the library.
Definition basic_types.hpp:48
uint64_t node
Node type. See Node / Vertex page for further details.
Definition basic_types.hpp:51