Definition
a variable it of class OutAdjIt is an adjacency iterator that marks a node (which is fixed in contrast to linear node iterators) and iterates over the edges that leave this node.
There is a variant of the adjacency iterators, so-called circulators which are heavily used in the CGAL^{14.2}. The names of the classes are OutAdjCirc and InAdjCirc and their interfaces are completely equal to the iterator versions while they internally use e.g. cyclic_adj_succ() instead of adj_succ().
#include < LEDA/graph/graph_iterator.h >
Creation
OutAdjIt | it | introduces a variable it of this class associated with no graph. |
OutAdjIt | it(const leda::graph& G) | introduces a variable it of this class
associated with G.
The node is initialized by G.first_node() and the edge by G.first_adj_edge(n) where n is the marked node. |
OutAdjIt | it(const leda::graph& G, leda::node n) | |
introduces a variable it of this class marked with n
and associated with G.
The marked edge is initialized by G.first_adj_edge(n).
Precondition: n is a node of G. |
||
OutAdjIt | it(const leda::graph& G, leda::node n, leda::edge e) | |
introduces a variable it of this class marked with n
and e
and associated with G.
Precondition: n is a node and e an edge of G and source(e)=n. |
Operations
void | it.init(const leda::graph& G) | |
associates it with G and marks it with n'=G.first_node() and G.first_adj_edge(n'). | ||
void | it.init(const leda::graph& G, const leda::node& n) | |
associates it with G and marks it with
n and G.first_adj_edge(n).
Precondition: n is a node of G. |
||
void | it.init(const leda::graph& G, const leda::node& n, const leda::edge& e) | |
associates it with G and marks it with
n and e.
Precondition: n is a node and e an edge of G and source(e)=n. |
||
void | it.update(leda::edge e) | it marks e afterwards. |
void | it.reset() | resets it to G.first_adj_edge(n) where G and n are the marked node and associated graph. |
void | it.insert(const OutAdjIt& other) | |
creates a new leaving edge from the marked node of it to the marked node of other. it is marked with the new edge afterwards. The marked node of it does not change. | ||
void | it.del() | deletes the marked leaving edge, i.e. it.valid() returns false afterwards.
Precondition: it.valid() returns true. |
void | it.reset_end() | resets it to G.last_adj_edge(n) where G and n are the marked node and associated graph. |
void | it.make_invalid() | makes it invalid, i.e. it.valid() will be false afterwards and it marks no node. |
void | it.update(leda::node n) | it marks n and the first leaving edge of n afterwards. |
void | it.update(leda::node n, leda::edge e) | |
it marks n and e afterwards. | ||
OutAdjIt& | it = const OutAdjIt& it2 | assigns it2 to it. This method returns a reference to it. |
bool | it == const OutAdjIt& it2 | returns true if and only if it and it2 are equal, i.e. if the marked nodes and edges are equal. |
bool | it.has_node() | returns true if and only if it marks a node. |
bool | it.eol() | returns !it.valid() which is true if and only if there is no successor edge left, i.e. if all edges of the edge set are passed (eol: end of list). |
bool | it.valid() | returns true if and only if end of sequence not yet passed, i.e. if there is an edge in the edge set that was not yet passed. |
leda::edge | it.get_edge() | returns the marked edge or nil if it.valid() returns false. |
leda::node | it.get_node() | returns the marked node or nil if it.has_node() returns false. |
const leda::graph& | it.get_graph() | returns the associated graph. |
OutAdjIt | it.curr_adj() | returns a new adjacency iterator that is
associated with n'=target(e) and G.first_adj_edge(n')
where G is the associated graph.
Precondition: it.valid() returns true. |
OutAdjIt& | ++it | performs one step forward in the list of outgoing edges of the marked node.
If there is no successor edge, it.eol() will be true afterwards.
This method returns a reference to it.
Precondition: it.valid() returns true. |
OutAdjIt& | -it | performs one step backward in the list of outgoing edges of the marked node.
If there is no predecesssor edge, it.eol() will be true afterwards.
This method returns a reference to it.
Precondition: it.valid() returns true. |
Implementation
Creation of an iterator and all methods take constant time.