-
-
-
-
309 if constexpr(std::is_same_v<graph_category, undirected_tag>) {
-
-
311 ENTT_ASSERT(matrix[
pos] == matrix[
rev],
"Something went really wrong");
-
-
-
-
315 return std::exchange(matrix[
pos], 0
u);
-
+
+
+
+
293 const auto pos = lhs * vert + rhs;
+
+
295 if constexpr(std::is_same_v<graph_category, undirected_tag>) {
+
296 const auto rev = rhs * vert + lhs;
+
297 ENTT_ASSERT(matrix[pos] == matrix[rev],
"Something went really wrong");
+
+
+
+
301 const auto inserted = !std::exchange(matrix[pos], 1u);
+
302 return {
edge_iterator{matrix.cbegin(), vert, pos, matrix.size(), 1u}, inserted};
+
-
-
-
-
-
326 return pos < matrix.size() && matrix[
pos];
-
+
+
+
+
312 const auto pos = lhs * vert + rhs;
+
+
314 if constexpr(std::is_same_v<graph_category, undirected_tag>) {
+
315 const auto rev = rhs * vert + lhs;
+
316 ENTT_ASSERT(matrix[pos] == matrix[rev],
"Something went really wrong");
+
+
+
+
320 return std::exchange(matrix[pos], 0u);
+
-
-
-
330 container_type matrix;
-
-
+
+
+
+
330 const auto pos = lhs * vert + rhs;
+
331 return pos < matrix.size() && matrix[pos];
+
-
-
-
-
Basic implementation of a directed adjacency matrix.
-
std::pair< edge_iterator, bool > insert(const vertex_type lhs, const vertex_type rhs)
Inserts an edge into the adjacency matrix, if it does not exist.
+
+
335 container_type matrix;
+
+
+
+
+
+
+
+
Basic implementation of a directed adjacency matrix.
+
std::pair< edge_iterator, bool > insert(const vertex_type lhs, const vertex_type rhs)
Inserts an edge into the adjacency matrix, if it does not exist.
adjacency_matrix(const adjacency_matrix &)=default
Default copy constructor.
-
adjacency_matrix() noexcept(noexcept(allocator_type{}))
Default constructor.
-
Category graph_category
Graph category tag.
-
bool empty() const noexcept
Returns true if an adjacency matrix is empty, false otherwise.
-
iterable_adaptor< out_edge_iterator > out_edges(const vertex_type vertex) const noexcept
Returns an iterable object to visit all out-edges of a vertex.
-
internal::edge_iterator< typename container_type::const_iterator > edge_iterator
Edge iterator type.
-
void swap(adjacency_matrix &other) noexcept
Exchanges the contents with those of a given adjacency matrix.
-
size_type size() const noexcept
Returns the number of vertices.
-
std::size_t size_type
Unsigned integer type.
-
Allocator allocator_type
Allocator type.
+
iota_iterator< vertex_type > vertex_iterator
Vertex iterator type.
+
adjacency_matrix() noexcept(noexcept(allocator_type{}))
Default constructor.
+
Category graph_category
Graph category tag.
+
bool empty() const noexcept
Returns true if an adjacency matrix is empty, false otherwise.
+
iterable_adaptor< out_edge_iterator > out_edges(const vertex_type vertex) const noexcept
Returns an iterable object to visit all out-edges of a vertex.
+
internal::edge_iterator< typename container_type::const_iterator > edge_iterator
Edge iterator type.
+
void swap(adjacency_matrix &other) noexcept
+
size_type size() const noexcept
Returns the number of vertices.
+
std::size_t size_type
Unsigned integer type.
+
Allocator allocator_type
Allocator type.
adjacency_matrix & operator=(adjacency_matrix &&) noexcept=default
Default move assignment operator.
-
bool contains(const vertex_type lhs, const vertex_type rhs) const
Checks if an adjacency matrix contains a given edge.
-
void clear() noexcept
Clears the adjacency matrix.
-
adjacency_matrix(const size_type vertices, const allocator_type &allocator=allocator_type{})
Constructs an empty container with a given allocator and user supplied number of vertices.
-
edge_iterator out_edge_iterator
Out-edge iterator type.
-
iterable_adaptor< in_edge_iterator > in_edges(const vertex_type vertex) const noexcept
Returns an iterable object to visit all in-edges of a vertex.
-
std::pair< vertex_type, vertex_type > edge_type
Edge type.
+
bool contains(const vertex_type lhs, const vertex_type rhs) const
Checks if an adjacency matrix contains a given edge.
+
void clear() noexcept
Clears the adjacency matrix.
+
adjacency_matrix(const size_type vertices, const allocator_type &allocator=allocator_type{})
Constructs an empty container with a given allocator and user supplied number of vertices.
+
edge_iterator out_edge_iterator
Out-edge iterator type.
+
iterable_adaptor< in_edge_iterator > in_edges(const vertex_type vertex) const noexcept
Returns an iterable object to visit all in-edges of a vertex.
+
std::pair< vertex_type, vertex_type > edge_type
Edge type.
~adjacency_matrix()=default
Default destructor.
-
iterable_adaptor< vertex_iterator > vertices() const noexcept
Returns an iterable object to visit all vertices of a matrix.
+
iterable_adaptor< vertex_iterator > vertices() const noexcept
adjacency_matrix & operator=(const adjacency_matrix &)=default
Default copy assignment operator.
-
iterable_adaptor< edge_iterator > edges() const noexcept
Returns an iterable object to visit all edges of a matrix.
-
edge_iterator in_edge_iterator
In-edge iterator type.
-
void resize(const size_type vertices)
Resizes an adjacency matrix.
-
size_type vertex_type
Vertex type.
-
adjacency_matrix(const adjacency_matrix &other, const allocator_type &allocator)
Allocator-extended copy constructor.
+
iterable_adaptor< edge_iterator > edges() const noexcept
Returns an iterable object to visit all edges of a matrix.
+
edge_iterator in_edge_iterator
In-edge iterator type.
+
void resize(const size_type vertices)
Resizes an adjacency matrix.
+
size_type vertex_type
Vertex type.
+
adjacency_matrix(const adjacency_matrix &other, const allocator_type &allocator)
Allocator-extended copy constructor.
adjacency_matrix(adjacency_matrix &&) noexcept=default
Default move constructor.
-
size_type erase(const vertex_type lhs, const vertex_type rhs)
Removes the edge associated with a pair of given vertices.
-
adjacency_matrix(const allocator_type &allocator) noexcept
Constructs an empty container with a given allocator.
-
constexpr allocator_type get_allocator() const noexcept
Returns the associated allocator.
+
size_type erase(const vertex_type lhs, const vertex_type rhs)
Removes the edge associated with a pair of given vertices.
+
adjacency_matrix(const allocator_type &allocator) noexcept
Constructs an empty container with a given allocator.
+
constexpr allocator_type get_allocator() const noexcept
Returns the associated allocator.
Plain iota iterator (waiting for C++20).
-
constexpr Type make_obj_using_allocator(const Allocator &allocator, Args &&...args)
Uses-allocator construction utility (waiting for C++20).
constexpr bool operator!=(const basic_hashed_string< Char > &lhs, const basic_hashed_string< Char > &rhs) noexcept
Compares two hashed strings.
constexpr bool operator==(const basic_hashed_string< Char > &lhs, const basic_hashed_string< Char > &rhs) noexcept
Compares two hashed strings.
Utility class to create an iterable object from a pair of iterators.