Aleph-w 3.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
 
void next ()
 Advance to next arc.
 
void prev ()
 back to previous item.
 
void prev_ne ()
 
bool has_curr () const noexcept
 Return true is the iterator has a current arc.
 
GT::Arcget_curr () const
 Return the current arc.
 
GT::Arcget_curr_ne () const noexcept
 
auto get_current_arc () const
 
auto get_current_arc_ne () const noexcept
 
GT::Nodeget_node (typename GT::Arc *a) const noexcept
 Return the node connected to p (passed during construction) and linked through a
 
GT::Nodeget_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::Nodeget_node () const
 
auto get_tgt_node () const
 Backward-compatible alias: return target node (same as get_node()).
 
void reset_first () noexcept
 Reset the iterator to first arc.
 
void reset_last () noexcept
 Reset the iterator to last arc.
 

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 ars 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 2970 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 2978 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 2980 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 2972 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 2983 of file graph-dry.H.

Member Function Documentation

◆ get_curr()

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

Return the current arc.

Throws overflow_error if there is no current arc

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

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

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

Referenced by GraphCommon< GT, Node, Arc >::Digraph_Iterator< Filter >::get_current_arc(), and GraphCommon< GT, Node, Arc >::Digraph_Iterator< Filter >::get_node().

◆ 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 3023 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 3037 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 3029 of file graph-dry.H.

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

◆ 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 2992 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

◆ 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

Definition at line 2996 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

◆ 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 3040 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.

Definition at line 3043 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

◆ it


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