51#include <lal/detail/array.hpp>
52#include <lal/basic_types.hpp>
64template <
class graph_t>
70 typedef typename std::vector<graph_t>::iterator
iterator;
75 [[nodiscard]] graph_t&
operator[] (
const std::size_t i)
noexcept {
83 [[nodiscard]]
const graph_t&
operator[] (
const std::size_t i)
const noexcept {
97 void init(
const std::size_t n)
noexcept {
104 const auto n = g.get_num_nodes();
110 const auto n = g.get_num_nodes();
140 const std::size_t cc_idx,
142 const std::size_t label
152 [[nodiscard]] std::size_t
size() const noexcept {
183 (
const std::size_t cc_idx,
const node u)
The connected components of a graph.
Definition connected_components.hpp:65
void set_label_graph_node_to_cc_node(const node u, const std::size_t label) noexcept
Relates vertex u to the corresponding vertex within its connected component.
Definition connected_components.hpp:129
std::size_t get_cc_node(const node u) const noexcept
Returns the label of the connected component u belongs to.
Definition connected_components.hpp:162
const_iterator begin() const noexcept
A pointer to the beginning of the sequence of connected components.
Definition connected_components.hpp:190
const_iterator end() const noexcept
A pointer to the end of the sequence of connected components.
Definition connected_components.hpp:197
std::vector< graph_t >::iterator iterator
Useful typedef for non-constant iterators.
Definition connected_components.hpp:70
std::size_t get_label_cc_node_to_graph_node(const std::size_t cc_idx, const node u) const noexcept
The corresponding vertex within its connected component.
Definition connected_components.hpp:183
detail::array< std::size_t > m__graph_node__to__cc_node
Definition connected_components.hpp:212
void add_graph(graph_t &&g) noexcept
Add a graph to the list of connected components.
Definition connected_components.hpp:103
void init(const std::size_t n) noexcept
Initializes this object.
Definition connected_components.hpp:97
std::size_t size() const noexcept
Returns the number of connected components.
Definition connected_components.hpp:152
detail::array< std::size_t > m_node_to_cc
The label of the connected component a vertex belongs to.
Definition connected_components.hpp:215
void add_graph(const graph_t &g) noexcept
Add a graph to the list of connected components.
Definition connected_components.hpp:109
std::vector< graph_t >::const_iterator const_iterator
Useful typedef for constant iterators.
Definition connected_components.hpp:68
std::vector< graph_t > m_connected_components
The connected components of the graph.
Definition connected_components.hpp:205
iterator end() noexcept
A pointer to the end of the sequence of connected components.
Definition connected_components.hpp:200
std::vector< detail::array< std::size_t > > m__cc_node__to__graph_node
Definition connected_components.hpp:209
void set_label_cc_node_to_graph_node(const std::size_t cc_idx, const node u, const std::size_t label) noexcept
Relates vertex u to the corresponding vertex within its connected component.
Definition connected_components.hpp:139
graph_t & operator[](const std::size_t i) noexcept
Access operator.
Definition connected_components.hpp:75
iterator begin() noexcept
A pointer to the beginning of the sequence of connected components.
Definition connected_components.hpp:193
std::size_t get_label_graph_node_to_cc_node(const node u) const noexcept
The corresponding vertex within its connected component.
Definition connected_components.hpp:171
void set_node_cc(const node u, const std::size_t label) noexcept
Relates vertex u to the label of its connected component.
Definition connected_components.hpp:120
Main namespace of the library.
Definition basic_types.hpp:48
uint64_t node
Node type. See Node / Vertex page for further details.
Definition basic_types.hpp:51
Wrapper of a C array for automatic deallocation of memory.
Definition array.hpp:59
void resize(const std::size_t new_size) noexcept
Resize the array.
Definition array.hpp:187