51#include <lal/graphs/directed_graph.hpp>
52#include <lal/graphs/tree.hpp>
53#include <lal/graphs/free_tree.hpp>
188 (
node s,
node t,
bool norm =
true,
bool check_norm =
true) noexcept;
236 (const std::vector<
edge>& edges,
bool norm = true,
bool check_norm = true)
273 (const std::vector<
edge>& edges,
bool norm = true,
bool check_norm = true)
296 (
node s,
node t,
bool norm = false,
bool check_norm = true) noexcept;
322 (const std::vector<
edge>& edges,
bool norm = true,
bool check_norm = true)
345 (
node u,
bool norm = true,
bool check_norm = true)
571 (
bool norm = true,
bool check = true) const noexcept;
636 virtual
void _init(uint32_t n) noexcept;
643 uint32_t * const root_of,
644 uint32_t * const root_size
648 uint32_t * const root_of,
649 uint32_t * const root_size
653 uint32_t * const root_of,
654 uint32_t * const root_size
658 uint32_t * const root_of,
659 uint32_t * const root_size
Directed graph class.
Definition directed_graph.hpp:68
directed_graph() noexcept
Empty constructor.
Definition directed_graph.hpp:73
Free tree graph class.
Definition free_tree.hpp:59
bool has_node(node u) const noexcept
Returns true if node u is in this graph.
Definition graph.hpp:188
graph() noexcept
Empty constructor.
Definition graph.hpp:74
Rooted tree graph class.
Definition rooted_tree.hpp:107
bool find_edge_orientation() noexcept
Finds the orientation of the edges.
rooted_tree(rooted_tree &&r) noexcept
Move constructor.
Definition rooted_tree.hpp:132
virtual rooted_tree & remove_edges_incident_to(node u, bool norm=true, bool check_norm=true) noexcept
Remove all edges incident to a given vertex.
bool m_has_root
Has the root been set?
Definition rooted_tree.hpp:618
void copy_full_rooted_tree(const rooted_tree &r) noexcept
Copies all members of this class and the parent class.
rooted_tree & add_edge_bulk(node s, node t) noexcept
Adds an edge to the graph.
rooted_tree(uint32_t n) noexcept
Constructor with number of nodes and root node.
Definition rooted_tree.hpp:117
bool is_orientation_valid() const noexcept
Is the orientation of the edges valid?
Definition rooted_tree.hpp:482
void disjoint_union(const rooted_tree &t, bool connect_roots=true) noexcept
Disjoint union of trees.
void set_valid_orientation(bool valid) noexcept
Sets wether the type of the rooted tree is valid or not.
Definition rooted_tree.hpp:411
node m_root
Root of the tree.
Definition rooted_tree.hpp:616
rooted_tree & operator=(const rooted_tree &r) noexcept
Copy assignment operator.
Definition rooted_tree.hpp:150
rooted_tree get_subtree(node u) const noexcept
Retrieve the subtree rooted at node u.
head_vector get_head_vector() const noexcept
Converts a rooted tree into a head vector.
rooted_tree & add_edge(node s, node t, bool norm=true, bool check_norm=true) noexcept
Adds an edge to the tree.
void call_union_find_after_add(node u, node v, uint32_t *const root_of, uint32_t *const root_size) noexcept
A call to the union find method.
virtual ~rooted_tree() noexcept
Destructor.
Definition rooted_tree.hpp:141
void calculate_size_subtrees() noexcept
Calculates the number of nodes at every rooted subtree.
void set_root(node r) noexcept
Set the root of this tree.
bool m_valid_orientation
Is the orientation of the edges valid?
Definition rooted_tree.hpp:621
void init_rooted(const free_tree &t, node r) noexcept
Initialiser with tree and root node.
rooted_tree & set_edges(const std::vector< edge > &edges, bool norm=true, bool check_norm=true) noexcept
Sets the edges to the graph.
rooted_tree & remove_edge(node s, node t, bool norm=false, bool check_norm=true) noexcept
Remove an edge from this graph.
rooted_tree & add_edges(const std::vector< edge > &edges, bool norm=true, bool check_norm=true) noexcept
Adds a list of edges to the graph.
std::vector< edge > get_edges_subtree(node u, bool relab=false) const noexcept
Retrieve the edges of the subtree rooted at u.
std::vector< uint32_t > m_size_subtrees
Number of nodes of the subtrees rooted at a certain node.
Definition rooted_tree.hpp:629
rooted_tree & remove_edges(const std::vector< edge > &edges, bool norm=true, bool check_norm=true) noexcept
Remove an edge from this graph.
bool has_root() const noexcept
Definition rooted_tree.hpp:493
node get_root() const noexcept
Return the root of this tree.
Definition rooted_tree.hpp:485
bool is_rooted() const noexcept
Returns whether this tree is a rooted tree.
Definition rooted_tree.hpp:457
uint32_t get_num_nodes_subtree(node u) const noexcept
Get the size of a subtree rooted at a given node.
Definition rooted_tree.hpp:501
rooted_tree(const rooted_tree &r) noexcept
Copy constructor.
Definition rooted_tree.hpp:124
void call_union_find_after_remove(node u, node v, uint32_t *const root_of, uint32_t *const root_size) noexcept
A call to the union find method.
void calculate_tree_type() noexcept
Calculates the type of tree.
virtual void _init(uint32_t n) noexcept
rooted_tree() noexcept
Empty constructor.
Definition rooted_tree.hpp:112
void finish_bulk_add(bool norm=true, bool check=true) noexcept
Finishes adding edges in bulk.
virtual void _clear() noexcept
void move_full_rooted_tree(rooted_tree &&r) noexcept
Moves all members of this class and the parent class.
bool are_size_subtrees_valid() const noexcept
Is a recalculation of the subtree's sizes needed?
Definition rooted_tree.hpp:518
free_tree to_free_tree(bool norm=true, bool check=true) const noexcept
Converts this rooted tree into a free tree (see free_tree).
rooted_tree(const free_tree &t, node r) noexcept
Constructor with tree and root node.
Definition rooted_tree.hpp:137
bool is_rooted_tree() const noexcept
Is this tree a valid rooted tree?
Definition rooted_tree.hpp:470
bool m_are_size_subtrees_valid
Are the contents of m_size_subtrees valid?
Definition rooted_tree.hpp:631
Tree graph class.
Definition tree.hpp:73
bool is_tree() const noexcept
Is this graph is an actual tree?
Definition tree.hpp:145
tree() noexcept
Empty constructor.
Definition tree.hpp:78
Main namespace of the library.
Definition definitions.hpp:48
std::pair< node, node > edge
Edge type.
Definition definitions.hpp:75
uint32_t node
Node type.
Definition definitions.hpp:51
std::vector< uint32_t > head_vector
A head vector representation of a (usually) rooted tree.
Definition definitions.hpp:114