# Adjacency Iterator Adaptor

Defined in header
boost/graph/adjacency_iterator.hpp
The adjacency iterator adaptor transforms an
`out_edge_iterator` into an adjacency iterator. That is, it
takes an iterator that traverses over edges, and creates an iterator
that traverses over the *target* vertices of those edges.
With this adaptor it is trivial to take a graph type that models Incidence Graph and add the
capabilities required of Adjacency
Graph.

## Synopsis

namespace boost {
template <class Graph, class VertexDescriptor, class OutEdgeIter>
class adjacency_iterator_generator {
public:
typedef iterator_adaptor<...> type;
};
}

### Example

The following is an example of how to use the
`adjacency_iterator_generator` class.

#include <boost/graph/adjacency_iterator.hpp>
class my_graph {
// ...
typedef ... out_edge_iterator;
typedef ... vertex_descriptor;
typedef boost::adjacency_iterator_generator<my_graph, vertex_descriptor, out_edge_iterator>::type adjacency_iterator;
// ...
};

### Template Parameters

Parameter | Description |

`Graph` |
The graph type, which must model Incidence Graph. |

`VertexDescriptor` |
This must be the same type as
`graph_traits<Graph>::vertex_descriptor`. The reason why
this is a template parameter is that the primary use of
`adjacency_iterator_generator` is *inside* the
definition of the graph class, and in that context we can not use
`graph_traits` on the not yet fully defined graph class.
**Default:** `graph_traits<Graph>::vertex_descriptor` |

`OutEdgeIter` |
This must be the same type as
`graph_traits<Graph>::out_edge_iterator`.
**Default:** `graph_traits<Graph>::out_edge_iterator
` |

### Model of

The adjacency iterator adaptor (the type
`adjacency_iterator_generator<...>::type`) is a model of Multi-Pass Input Iterator
.
### Members

The adjacency iterator type implements the member functions and
operators required of the Random Access Iterator
concept, except that the `reference` type is the same as the `value_type`
so `operator*()` returns by-value. In addition it has the following constructor:
adjacency_iterator_generator::type(const OutEdgeIter& it, const Graph* g)

Revised 19 Aug 2001

© Copyright Jeremy Siek 2000. Permission to copy, use,
modify, sell and distribute this document is granted provided this copyright
notice appears in all copies. This document is provided "as is"
without express or implied warranty, and with no claim as to its suitability for
any purpose.