53#include <lal/graphs/graph.hpp>
54#include <lal/graphs/tree_type.hpp>
189 [[nodiscard]]
virtual bool is_rooted() const noexcept = 0;
343 for (
node u = 0; u < n; ++u) {
374 t.tree_only_invalidate();
509 for (
node u = 0; u < n; ++u) {
542 uint64_t *
const root_of,
543 uint64_t *
const root_size
561 uint64_t *
const root_of,
562 uint64_t *
const root_size
578 uint64_t *
const root_of,
579 uint64_t *
const root_size
595 uint64_t *
const root_of,
596 uint64_t *
const root_size
615 uint64_t *
const root_of,
616 uint64_t *
const root_size
634 uint64_t *
const root_of,
635 uint64_t *
const root_size
655 uint64_t *
const root_of,
656 uint64_t *
const root_size
Abstract class for graphs.
Definition graph.hpp:68
uint64_t get_num_edges() const noexcept
Returns the number of edges.
Definition graph.hpp:211
uint64_t get_num_nodes() const noexcept
Returns the number of ndoes.
Definition graph.hpp:207
graph() noexcept
Empty constructor.
Definition graph.hpp:73
bool has_node(const node u) const noexcept
Returns true if node u is in this graph.
Definition graph.hpp:201
Tree graph class.
Definition tree.hpp:73
void tree_only_remove_node(const node u) noexcept
Removes a vertex from the union-find data structure.
tree & operator=(const tree &t) noexcept
Copy assignment operator.
Definition tree.hpp:104
bool is_of_tree_type(const tree_type &tt) const noexcept
Returns whether this tree is of type tt.
Definition tree.hpp:280
std::vector< uint64_t > m_union_find__root_size
The size of the connected component that a root belongs to.
Definition tree.hpp:322
virtual void update_union_find_after_remove_edges_bulk(uint64_t *const root_of, uint64_t *const root_size) const noexcept=0
Update the union find data structure after the removal of several edges.
tree(const tree &t) noexcept
Copy constructor.
Definition tree.hpp:83
uint64_t get_component_representative(const node u) const noexcept
Representative node of the connected component in which u belongs.
Definition tree.hpp:237
virtual bool is_rooted() const noexcept=0
Returns whether this tree is a rooted tree.
virtual void update_union_find_after_add_edges(const edge_list &edges, uint64_t *const root_of, uint64_t *const root_size) const noexcept=0
Update the union find data structure after the addition of a set of edges.
bool is_tree() const noexcept
Is this graph an actual tree?
Definition tree.hpp:177
tree() noexcept
Empty constructor.
Definition tree.hpp:78
void tree_only_invalidate() noexcept
Invalidates the aggregated information of the tree.
Definition tree.hpp:395
virtual bool can_add_edge(node const s, const node t) const noexcept
Can this edge be added?
void tree_only_copy(const tree &t) noexcept
Copies only members of class tree.
Definition tree.hpp:359
void tree_only_actions_after_remove_edges_bulk_complete() noexcept
Do some work after the removal of several edges in bulk.
void fill_union_find() noexcept
Definition tree.hpp:507
void tree_only_move(tree &&t) noexcept
Moves only members of class tree.
Definition tree.hpp:367
virtual ~tree() noexcept
Destructor.
Definition tree.hpp:96
uint64_t get_num_nodes_component(const node u) const noexcept
Amount of nodes in a connected component of the tree.
Definition tree.hpp:266
void tree_only_actions_after_add_edges_bulk_complete() noexcept
Do some work after the addition of several edges in bulk.
void tree_only_actions_after_remove_edges(const edge_list &e) noexcept
Do some work after the removal of several edges.
void empty_union_find() noexcept
Empties the Union-Find data structure assuming that the tree has no edges.
Definition tree.hpp:518
void tree_only_add_node() noexcept
Adds a node to this tree.
Definition tree.hpp:382
bool are_nodes_in_same_component(const node u, const node v) const noexcept
Checks if two nodes are in the same connected component.
Definition tree.hpp:250
virtual bool can_add_edges(const std::vector< edge > &edges) const noexcept
Can these edges be added?
void tree_only_actions_before_remove_edges_incident_to(const node u) noexcept
Do some work before the removal of all edges incident to a vertex.
void tree_only_actions_after_remove_edge(const node u, const node v) noexcept
Do some work after the removal of an edge.
bool m_is_tree_type_valid
Is the type of this tree valid?
Definition tree.hpp:333
void tree_only_init(const uint64_t n) noexcept
Initializes only the memory of class tree.
Definition tree.hpp:340
void tree_only_actions_after_remove_edges_bulk() noexcept
Do some work after the removal of several edges in bulk.
virtual void update_union_find_before_remove_incident_edges_to(const node u, uint64_t *const root_of, uint64_t *const root_size) const noexcept=0
Update the union find data structure before the removal of all edges incident to a node.
bool is_tree_type_valid() const noexcept
Is the type of this tree valid?
Definition tree.hpp:302
void tree_only_actions_after_add_edges(const edge_list &e) noexcept
Do some work after the addition of several edges.
virtual void calculate_tree_type() noexcept=0
Calculates the type of tree.
void tree_only_actions_after_add_edge(const node u, const node v) noexcept
Do some work after the addition of an edge.
virtual void finish_bulk_add_complete(const bool norm=true, const bool check=true) noexcept=0
Completes the inner structure of the tree after adding edges in bulk.
void tree_only_actions_after_remove_node(const node u) noexcept
Do some work before the removal of a vertex.
std::vector< node > m_union_find__root_of
The root of every vertex in the union-find data structure.
Definition tree.hpp:312
std::array< bool, __tree_type_size > m_tree_type
The type of this tree.
Definition tree.hpp:325
tree(tree &&t) noexcept
Move constructor.
Definition tree.hpp:91
void tree_only_actions_after_add_edges_bulk() noexcept
Do some work after the addition of several edges in bulk.
virtual void update_union_find_after_remove_edge(const node u, const node v, uint64_t *const root_of, uint64_t *const root_size) const noexcept=0
Update the union find data structure after an edge removal.
void tree_only_clear() noexcept
Clears the memory used by only class tree.
Definition tree.hpp:351
virtual void update_union_find_after_add_edge(const node u, const node v, uint64_t *const root_of, uint64_t *const root_size) const noexcept=0
Update the union find data structure after an edge addition.
virtual void update_union_find_after_add_edges_bulk(uint64_t *const root_of, uint64_t *const root_size) const noexcept=0
Update the union find data structure after the addition of several edges.
std::vector< std::string > get_tree_type_list() const noexcept
Returns the list of types as a list of strings.
virtual void update_union_find_after_remove_edges(const edge_list &edges, uint64_t *const root_of, uint64_t *const root_size) const noexcept=0
Update the union find data structure after the removal of a set of edges.
virtual void finish_bulk_remove_complete(const bool norm=true, const bool check=true) noexcept=0
Completes the inner structure of the tree after removing edges in bulk.
void tree_only_set_edges() noexcept
Updates the data structures of a tree after the graph structure has had its set of edges set.
constexpr std::size_t __tree_type_size
Number of elements within enumeration lal::graphs::tree_type.
Definition tree_type.hpp:149
tree_type
Enumeration of several types of trees.
Definition tree_type.hpp:57
Main namespace of the library.
Definition basic_types.hpp:48
std::pair< node, node > edge
See Edge page for further details.
Definition basic_types.hpp:56
std::vector< edge > edge_list
See Edge list page for further details.
Definition basic_types.hpp:60
uint64_t node
Node type. See Node / Vertex page for further details.
Definition basic_types.hpp:51