|
LAL: Linear Arrangement Library 21.07.01
A library focused on algorithms on linear arrangements of graphs.
|
Iterator over the set of edges of a graph. More...
#include <E_iterator.hpp>
Public Member Functions | |
| E_iterator (const GRAPH &g) noexcept | |
| Constructor. | |
| ~E_iterator ()=default | |
| Default destructor. | |
| bool | end () const noexcept |
| Returns true if the end of the iteration was reached. | |
| edge | get_edge () const noexcept |
| Returns the current edge. | |
| void | next () noexcept |
| Moves the iterator to the next edge. | |
| void | reset () noexcept |
| Sets the iterator at the beginning of the set of edges. | |
Private Member Functions | |
| void | __reset () noexcept |
| Sets the iterator at the beginning of the set of edges. | |
| edge | make_current_edge () const noexcept |
| Returns the edge pointed by m_cur. | |
| template<bool isdir = is_directed, std::enable_if_t< isdir, bool > = true> | |
| std::pair< bool, E_pointer > | find_next_edge () const noexcept |
| Finds the next edge on a directed graph. | |
| template<bool isdir = is_directed, std::enable_if_t< not isdir, bool > = true> | |
| std::pair< bool, E_pointer > | find_next_edge () const noexcept |
| Finds the next edge on an undirected graph. | |
Private Attributes | |
| const GRAPH & | m_G |
| The graph whose edges have to be iterated on. | |
| E_pointer | m_cur |
| Pointer to the next edge. | |
| bool | m_exists_next = true |
| Is there a next edge to iterate over? | |
| bool | m_reached_end = false |
| Has the end of the iteration been reached? | |
| edge | m_cur_edge |
| Copy of the current edge. | |
Iterator over the set of edges of a graph.
This class is used to easily iterate over the edges of a graph \(E\). For undirected graphs, the edge returned is an edge \((u,v)\) so that the inequality \(u < v\) always holds. For directed graphs, the edge returned always has left-to-right orientation, therefore said inequality need not always hold.
This class has to be initialised with a constant reference to a graph.
A possible usage of this class is the following:
Alternatively, the lal::iterators::E_iterator object can be used in a for loop:
|
inlinenoexcept |
Constructor.
| g | Constant reference to the graph over which we iterate. |
|
inlineprivatenoexcept |
Finds the next edge on a directed graph.
|
inlineprivatenoexcept |
Finds the next edge on an undirected graph.