Data Structures and Algorithms
with Object-Oriented Design Patterns in C++
All the other container classes considered in this text
have only one associated iterator.
When dealing with graphs,
it is convenient to have at least four iterators:
The first two are used to enumerate the sets and ,
and the last two are used to enumerate the sets and
associated with a given vertex v.
Each of the following member functions allocates dynamically
a new iterator instance as follows:
- Vertices
-
This member function of the Graph class
returns an iterator that can be used to
traverse the elements of .
- Edges
-
This member function of the Graph class
returns an iterator that can be used to
traverse the elements of .
- IncidentEdges
-
This member function takes a reference to
a vertex, say v,
and returns an iterator that can be used to
traverse the elements of .
The vertex v must be contained by the graph.
- EmanatingEdges
-
This member function takes a reference to
a vertex, say v,
and returns an iterator that can be used to
traverse the elements of .
The vertex v must be contained by the graph.
Copyright © 1997 by Bruno R. Preiss, P.Eng. All rights reserved.