Aleph-w 7.10.0
A C++ Library for Data Structures and Algorithms
Loading...
Searching...
No Matches
GraphCommon< GT, Node, Arc >::Digraph_Iterator< Filter > Class Template Reference

Special iterator for distinguishing input arcs of output ones. More...

#include <graph-dry.H>

Inheritance diagram for GraphCommon< GT, Node, Arc >::Digraph_Iterator< Filter >:
[legend]

Public Types

using Item_Type = typename Itor::Item_Type
 
using Iterator_Type = Itor
 the type of items (Arc*)
 

Public Member Functions

 Digraph_Iterator (Node *p)
 Instantiate an filtered iterator for arcs on the node p
 
void next_ne () noexcept(shows_ne)
 next() without its check: the current arc must exist.
 
void next ()
 Advance to next arc.
 
void prev ()
 back to previous item.
 
void prev_ne ()
 prev() without exceptions. Only where the iterator moves back
 
bool has_curr () const noexcept
 Return true is the iterator has a current arc.
 
GT::Arc * get_curr () const
 Return the current arc.
 
GT::Arc * get_curr_ne () const noexcept
 
auto get_current_arc () const
 See get_curr().
 
auto get_current_arc_ne () const noexcept
 
GT::Node * get_node (typename GT::Arc *a) const noexcept
 Return the node connected to p (passed during construction) and linked through a
 
GT::Node * get_node_ne () const noexcept
 Return the node connected to p (passed during construction) and linked through the current arc.
 
auto get_tgt_node_ne () const noexcept
 Backward-compatible alias: return target node (same as get_node_ne()).
 
GT::Node * get_node () const
 
auto get_tgt_node () const
 Backward-compatible alias: return target node (same as get_node()).
 
void reset_first () noexcept(shows_ne)
 Reset the iterator to first arc.
 
void reset_last () noexcept(shows_ne)
 Reset the iterator to last arc.
 

Static Public Attributes

static constexpr bool shows_ne = noexcept(std::declval<Itor &>().next_ne())
 Whether what the filter says of an arc cannot throw, nor its conversion to bool: the moves without checks and the resets are noexcept then.
 
static constexpr bool goes_back = Itor::goes_back
 Whether the iterator moves back: the iterators of the lists of List_SGraph go only forward, and have no prev()
 
static constexpr bool goes_to_last = Itor::goes_to_last
 Whether the iterator goes to its last arc, which reset_last() needs.
 

Private Types

using Itor = Filter_Iterator< Node *, typename GT::Node_Arc_Iterator, Filter >
 

Private Attributes

Filter filt
 
Itor it
 

Detailed Description

template<class GT, class Node, class Arc>
template<class Filter>
class GraphCommon< GT, Node, Arc >::Digraph_Iterator< Filter >

Special iterator for distinguishing input arcs of output ones.

The intended use of this iterator is to traverse the arcs linked to a node p inserted in a non-directed graph and to filter those arcs that are incoming or outcoming respect to p.

The in/out feature is given by the filter.

For example, for iterating on the input arcs of node p, we can do:

for (GT::Digraph_Iterator<In_Filt> it(p); it.has_curr(); it.next())

auto a = it.get_curr(); // this arc is incoming q --> p

Although this iterator is exclusivelly conceived for dealing with incoming or outcoming arcs. it could be used as filtered iterator. That is, you could to configure the filter for filtering arcs according your own criteria. In this case, we recommend to use the aliased version Filter_Iterator.

Apart from the fact that some arcs are filtered, the interface is identical to the Aleph-w ( \(\aleph_\omega\)) iterators.

See also
Out_Iterator In_Iterator Filter_Iterator

Definition at line 3312 of file graph-dry.H.

Member Typedef Documentation

◆ Item_Type

template<class GT , class Node , class Arc >
template<class Filter >
using GraphCommon< GT, Node, Arc >::Digraph_Iterator< Filter >::Item_Type = typename Itor::Item_Type

Definition at line 3325 of file graph-dry.H.

◆ Iterator_Type

