51#include <lal/basic_types.hpp>
52#include <lal/detail/array.hpp>
53#include <lal/graphs/tree.hpp>
85 void init(std::size_t n)
noexcept {
196 template <
class graph_t>
197 [[nodiscard]]
bool is_antenna(
const graph_t& t)
const noexcept {
198 static_assert(std::is_base_of_v<graphs::graph, graph_t>);
199 return t.get_degree(
m_h1) == 1 or t.get_degree(
m_h2) == 1;
Branchless paths in trees.
Definition branchless_path.hpp:73
void set_h2(node h) noexcept
Sets the second vertex of degree different from 2.
Definition branchless_path.hpp:110
std::vector< node > m_vertex_sequence
The vertex sequence of this branchless path (includes h1 and h2).
Definition branchless_path.hpp:208
std::size_t get_position(node u) const noexcept
Returns the get_position of node u in m_vertex_sequence.
Definition branchless_path.hpp:180
detail::array< std::size_t > m_position
The position in m_vertex_sequence of each vertex.
Definition branchless_path.hpp:206
bool has_node(node u) const noexcept
Does this path include node u?
Definition branchless_path.hpp:178
const std::vector< node > & get_vertex_sequence() const noexcept
Gets the vertex sequence of this path as a vector.
Definition branchless_path.hpp:158
void set_h1(node h) noexcept
Sets the first vertex of degree different from 2.
Definition branchless_path.hpp:108
node m_h1
The first endpoint of this path.
Definition branchless_path.hpp:211
node get_h1() const noexcept
Gets the first vertex of degree different from 2.
Definition branchless_path.hpp:125
void set_lowest_lexicographic(node l) noexcept
Set lowest lexicographic vertex.
Definition branchless_path.hpp:112
void add_node(node u) noexcept
Adds a node to this path.
Definition branchless_path.hpp:99
node get_lowest_lexicographic() const noexcept
Gets the lowest lexicographic vertex.
Definition branchless_path.hpp:144
std::size_t get_num_edges() const noexcept
Number of edges in this path.
Definition branchless_path.hpp:175
std::optional< node > m_lowest_lexicographic
The internal vertex with lowest index lexicographically.
Definition branchless_path.hpp:219
void init(std::size_t n) noexcept
Initializes this path.
Definition branchless_path.hpp:85
bool is_antenna(const graph_t &t) const noexcept
Is the given path an antenna?
Definition branchless_path.hpp:197
std::size_t get_num_nodes() const noexcept
Number of vertices in this path.
Definition branchless_path.hpp:167
node get_h2() const noexcept
Gets the second vertex of degree different from 2.
Definition branchless_path.hpp:127
detail::array< char > m_vertex_set
A 0-1 array to indicate if a vertex belongs to this path or not.
Definition branchless_path.hpp:204
node m_h2
The second endpoint of this path.
Definition branchless_path.hpp:213
bool has_lowest_lexicographic() const noexcept
Does this path have a lowest lexicographic vertex?
Definition branchless_path.hpp:135
node operator[](std::size_t i) const noexcept
Access the i-th node in the path.
Definition branchless_path.hpp:117
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
Wrapper of a C array for automatic deallocation of memory.
Definition array.hpp:59
std::size_t size() const noexcept
Size of the array.
Definition array.hpp:215
void resize(const std::size_t new_size) noexcept
Resize the array.
Definition array.hpp:187