48#include <lal/basic_types.hpp>
79 graph(
const uint64_t n)
noexcept {
130 virtual void init(
const uint64_t n)
noexcept;
169 virtual
void finish_bulk_add(const
bool norm = true, const
bool check = true) noexcept = 0;
198 [[nodiscard]]
virtual std::vector<edge_pair>
get_Q() const noexcept = 0;
214 [[nodiscard]]
virtual std::vector<edge>
get_edges() const noexcept = 0;
255 virtual
void _init(const uint64_t n) noexcept {
280 g.m_is_normalized =
false;
Abstract class for graphs.
Definition graph.hpp:68
uint64_t m_num_edges
Amount of edges of this graph.
Definition graph.hpp:234
virtual bool check_normalized() noexcept
Checks if the graph is normalized.
virtual void init(const uint64_t n) noexcept
Allocates the necessary memory for this class.
void copy_full_graph(const graph &g) noexcept
Copies all members of this class.
Definition graph.hpp:268
virtual ~graph() noexcept
Destructor.
Definition graph.hpp:100
void __disjoint_union(const graph &g) noexcept
Disjoint union of graphs.
void normalize_after_edge_removal(const bool norm, const bool check) noexcept
Normalize the graph after one (or more) edges have been removed.
uint64_t get_num_edges() const noexcept
Returns the number of edges.
Definition graph.hpp:211
graph(const graph &g) noexcept
Copy constructor.
Definition graph.hpp:87
virtual void finish_bulk_remove(const bool norm=true, const bool check=true) noexcept=0
Completes the inner structure of the graph after removing edges in bulk.
bool m_is_normalized
Is this graph normalized?
Definition graph.hpp:247
virtual bool is_directed() const noexcept=0
Returns whether this graph is directed or not.
graph & operator=(const graph &g) noexcept
Copy assignment operator.
Definition graph.hpp:108
uint64_t get_num_nodes() const noexcept
Returns the number of ndoes.
Definition graph.hpp:207
void normalize_after_edge_addition(const bool norm, const bool check) noexcept
Normalize the graph after one (or more) edges have been added.
virtual void _clear() noexcept
Clears memory for the graph class.
Definition graph.hpp:261
virtual bool is_undirected() const noexcept=0
Returns whether this graph is undirected or not.
virtual void actions_after_add_edge(const node u, const node v) noexcept
Do some extra work after the addition of an edge.
graph() noexcept
Empty constructor.
Definition graph.hpp:73
virtual void actions_after_add_edges_bulk() noexcept
Do some extra work after the addition of several edges in bulk.
graph(graph &&g) noexcept
Move constructor.
Definition graph.hpp:95
virtual std::vector< edge_pair > get_Q() const noexcept=0
Returns all independent pairs of edges of this graph.
virtual void actions_after_remove_edges(const edge_list &e) noexcept
Do some extra work after the removal of several edges.
virtual void actions_after_remove_edge(const node u, const node v) noexcept
Do some extra work after the removal of an edge.
virtual void actions_before_remove_edges_incident_to(const node u) noexcept
Do some work before all edges incident to a node is removed.
bool has_node(const node u) const noexcept
Returns true if node u is in this graph.
Definition graph.hpp:201
virtual void _init(const uint64_t n) noexcept
Initializes memory of graph class.
Definition graph.hpp:255
bool is_normalized() const noexcept
Returns whether this graph is normalized or not.
Definition graph.hpp:223
void set_normalized(const bool v=true) noexcept
Sets whether this graph is normalized or not.
Definition graph.hpp:185
virtual void normalize() noexcept
Normalizes the graph.
virtual void actions_after_add_edges(const edge_list &e) noexcept
Do some extra work after the addition of several edges.
virtual bool has_edge(const node u, const node v) const =0
Returns true if the undirected edge (u, v) exists in the graph.
void move_full_graph(graph &&g) noexcept
Moves all members of this class.
Definition graph.hpp:274
virtual void actions_after_remove_node(const node u) noexcept
Do some work before the removal of a vertex.
std::vector< neighbourhood > m_adjacency_list
Data structure that implements the graph.
Definition graph.hpp:232
void __add_node() noexcept
Adds a node to the graph.
Definition graph.hpp:284
virtual std::vector< edge > get_edges() const noexcept=0
Returns all edges of this graph.
virtual void finish_bulk_add(const bool norm=true, const bool check=true) noexcept=0
Completes the inner structure of the graph after adding a bulk of edges.
virtual void actions_after_remove_edges_bulk() noexcept
Do some extra work after the removal of several edges in bulk.
graph(const uint64_t n) noexcept
Constructor with number of nodes.
Definition graph.hpp:79
virtual void clear() noexcept
Frees the memory occupied by this graph.
Main namespace of the library.
Definition basic_types.hpp:48
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
std::vector< node > neighbourhood
List of nodes.
Definition basic_types.hpp:64