template<class GT , class Node , class Arc >
template<class Filter >
using GraphCommon< GT, Node, Arc >::Digraph_Iterator< Filter >::Iterator_Type = Itor

the type of items (Arc*)

Definition at line 3327 of file graph-dry.H.

◆ Itor

template<class GT , class Node , class Arc >
template<class Filter >
using GraphCommon< GT, Node, Arc >::Digraph_Iterator< Filter >::Itor = Filter_Iterator<Node *, typename GT::Node_Arc_Iterator, Filter>
private

Definition at line 3314 of file graph-dry.H.

Constructor & Destructor Documentation

◆ Digraph_Iterator()

template<class GT , class Node , class Arc >
template<class Filter >
GraphCommon< GT, Node, Arc >::Digraph_Iterator< Filter >::Digraph_Iterator ( Node *  p)
inline

Instantiate an filtered iterator for arcs on the node p

Definition at line 3337 of file graph-dry.H.

Member Function Documentation

◆ get_curr()

template<class GT , class Node , class Arc >
template<class Filter >
GT::Arc * GraphCommon< GT, Node, Arc >::Digraph_Iterator< Filter >::get_curr ( ) const
inline

◆ get_curr_ne()

template<class GT , class Node , class Arc >
template<class Filter >
GT::Arc * GraphCommon< GT, Node, Arc >::Digraph_Iterator< Filter >::get_curr_ne ( ) const
inlinenoexcept

◆ get_current_arc()

template<class GT , class Node , class Arc >
template<class Filter >
auto GraphCommon< GT, Node, Arc >::Digraph_Iterator< Filter >::get_current_arc ( ) const
inline

◆ get_current_arc_ne()

template<class GT , class Node , class Arc >
template<class Filter >
auto GraphCommon< GT, Node, Arc >::Digraph_Iterator< Filter >::get_current_arc_ne ( ) const
inlinenoexcept

◆ get_node() [1/2]

template<class GT , class Node , class Arc >
template<class Filter >
GT::Node * GraphCommon< GT, Node, Arc >::Digraph_Iterator< Filter >::get_node ( ) const
inline

◆ get_node() [2/2]

template<class GT , class Node , class Arc >
template<class Filter >
GT::Node * GraphCommon< GT, Node, Arc >::Digraph_Iterator< Filter >::get_node ( typename GT::Arc *  a) const
inlinenoexcept

◆ get_node_ne()

template<class GT , class Node , class Arc >
template<class Filter >
GT::Node * GraphCommon< GT, Node, Arc >::Digraph_Iterator< Filter >::get_node_ne ( ) const
inlinenoexcept

Return the node connected to p (passed during construction) and linked through the current arc.

Definition at line 3380 of file graph-dry.H.

References GraphCommon< GT, Node, Arc >::Digraph_Iterator< Filter >::get_curr_ne(), and GraphCommon< GT, Node, Arc >::Digraph_Iterator< Filter >::get_node().

Referenced by GraphCommon< GT, Node, Arc >::Digraph_Iterator< Filter >::get_tgt_node_ne().

◆ get_tgt_node()

template<class GT , class Node , class Arc >
template<class Filter >
auto GraphCommon< GT, Node, Arc >::Digraph_Iterator< Filter >::get_tgt_node ( ) const
inline

Backward-compatible alias: return target node (same as get_node()).

Definition at line 3394 of file graph-dry.H.

References GraphCommon< GT, Node, Arc >::Digraph_Iterator< Filter >::get_node().

◆ get_tgt_node_ne()

template<class GT , class Node , class Arc >
template<class Filter >
auto GraphCommon< GT, Node, Arc >::Digraph_Iterator< Filter >::get_tgt_node_ne ( ) const
inlinenoexcept

Backward-compatible alias: return target node (same as get_node_ne()).

Definition at line 3386 of file graph-dry.H.

References GraphCommon< GT, Node, Arc >::Digraph_Iterator< Filter >::get_node_ne().

Referenced by Aleph::kosaraju_detail::Frame< GT >::next_target().

◆ has_curr()

◆ next()

