45#include <lal/detail/linarr/level_signature.hpp>
68template <
class graph_t, level_signature_type t>
77 const auto n = g.get_num_nodes();
80 if (levels[p] < levels[p + 1ull]) {
87 const node_t u = (arr.size() == 0 ? *p : arr[p]);
88 const node_t v = (arr.size() == 0 ? *p + 1 : arr[p + 1ull]);
89 if (levels[u] < levels[v]) {
113template <
class graph_t, level_signature_type t>
124 const auto [u, v] = it.yield_edge_t();
125 const position_t pu = (arr.size() == 0 ? *u : arr[u]);
126 const position_t pv = (arr.size() == 0 ? *v : arr[v]);
127 if (levels[pu] == levels[pv]) {
134 const auto [u, v] = it.yield_edge_t();
135 if (levels[u] == levels[v]) {
160template <
class graph_t, level_signature_type t>
164 const std::vector<properties::branchless_path>& bps,
172 if (not bp.is_antenna(g)) {
continue; }
174 const auto& seq = bp.get_vertex_sequence();
175 for (std::size_t i = 1; i < seq.size() - 1; ++i) {
178 assert(g.get_degree(*u) == 2);
204template <
class graph_t, level_signature_type t>
208 const std::vector<properties::branchless_path>& bps,
216 if (bp.is_antenna(g)) {
continue; }
218 uint64_t num_thistles = 0;
219 const auto& seq = bp.get_vertex_sequence();
220 for (std::size_t i = 1; i < seq.size() - 1; ++i) {
223 assert(g.get_degree(*u) == 2);
229 if (num_thistles > 1) {
A class that implements level signatures of an array.
Definition level_signature.hpp:90
Iterator over the set of edges of a graph.
Definition E_iterator.hpp:97
bool end() const noexcept
Returns true if the end of the iteration was reached.
Definition E_iterator.hpp:117
Linear arrangement of vertices.
Definition linear_arrangement.hpp:103
Branchless paths in trees.
Definition branchless_path.hpp:73
bool is_level_signature_nonincreasing(const graph_t &g, const level_signature< t > &levels, const linear_arrangement &arr) noexcept
Returns true if the level sequence follows that of a maximum arrangement.
Definition necessary_conditions.hpp:70
bool no_two_adjacent_vertices_have_same_level(const graph_t &g, const level_signature< t > &levels, const linear_arrangement &arr) noexcept
Returns true if no two adjacent vertices (in the graph) have the same level value.
Definition necessary_conditions.hpp:115
bool is_thistle_vertex(const graph_t &g, const level_signature< t > &levels, const node_t u, const linear_arrangement &arr={}) noexcept
Returns whether or not the input vertex is a thistle vertex.
Definition level_signature.hpp:279
@ per_position
Given per position.
bool at_most_one_thistle_in_bridges(const graph_t &g, const std::vector< properties::branchless_path > &bps, const level_signature< t > &levels, const linear_arrangement &arr) noexcept
Returns true if none of the vertices in the antennas of the graph is a thistle.
Definition necessary_conditions.hpp:206
bool no_vertex_in_antenna_is_thistle(const graph_t &g, const std::vector< properties::branchless_path > &bps, const level_signature< t > &levels, const linear_arrangement &arr) noexcept
Returns true if none of the vertices in the antennas of the graph is a thistle.
Definition necessary_conditions.hpp:162
Main namespace of the library.
Definition basic_types.hpp:48
Typesafe node type.
Definition basic_types.hpp:70
Typesafe position type.
Definition basic_types.hpp:244