...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
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.
namespace boost { templateclass adjacency_iterator_generator { public: typedef iterator_adaptor<...> type; }; }
The following is an example of how to use the adjacency_iterator_generator class.
#includeclass my_graph { // ... typedef ... out_edge_iterator; typedef ... vertex_descriptor; typedef boost::adjacency_iterator_generator ::type adjacency_iterator; // ... };
Parameter | Description |
---|---|
Graph | The graph type, which must model Incidence Graph. |
VertexDescriptor | This must be the same type as
graph_traits Default: graph_traits |
OutEdgeIter | This must be the same type as
graph_traits Default: graph_traits |
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.