49#include <lal/graphs/directed_graph.hpp>
50#include <lal/graphs/undirected_graph.hpp>
94 bool is_directed = std::is_base_of_v<graphs::directed_graph, graph_t>,
95 std::enable_if_t<std::is_base_of_v<graphs::graph, graph_t>,
bool> =
true
161 typedef std::pair<node,std::size_t> E_pointer;
185 m_cur.second =
static_cast<std::size_t
>(-1);
205 if (
m_G.get_num_edges() == 1) {
220 if constexpr (is_directed) {
222 t =
m_G.get_out_neighbours(s)[
m_cur.second];
226 t =
m_G.get_neighbours(s)[
m_cur.second];
237 template <
bool isdir = is_directed, std::enable_if_t<isdir,
bool> = true>
240 std::size_t pt =
m_cur.second;
253 return {found, E_pointer(s, pt)};
261 template <
bool isdir = is_directed, std::enable_if_t<not isdir,
bool> = true>
264 std::size_t pt =
m_cur.second + 1;
268 const auto& Ns =
m_G.get_neighbours(s);
269 while (pt < Ns.size() and s > Ns[pt]) { ++pt; }
271 found = pt < Ns.size();
277 return {found, E_pointer(s, pt)};
Iterator over the set of edges of a graph.
Definition: E_iterator.hpp:97
bool m_reached_end
Has the end of the iteration been reached?
Definition: E_iterator.hpp:174
void __reset() noexcept
Sets the iterator at the beginning of the set of edges.
Definition: E_iterator.hpp:180
void reset() noexcept
Sets the iterator at the beginning of the set of edges.
Definition: E_iterator.hpp:155
~E_iterator()=default
Default destructor.
edge make_current_edge() const noexcept
Returns the edge pointed by m_cur.
Definition: E_iterator.hpp:218
const uint64_t m_num_nodes
Number of nodes of the graph.
Definition: E_iterator.hpp:167
edge_t yield_edge_t() noexcept
Returns the current edge and advances the iterator.
Definition: E_iterator.hpp:133
const graph_t & m_G
The graph whose edges have to be iterated on.
Definition: E_iterator.hpp:165
void next() noexcept
Moves the iterator to the next edge.
Definition: E_iterator.hpp:142
E_iterator(const graph_t &g) noexcept
Constructor.
Definition: E_iterator.hpp:105
bool end() const noexcept
Returns true if the end of the iteration was reached.
Definition: E_iterator.hpp:117
E_pointer m_cur
Pointer to the next edge.
Definition: E_iterator.hpp:170
bool m_exists_next
Is there a next edge to iterate over?
Definition: E_iterator.hpp:172
const edge & get_edge() const noexcept
Returns the current edge.
Definition: E_iterator.hpp:120
std::pair< bool, E_pointer > find_next_edge() const noexcept
Finds the next edge on a directed graph.
Definition: E_iterator.hpp:238
edge_t get_edge_t() const noexcept
Returns the current edge.
Definition: E_iterator.hpp:123
edge m_cur_edge
Copy of the current edge.
Definition: E_iterator.hpp:176
edge yield_edge() noexcept
Returns the current edge and advances the iterator.
Definition: E_iterator.hpp:126
Main namespace of the library.
Definition: basic_types.hpp:50
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
std::pair< node_t, node_t > edge_t
Similar to edge.
Definition: basic_types.hpp:163