50#include <lal/graphs/rooted_tree.hpp>
51#include <lal/linarr/C/C.hpp>
52#include <lal/iterators/E_iterator.hpp>
53#include <lal/properties/bipartite_graph_coloring.hpp>
54#include <lal/properties/bipartite_graph_colorability.hpp>
55#include <lal/detail/array.hpp>
56#include <lal/detail/arrangement_wrapper.hpp>
74 if (arr.size() == 0) {
return true; }
77 if (arr.size() == 1) {
78 return arr[position_t{0ull}] == 0;
81 detail::array<char> d(arr.size(), 0);
82 for (node_t u = 0ull; u < arr.size(); ++u) {
85 if (p >= arr.size()) {
return false; }
87 if (d[p] > 0) {
return false; }
103template <
class graph_t>
107 if constexpr (std::is_base_of_v<graph_t, graphs::tree>) {
114 if (arr.size() == 0) {
return true; }
116 if (g.get_num_nodes() != arr.size()) {
return false; }
121 *std::max_element(arr.begin_direct(), arr.end_direct());
123 return max_pos == arr.size() - 1;
204template <
class graph_t>
252 assert(rt.is_rooted_tree());
257 if (not
is_planar(rt, arr)) {
return false; }
Directed graph class.
Definition directed_graph.hpp:67
Rooted tree graph class.
Definition rooted_tree.hpp:109
Undirected graph class.
Definition undirected_graph.hpp:66
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
bool is_arrangement(const graph_t &g, const linear_arrangement &arr) noexcept
Is a given arrangement valid?
Definition formal_constraints.hpp:104
bool is_permutation(const linear_arrangement &arr={}) noexcept
Is a given input arrangement a permutation?
Definition formal_constraints.hpp:70
bool is_root_covered(const graphs::rooted_tree &rt, const linear_arrangement &arr) noexcept
Is the root of a rooted tree covered in a given arrangement?
bool is_planar(const graph_t &g, const linear_arrangement &arr={}) noexcept
Is a given arrangement planar?
Definition formal_constraints.hpp:205
bool is_bipartite(const graphs::undirected_graph &g, const properties::bipartite_graph_coloring &c, const linear_arrangement &arr={}) noexcept
Is a given arrangement bipartite?
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?
bool is_projective(const graphs::rooted_tree &rt, const linear_arrangement &arr) noexcept
Is a given arrangement projective?
Definition formal_constraints.hpp:248
Main namespace of the library.
Definition basic_types.hpp:48
uint64_t position
Node's position type.
Definition basic_types.hpp:53