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

Alias for Digraph_Iterator More...

#include <graph-dry.H>

Inheritance diagram for GraphCommon< GT, Node, Arc >::In_Iterator:
[legend]
Collaboration diagram for GraphCommon< GT, Node, Arc >::In_Iterator:
[legend]

Public Member Functions

 In_Iterator (Node *p)
 Iterator on the list of p, which holds the arcs into p only in a graph that is not directed.
 
 In_Iterator (const GT &g, Node *p)
 Iterator on the arcs into p of g, a graph that is not directed: those of the list of p.
 
- Public Member Functions inherited from GraphCommon< GT, Node, Arc >::Digraph_Iterator< In_Filt >
 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 () const
 
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()).
 
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.
 

Private Types

using Base = Digraph_Iterator< In_Filt >
 

Static Private Member Functions

static void refuse_a_digraph ()
 
static Node * of_lists (const GT &g, Node *p)
 

Additional Inherited Members

- Public Types inherited from GraphCommon< GT, Node, Arc >::Digraph_Iterator< In_Filt >
using Item_Type = typename Itor::Item_Type
 
using Iterator_Type = Itor
 the type of items (Arc*)
 
- Static Public Attributes inherited from GraphCommon< GT, Node, Arc >::Digraph_Iterator< In_Filt >
static constexpr bool shows_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
 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
 Whether the iterator goes to its last arc, which reset_last() needs.
 

Detailed Description

template<class GT, class Node, class Arc>
struct GraphCommon< GT, Node, Arc >::In_Iterator

Alias for Digraph_Iterator

Iterator on the arcs that go into a node.

It walks the list of the node, which holds the arcs into it only in a graph that is not directed: a digraph keeps each arc only in the list of its source. So the iterator has two forms:

  • In_Iterator(p) walks the list of p. On a digraph it sees only the loops of p; the digraph types (see DigraphType) have their own In_Iterator, whose form that takes only the node does not compile.
  • In_Iterator(g, p) takes the graph: it walks the list of p, and throws domain_error if g says that it is directed, as a graph of an undirected type does after set_digraph(true). The In_Iterator of a digraph type walks the arcs of the graph.

The methods on the arcs into a node, as in_arcs() and in_degree(), tell a digraph at run time; to go through the arcs into many nodes of a digraph, In_Arcs_Index takes \(O(V + E)\) once.

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

Member Typedef Documentation

◆ Base

template<class GT , class Node , class Arc >
using GraphCommon< GT, Node, Arc >::In_Iterator::Base = Digraph_Iterator<In_Filt>
private

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

Constructor & Destructor Documentation

◆ In_Iterator() [1/2]

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

Iterator on the list of p, which holds the arcs into p only in a graph that is not directed.

Parameters
[in]pthe node.

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

◆ In_Iterator() [2/2]

template<class GT , class Node , class Arc >
GraphCommon< GT, Node, Arc >::In_Iterator::In_Iterator ( const GT &  g,
Node *  p 
)
inline

Iterator on the arcs into p of g, a graph that is not directed: those of the list of p.

Parameters
[in]gthe graph of p.
[in]pthe node.
Exceptions
domain_errorif g says that it is directed.

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

Member Function Documentation

◆ of_lists()

template<class GT , class Node , class Arc >
static Node * GraphCommon< GT, Node, Arc >::In_Iterator::of_lists ( const GT &  g,
Node *  p 
)
inlinestaticprivate

◆ refuse_a_digraph()

template<class GT , class Node , class Arc >
static void GraphCommon< GT, Node, Arc >::In_Iterator::refuse_a_digraph ( )
inlinestaticprivate

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

References ah_domain_error.

Referenced by GraphCommon< GT, Node, Arc >::In_Iterator::of_lists().


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