template<class GT , class Node , class Arc >
template<class Filter >
void GraphCommon< GT, Node, Arc >::Digraph_Iterator< Filter >::next ( )
inline

Advance to next arc.

Throw overflow_error if there is no current arc

Definition at line 3348 of file graph-dry.H.

References GraphCommon< GT, Node, Arc >::Digraph_Iterator< Filter >::it.

◆ next_ne()

template<class GT , class Node , class Arc >
template<class Filter >
void GraphCommon< GT, Node, Arc >::Digraph_Iterator< Filter >::next_ne ( )
inlinenoexcept

next() without its check: the current arc must exist.

noexcept when the filter is (shows_ne); else what the filter throws goes out

Definition at line 3344 of file graph-dry.H.

References GraphCommon< GT, Node, Arc >::Digraph_Iterator< Filter >::it.

Referenced by Aleph::kosaraju_detail::Frame< GT >::next_arc(), and Aleph::kosaraju_detail::Frame< GT >::next_target().

◆ prev()

template<class GT , class Node , class Arc >
template<class Filter >
void GraphCommon< GT, Node, Arc >::Digraph_Iterator< Filter >::prev ( )
inline

back to previous item.

Throw underflow_error if there is no current arc. Only where the iterator moves back (goes_back)

Definition at line 3352 of file graph-dry.H.

References GraphCommon< GT, Node, Arc >::Digraph_Iterator< Filter >::it.

◆ prev_ne()

template<class GT , class Node , class Arc >
template<class Filter >
void GraphCommon< GT, Node, Arc >::Digraph_Iterator< Filter >::prev_ne ( )
inline

prev() without exceptions. Only where the iterator moves back

Definition at line 3355 of file graph-dry.H.

References GraphCommon< GT, Node, Arc >::Digraph_Iterator< Filter >::it.

◆ reset_first()

template<class GT , class Node , class Arc >
template<class Filter >
void GraphCommon< GT, Node, Arc >::Digraph_Iterator< Filter >::reset_first ( )
inlinenoexcept

Reset the iterator to first arc.

Definition at line 3397 of file graph-dry.H.

References GraphCommon< GT, Node, Arc >::Digraph_Iterator< Filter >::it.

◆ reset_last()

template<class GT , class Node , class Arc >
template<class Filter >
void GraphCommon< GT, Node, Arc >::Digraph_Iterator< Filter >::reset_last ( )
inlinenoexcept

Reset the iterator to last arc.

Only where the iterator goes to its last arc (goes_to_last)

Definition at line 3401 of file graph-dry.H.

References GraphCommon< GT, Node, Arc >::Digraph_Iterator< Filter >::it.

Member Data Documentation

◆ filt

template<class GT , class Node , class Arc >
template<class Filter >
Filter GraphCommon< GT, Node, Arc >::Digraph_Iterator< Filter >::filt
private

◆ goes_back

template<class GT , class Node , class Arc >
template<class Filter >
constexpr bool GraphCommon< GT, Node, Arc >::Digraph_Iterator< Filter >::goes_back = Itor::goes_back
staticconstexpr

Whether the iterator moves back: the iterators of the lists of List_SGraph go only forward, and have no prev()

Definition at line 3331 of file graph-dry.H.

◆ goes_to_last

template<class GT , class Node , class Arc >
template<class Filter >
constexpr bool GraphCommon< GT, Node, Arc >::Digraph_Iterator< Filter >::goes_to_last = Itor::goes_to_last
staticconstexpr

Whether the iterator goes to its last arc, which reset_last() needs.

Definition at line 3334 of file graph-dry.H.

◆ it

◆ shows_ne

template<class GT , class Node , class Arc >
template<class Filter >
constexpr bool GraphCommon< GT, Node, Arc >::Digraph_Iterator< Filter >::shows_ne = noexcept(std::declval<Itor &>().next_ne())
staticconstexpr

Whether what the filter says of an arc cannot throw, nor its conversion to bool: the moves without checks and the resets are noexcept then.

Definition at line 3323 of file graph-dry.H.


The documentation for this class was generated from the following file: