next up previous contents index
Next: Adjacency Iterators for incoming Up: Graphs and Iterators Previous: Edge Iterators ( EdgeIt

     
Adjacency Iterators for leaving edges ( OutAdjIt )

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.

#include < LEDA/graph _iterator.h >

Creation

OutAdjIt it introduces a variable it of this class associated with no graph.
OutAdjIt it(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(graph G, 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(graph G, node n, 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(graph G) associates it with G and marks it with n'=G.first_node() and G.first_adj_edge(n').
void  it.init(graph G, 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(graph G, node n, 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(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(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(node n) it marks n and the first leaving edge of n afterwards.
void  it.update(node n, edge e)
    it marks n and e afterwards.
OutAdjIt& it = it2 assigns it2 to it. This method returns a reference to it.
bool it == 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.
edge  it.get_edge() returns the marked edge or nil if it.valid() returns false.
node it.get_node() returns the marked node or nil if it.has_node() returns false.
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.


next up previous contents index
Next: Adjacency Iterators for incoming Up: Graphs and Iterators Previous: Edge Iterators ( EdgeIt
LEDA research project
1999-04-23