adjacency_iterator.html 3.9 KB

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