]>
Commit | Line | Data |
---|---|---|
1 | <html> | |
2 | <!-- | |
3 | Copyright (c) Jeremy Siek 2000 | |
4 | ||
5 | Distributed under the Boost Software License, Version 1.0. | |
6 | (See accompanying file LICENSE_1_0.txt or copy at | |
7 | http://www.boost.org/LICENSE_1_0.txt) | |
8 | --> | |
9 | ||
10 | <head> | |
11 | <meta http-equiv="Content-Type" content="text/html; charset=windows-1252"> | |
12 | <meta name="GENERATOR" content="Microsoft FrontPage 4.0"> | |
13 | <meta name="ProgId" content="FrontPage.Editor.Document"> | |
14 | <title>Adjacency Iterator Adaptor Documentation</title> | |
15 | </head> | |
16 | ||
17 | <body bgcolor="#FFFFFF" text="#000000"> | |
18 | ||
19 | <img src="../../../boost.png" alt="boost.png (6897 bytes)" | |
20 | align="center" width="277" height="86"> | |
21 | ||
22 | <h1>Adjacency Iterator Adaptor</h1> | |
23 | ||
24 | Defined in header | |
25 | <a href="../../../boost/graph/adjacency_iterator.hpp">boost/graph/adjacency_iterator.hpp</a> | |
26 | ||
27 | <p> | |
28 | The adjacency iterator adaptor transforms an | |
29 | <tt>out_edge_iterator</tt> into an adjacency iterator. That is, it | |
30 | takes an iterator that traverses over edges, and creates an iterator | |
31 | that traverses over the <b><i>target</i></b> vertices of those edges. | |
32 | With this adaptor it is trivial to take a graph type that models <a | |
33 | href="IncidenceGraph.html">Incidence Graph</a> and add the | |
34 | capabilities required of <a href="AdjacencyGraph.html">Adjacency | |
35 | Graph</a>. | |
36 | ||
37 | ||
38 | <h2>Synopsis</h2> | |
39 | ||
40 | <pre> | |
41 | namespace boost { | |
42 | template <class Graph, class VertexDescriptor, class OutEdgeIter> | |
43 | class adjacency_iterator_generator { | |
44 | public: | |
45 | typedef <a href="../../iterator/doc/iterator_adaptor.html">iterator_adaptor</a><...> type; | |
46 | }; | |
47 | } | |
48 | </pre> | |
49 | ||
50 | <hr> | |
51 | ||
52 | <h3>Example</h3> | |
53 | ||
54 | <p> | |
55 | The following is an example of how to use the | |
56 | <tt>adjacency_iterator_generator</tt> class. | |
57 | ||
58 | <p> | |
59 | <PRE> | |
60 | #include <boost/graph/adjacency_iterator.hpp> | |
61 | ||
62 | class my_graph { | |
63 | // ... | |
64 | typedef ... out_edge_iterator; | |
65 | typedef ... vertex_descriptor; | |
66 | typedef boost::adjacency_iterator_generator<my_graph, vertex_descriptor, out_edge_iterator>::type adjacency_iterator; | |
67 | // ... | |
68 | }; | |
69 | ||
70 | </PRE> | |
71 | ||
72 | <h3>Template Parameters</h3> | |
73 | ||
74 | <Table border> | |
75 | <TR> | |
76 | <TH>Parameter</TH><TH>Description</TH> | |
77 | </TR> | |
78 | ||
79 | <TR> | |
80 | <TD><tt>Graph</tt></TD> | |
81 | <TD>The graph type, which must model <a | |
82 | href="./IncidenceGraph.html">Incidence Graph</a>.</TD> | |
83 | </TR> | |
84 | ||
85 | <TR> | |
86 | <TD><tt>VertexDescriptor</tt></TD> | |
87 | <TD>This must be the same type as | |
88 | <tt>graph_traits<Graph>::vertex_descriptor</tt>. The reason why | |
89 | this is a template parameter is that the primary use of | |
90 | <tt>adjacency_iterator_generator</tt> is <b><i>inside</i></b> the | |
91 | definition of the graph class, and in that context we can not use | |
92 | <tt>graph_traits</tt> on the not yet fully defined graph class.<br> | |
93 | <b>Default:</b> <tt>graph_traits<Graph>::vertex_descriptor</tt></TD> | |
94 | </TR> | |
95 | ||
96 | <TR> | |
97 | <TD><tt>OutEdgeIter</tt></TD> | |
98 | <TD>This must be the same type as | |
99 | <tt>graph_traits<Graph>::out_edge_iterator</tt>.<br> | |
100 | <b>Default:</b> <tt>graph_traits<Graph>::out_edge_iterator | |
101 | </TD> | |
102 | </TR> | |
103 | ||
104 | </Table> | |
105 | ||
106 | <h3>Model of</h3> | |
107 | ||
108 | The adjacency iterator adaptor (the type | |
109 | <tt>adjacency_iterator_generator<...>::type</tt>) is a model of <a | |
110 | href="../../utility/MultiPassInputIterator.html">Multi-Pass Input Iterator</a> | |
111 | </a>. | |
112 | ||
113 | ||
114 | <h3>Members</h3> | |
115 | ||
116 | The adjacency iterator type implements the member functions and | |
117 | operators required of the <a | |
118 | href="http://www.sgi.com/tech/stl/RandomAccessIterator.html">Random Access Iterator</a> | |
119 | concept, except that the <tt>reference</tt> type is the same as the <tt>value_type</tt> | |
120 | so <tt>operator*()</tt> returns by-value. In addition it has the following constructor: | |
121 | ||
122 | <pre> | |
123 | adjacency_iterator_generator::type(const OutEdgeIter& it, const Graph* g) | |
124 | </pre> | |
125 | ||
126 | <hr> | |
127 | <p>Revised <!--webbot bot="Timestamp" s-type="EDITED" s-format="%d %b %Y" startspan -->19 Aug 2001<!--webbot bot="Timestamp" endspan i-checksum="14767" --></p> | |
128 |