51#include <lal/linear_arrangement.hpp>
52#include <lal/graphs/directed_graph.hpp>
53#include <lal/graphs/tree.hpp>
54#include <lal/graphs/free_tree.hpp>
177 (
node u,
bool connect =
false,
bool norm =
true,
bool check_norm =
true) noexcept;
201 (
node s,
node t,
bool norm = true,
bool check_norm = true) noexcept;
249 (const std::vector<
edge>& edges,
bool norm = true,
bool check_norm = true)
285 (const std::vector<
edge>& edges,
bool norm = true,
bool check_norm = true)
305 (
node s,
node t,
bool norm = false,
bool check_norm = true) noexcept;
328 (const std::vector<
edge>& edges,
bool norm = true,
bool check_norm = true)
351 (
node u,
bool norm = true,
bool check_norm = true)
555 (
bool norm = true,
bool check = true) const noexcept;
599 virtual void _init(uint64_t n)
noexcept {
617 uint64_t *
const root_of,
618 uint64_t *
const root_size
622 uint64_t *
const root_of,
623 uint64_t *
const root_size
628 uint64_t *
const root_of,
629 uint64_t *
const root_size
633 uint64_t *
const root_of,
634 uint64_t *
const root_size
639 uint64_t *
const root_of, uint64_t *
const root_size
643 uint64_t *
const root_of, uint64_t *
const root_size
675 r.m_has_root =
false;
676 r.m_are_size_subtrees_valid =
false;
Directed graph class.
Definition: directed_graph.hpp:68
void move_full_directed_graph(directed_graph &&d) noexcept
Moves all members of this class and the parent class.
Definition: directed_graph.hpp:416
directed_graph() noexcept
Empty constructor.
Definition: directed_graph.hpp:73
void copy_full_directed_graph(const directed_graph &d) noexcept
Copies all members of this class and the parent class.
Definition: directed_graph.hpp:408
virtual void _init(uint64_t n) noexcept
Initialises memory of directed_graph and graph classes.
Definition: directed_graph.hpp:397
void disjoint_union(const directed_graph &g) noexcept
Disjoint union of graphs.
virtual directed_graph & remove_node(node u, bool norm=true, bool check_norm=true) noexcept
Remove a node from this graph.
virtual void _clear() noexcept
Clears the memory of directed_graph and graph classes.
Definition: directed_graph.hpp:402
uint64_t get_in_degree(node u) const noexcept
Returns the in-degree of a node.
Definition: directed_graph.hpp:365
Free tree graph class.
Definition: free_tree.hpp:60
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_nodes() const noexcept
Returns the number of ndoes.
Definition: graph.hpp:198
Rooted tree graph class.
Definition: rooted_tree.hpp:103
rooted_tree(rooted_tree &&r) noexcept
Move constructor.
Definition: rooted_tree.hpp:128
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:584
void copy_full_rooted_tree(const rooted_tree &r) noexcept
Copies all members of this class and the parent class.
Definition: rooted_tree.hpp:647
rooted_tree & add_edge_bulk(node s, node t) noexcept
Adds an edge to the graph.
void disjoint_union(const rooted_tree &t, bool connect_roots=true) noexcept
Disjoint union of trees.
void update_union_find_after_edge_add(node u, node v, uint64_t *const root_of, uint64_t *const root_size) noexcept
Update the union find data structure after an edge addition.
head_vector get_head_vector(const linear_arrangement &arr={}) const noexcept
Converts a rooted tree into a head vector.
node m_root
Root of the tree.
Definition: rooted_tree.hpp:582
rooted_tree & operator=(const rooted_tree &r) noexcept
Copy assignment operator.
Definition: rooted_tree.hpp:145
rooted_tree get_subtree(node u) const noexcept
Retrieve the subtree rooted at node u.
rooted_tree & add_edge(node s, node t, bool norm=true, bool check_norm=true) noexcept
Adds an edge to the tree.
rooted_tree & remove_node(node u, bool connect=false, bool norm=true, bool check_norm=true) noexcept
Remove a node from this tree.
virtual void _init(uint64_t n) noexcept
Definition: rooted_tree.hpp:599
virtual ~rooted_tree() noexcept
Destructor.
Definition: rooted_tree.hpp:137
void calculate_size_subtrees() noexcept
Calculates the number of nodes at every rooted subtree.
void update_union_find_after_edge_remove(node u, node v, uint64_t *const root_of, uint64_t *const root_size) const noexcept
Update the union find data structure after an edge removal.
void set_root(node r) noexcept
Set the root of this tree.
Definition: rooted_tree.hpp:419
void init_rooted(const free_tree &t, node r) noexcept
Initialiser with tree and root node.
rooted_tree(uint64_t n) noexcept
Constructor with number of nodes and root node.
Definition: rooted_tree.hpp:113
rooted_tree & set_edges(const std::vector< edge > &edges, bool norm=true, bool check_norm=true) noexcept
Sets the edges to the graph.
bool can_add_edge(node s, node t) const noexcept
Can this edge be added?
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.
void update_union_find_after_edge_add(node u, node v, uint64_t *const root_of, uint64_t *const root_size) const noexcept
Update the union find data structure after an edge addition.
bool is_root_valid(node r) const noexcept
Is the root valid?
Definition: rooted_tree.hpp:445
void update_union_find_before_incident_edges_removed(node u, uint64_t *const root_of, uint64_t *const root_size) const noexcept
Update the union find data structure before the removal of all edges incident to a node.
std::vector< edge > get_edges_subtree(node u, bool relab=false) const noexcept
Retrieve the edges of the subtree rooted at u.
std::vector< uint64_t > m_size_subtrees
Number of nodes of the subtrees rooted at a certain node.
Definition: rooted_tree.hpp:592
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:479
node get_root() const noexcept
Return the root of this tree.
Definition: rooted_tree.hpp:471
bool is_rooted() const noexcept
Returns whether this tree is a rooted tree.
Definition: rooted_tree.hpp:456
rooted_tree(const rooted_tree &r) noexcept
Copy constructor.
Definition: rooted_tree.hpp:120
bool subtree_contains_node(node r, node u) const noexcept
Does the subtree rooted at r contain node u?
void calculate_tree_type() noexcept
Calculates the type of tree.
rooted_tree() noexcept
Empty constructor.
Definition: rooted_tree.hpp:108
void finish_bulk_add(bool norm=true, bool check=true) noexcept
Finishes adding edges in bulk.
void update_union_find_after_edge_remove(node u, node v, uint64_t *const root_of, uint64_t *const root_size) noexcept
Update the union find data structure after an edge removal.
bool can_add_edges(const std::vector< edge > &edges) const noexcept
Can these edges be added?
void update_union_find_before_incident_edges_removed(node u, uint64_t *const root_of, uint64_t *const root_size) noexcept
Update the union find data structure before the removal of all edges incident to a node.
uint64_t get_num_nodes_subtree(node u) const noexcept
Get the size of a subtree rooted at a given node.
Definition: rooted_tree.hpp:487
virtual void _clear() noexcept
Definition: rooted_tree.hpp:609
void move_full_rooted_tree(rooted_tree &&r) noexcept
Moves all members of this class and the parent class.
Definition: rooted_tree.hpp:661
bool are_size_subtrees_valid() const noexcept
Is a recalculation of the subtree's sizes needed?
Definition: rooted_tree.hpp:505
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:133
bool is_rooted_tree() const noexcept
Is this tree a valid rooted tree?
Definition: rooted_tree.hpp:468
bool m_are_size_subtrees_valid
Are the contents of m_size_subtrees valid?
Definition: rooted_tree.hpp:594
Tree graph class.
Definition: tree.hpp:73
bool is_tree() const noexcept
Is this graph is an actual tree?
Definition: tree.hpp:143
tree() noexcept
Empty constructor.
Definition: tree.hpp:78
void tree_only_copy(const tree &t) noexcept
Copies only members of class tree.
Definition: tree.hpp:327
void tree_only_move(tree &&t) noexcept
Moves only members of class tree.
Definition: tree.hpp:335
void tree_only_init(uint64_t n) noexcept
Initialises only the memory of class tree.
Definition: tree.hpp:306
bool m_is_tree_type_valid
Is the type of this tree valid?
Definition: tree.hpp:299
void tree_only_clear() noexcept
Clears the memory used by only class tree.
Definition: tree.hpp:318
Linear arrangement of vertices.
Definition: linear_arrangement.hpp:103
Main namespace of the library.
Definition: basic_types.hpp:50
std::vector< uint64_t > head_vector
See Head vector page for further details.
Definition: basic_types.hpp:64
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