|
LAL: Linear Arrangement Library 21.07.01
A library focused on algorithms on linear arrangements of graphs.
|
Iterator over the set of pairs of independent edges of a graph. More...
#include <Q_iterator.hpp>
Public Member Functions | |
| Q_iterator (const GRAPH &g) noexcept | |
| Constructor. | |
| ~Q_iterator ()=default | |
| Default destructor. | |
| bool | end () const noexcept |
| Returns true if the end of the iteration was reached. | |
| edge_pair | get_edge_pair () const noexcept |
| Returns the current edge pair. | |
| void | next () noexcept |
| Moves the iterator to the next pair, if there is any. | |
| 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_pair | make_current_pair () const noexcept |
| Returns the current pair of independent edges. | |
| bool | share_nodes (const E_pointer &p1, const E_pointer &p2) const noexcept |
| Returns whether the edges share vertices or not. | |
| template<bool isdir = is_directed, std::enable_if_t< isdir, bool > = true> | |
| std::tuple< bool, E_pointer, E_pointer > | find_next_pair (node s, std::size_t pt, node u, std::size_t pv) noexcept |
| Find the next pair in a directed graph. | |
| template<bool isdir = is_directed, std::enable_if_t< not isdir, bool > = true> | |
| std::tuple< bool, E_pointer, E_pointer > | find_next_pair (node s, std::size_t pt, node u, std::size_t pv) noexcept |
| Find the next pair in an undirected graph. | |
Static Private Member Functions | |
| static bool | share_nodes (const edge_pair &st_uv) noexcept |
| Returns whether the edges share vertices or not. | |
Private Attributes | |
| const GRAPH & | m_G |
| Graph we are iterating on. | |
| E_pointer | m_cur1 = E_pointer(0,0) |
| Current pointers to the first edge. | |
| E_pointer | m_cur2 = E_pointer(0,0) |
| Current pointers to the second edge. | |
| bool | m_exists_next = true |
| Is there a next pair of independent edges? | |
| bool | m_reached_end = false |
| Has the end of the iteration been reached? | |
| edge_pair | m_cur_pair = { {0,0}, {0,0} } |
| Current pair of independent edges. | |
Iterator over the set of pairs of independent edges of a graph.
This class is used to easily iterate over the elements of the set \(Q\) of a graph.
This class iterates over the independent pairs of edges of a graph. For undirected graphs, the edges of the pair returned are edges \((u,v)\) so that the inequality \(u < v\) always holds. For directed graphs, this is not always true, since the edges returned always has left-to-right direction.
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::Q_iterator object can be used in a for loop:
|
inlinenoexcept |
Constructor.
| g | Constant reference to the graph over which we iterate. |
|
inlineprivatenoexcept |