53#include <lal/graphs/graph.hpp>
54#include <lal/graphs/tree_type.hpp>
309 for (
node u = 0; u < n; ++u) {
342 t.m_is_tree_type_valid =
false;
418 uint64_t *
const root_of, uint64_t *
const root_size
435 uint64_t *
const root_of, uint64_t *
const root_size
436 )
const noexcept = 0;
453 uint64_t *
const root_of, uint64_t *
const root_size
470 uint64_t *
const root_of, uint64_t *
const root_size
471 )
const noexcept = 0;
488 uint64_t *
const root_of, uint64_t *
const root_size
505 uint64_t *
const root_of, uint64_t *
const root_size
506 )
const noexcept = 0;
Abstract class for graphs.
Definition: graph.hpp:69
bool has_node(node u) const noexcept
Returns true if node u is in this graph.
Definition: graph.hpp:192
uint64_t get_num_edges() const noexcept
Returns the number of edges.
Definition: graph.hpp:202
uint64_t get_num_nodes() const noexcept
Returns the number of ndoes.
Definition: graph.hpp:198
graph() noexcept
Empty constructor.
Definition: graph.hpp:74
Tree graph class.
Definition: tree.hpp:73
tree & operator=(const tree &t) noexcept
Copy assignment operator.
Definition: tree.hpp:104
void actions_after_remove_node(node u) noexcept
Do some work before an node is removed.
bool is_of_tree_type(const tree_type &tt) const noexcept
Returns whether this tree is of type tt.
Definition: tree.hpp:246
tree(const tree &t) noexcept
Copy constructor.
Definition: tree.hpp:83
virtual bool is_rooted() const noexcept=0
Returns whether this tree is a rooted tree.
bool is_tree() const noexcept
Is this graph is an actual tree?
Definition: tree.hpp:143
virtual void update_union_find_before_incident_edges_removed(node u, uint64_t *const root_of, uint64_t *const root_size) noexcept=0
Update the union find data structure before the removal of all edges incident to a node.
tree() noexcept
Empty constructor.
Definition: tree.hpp:78
virtual void update_union_find_after_edge_add(node u, 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.
uint64_t get_component_representative(node u) const noexcept
Representative node of the connected component in which u belongs.
Definition: tree.hpp:203
void tree_only_copy(const tree &t) noexcept
Copies only members of class tree.
Definition: tree.hpp:327
void actions_after_add_edge(node u, node v) noexcept
Do some work after the addition of an edge.
void fill_union_find() noexcept
Definition: tree.hpp:394
void tree_only_move(tree &&t) noexcept
Moves only members of class tree.
Definition: tree.hpp:335
virtual ~tree() noexcept
Destructor.
Definition: tree.hpp:96
std::vector< node > m_root_of
The root of every vertex in the union-find data structure.
Definition: tree.hpp:278
virtual void update_union_find_after_edge_add(node u, node v, uint64_t *const root_of, uint64_t *const root_size) noexcept=0
Update the union find data structure after an edge addition.
uint64_t get_num_nodes_component(node u) const noexcept
Amount of nodes in a connected component of the tree.
Definition: tree.hpp:232
void actions_after_remove_edge(node u, node v) noexcept
Do some work after the removal of an edge.
virtual bool can_add_edges(const std::vector< edge > &edges) const noexcept
Can these edges be added?
void tree_only_init(uint64_t n) noexcept
Initialises only the memory of class tree.
Definition: tree.hpp:306
void actions_before_remove_edges_incident_to(node u) noexcept
Do some work before all edges incident to a node is removed.
bool m_is_tree_type_valid
Is the type of this tree valid?
Definition: tree.hpp:299
virtual bool can_add_edge(node s, node t) const noexcept
Can this edge be added?
bool is_tree_type_valid() const noexcept
Is the type of this tree valid?
Definition: tree.hpp:268
virtual void update_union_find_before_incident_edges_removed(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.
virtual void calculate_tree_type() noexcept=0
Calculates the type of tree.
virtual void update_union_find_after_edge_remove(node u, 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.
bool are_nodes_in_same_component(node u, node v) const noexcept
Checks if two nodes are in the same connected component.
Definition: tree.hpp:216
void tree_only_remove_node(node u) noexcept
Removes a vertex from the union-find data structure.
std::array< bool, __tree_type_size > m_tree_type
The type of this tree.
Definition: tree.hpp:291
tree(tree &&t) noexcept
Move constructor.
Definition: tree.hpp:91
std::vector< uint64_t > m_root_size
The size of the connected component that a root belongs to.
Definition: tree.hpp:288
void tree_only_clear() noexcept
Clears the memory used by only class tree.
Definition: tree.hpp:318
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_edge_remove(node u, node v, uint64_t *const root_of, uint64_t *const root_size) noexcept=0
Update the union find data structure after an edge removal.
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:92
tree_type
Enumeration of several types of trees.
Definition: tree_type.hpp:57
@ unknown
The tree could not be classified.
Main namespace of the library.
Definition: basic_types.hpp:50
std::pair< node, node > edge
See Edge page for further details.
Definition: basic_types.hpp:58
uint64_t node
Node type. See Node / Vertex page for further details.
Definition: basic_types.hpp:53