EdgeListGraph.html 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  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. <Title>EdgeListGraph</Title>
  10. <BODY BGCOLOR="#ffffff" LINK="#0000ee" TEXT="#000000" VLINK="#551a8b"
  11. ALINK="#ff0000">
  12. <IMG SRC="../../../boost.png"
  13. ALT="C++ Boost" width="277" height="86">
  14. <BR Clear>
  15. <H2><A NAME="concept:EdgeListGraph"></A>
  16. EdgeListGraph
  17. </H2>
  18. The EdgeListGraph concept refines the <a href="./Graph.html">Graph</a>
  19. concept, and adds the requirement for efficient access to all the
  20. edges in the graph.
  21. <H3>Refinement of</H3>
  22. <a href="./Graph.html">Graph</a>
  23. <h3>Notation</h3>
  24. <Table>
  25. <TR>
  26. <TD><tt>G</tt></TD>
  27. <TD>A type that is a model of EdgeListGraph.</TD>
  28. </TR>
  29. <TR>
  30. <TD><tt>g</tt></TD>
  31. <TD>An object of type <tt>G</tt>.</TD>
  32. </TR>
  33. <TR>
  34. <TD><tt>e</tt></TD>
  35. <TD>An object of type <tt>boost::graph_traits&lt;G&gt;::edge_descriptor</tt>.</TD>
  36. </TR>
  37. </table>
  38. <H3>Associated Types</H3>
  39. <table border>
  40. <tr>
  41. <td><tt>boost::graph_traits&lt;G&gt;::traversal_category</tt><br><br>
  42. This tag type must be convertible to <tt>edge_list_graph_tag</tt>.
  43. </td>
  44. </tr>
  45. <tr>
  46. <td><pre>boost::graph_traits&lt;G&gt;::edge_iterator</pre>
  47. An edge iterator (obtained via <TT>edges(g)</TT>) provides access to
  48. all of the edges in a graph. An edge iterator type must meet the
  49. requirements of <a
  50. href="../../utility/MultiPassInputIterator.html">MultiPassInputIterator</a>. The
  51. value type of the edge iterator must be the same as the edge
  52. descriptor of the graph.
  53. <tr>
  54. <td><pre>boost::graph_traits&lt;G&gt;::edges_size_type</pre>
  55. The unsigned integer type used to represent the number of edges in the
  56. graph.
  57. </td>
  58. </tr>
  59. </table>
  60. <h3>Valid Expressions</h3>
  61. <table border>
  62. <tr>
  63. <TD><a name="sec:edges"><TT>edges(g)</TT></a></TD>
  64. <TD>Returns an iterator-range providing access to all
  65. the edges in the graph <TT>g</TT>.<br>
  66. Return type: <TT>std::pair&lt;edge_iterator, edge_iterator&gt;</TT>
  67. </td>
  68. </TR>
  69. <tr>
  70. <TD><TT>num_edges(g)</TT></TD>
  71. <TD>Returns the number of edges in the graph <TT>g</TT>.<br>
  72. Return type: <TT>edges_size_type</TT>
  73. </td>
  74. </TR>
  75. <tr>
  76. <TD><TT>source(e, g)</TT></TD>
  77. <TD>
  78. Returns the vertex descriptor for <i>u</i> of the edge <i>(u,v)</i>
  79. represented by <TT>e</TT>.<br>
  80. Return type: <TT>vertex_descriptor</TT>
  81. </td>
  82. </tr>
  83. <tr>
  84. <TD><TT>target(e, g)</TT></TD>
  85. <TD>
  86. Returns the vertex descriptor for
  87. <i>v</i> of the edge <i>(u,v)</i> represented by <TT>e</TT>.<br>
  88. Return type: <TT>vertex_descriptor</TT>
  89. </TD>
  90. </TR>
  91. </TABLE>
  92. <H3>Models</H3>
  93. <UL>
  94. <LI><a href="./adjacency_list.html"><TT>adjacency_list</TT></a></LI>
  95. <LI><a href="./edge_list.html"><TT>edge_list</TT></a></LI>
  96. </UL>
  97. <H3>Complexity guarantees</H3>
  98. The <TT>edges()</TT>, <TT>source()</TT>, and <TT>target()</TT> functions
  99. must all return in constant time.
  100. <H3>See Also</H3>
  101. <a href="./graph_concepts.html">Graph concepts</a>
  102. <H3>Concept Checking Class</H3>
  103. <P>
  104. <PRE>
  105. template &lt;class G&gt;
  106. struct EdgeListGraphConcept
  107. {
  108. typedef typename boost::graph_traits&lt;G&gt;::edge_iterator
  109. edge_iterator;
  110. void constraints() {
  111. BOOST_CONCEPT_ASSERT(( GraphConcept&lt;G&gt; ));
  112. BOOST_CONCEPT_ASSERT(( MultiPassInputIteratorConcept&lt;edge_iterator&gt; ));
  113. p = edges(g);
  114. E = num_edges(g);
  115. e = *p.first;
  116. u = source(e, g);
  117. v = target(e, g);
  118. const_constraints(g);
  119. }
  120. void const_constraints(const G&amp; g) {
  121. p = edges(g);
  122. E = num_edges(g);
  123. e = *p.first;
  124. u = source(e, g);
  125. v = target(e, g);
  126. }
  127. std::pair&lt;edge_iterator,edge_iterator&gt; p;
  128. typename boost::graph_traits&lt;G&gt;::vertex_descriptor u, v;
  129. typename boost::graph_traits&lt;G&gt;::edge_descriptor e;
  130. typename boost::graph_traits&lt;G&gt;::edges_size_type E;
  131. G g;
  132. };
  133. </PRE>
  134. <br>
  135. <HR>
  136. <TABLE>
  137. <TR valign=top>
  138. <TD nowrap>Copyright &copy; 2000-2001</TD><TD>
  139. <A HREF="http://www.boost.org/people/jeremy_siek.htm">Jeremy Siek</A>, Indiana University (<A HREF="mailto:jsiek@osl.iu.edu">jsiek@osl.iu.edu</A>)
  140. </TD></TR></TABLE>
  141. </BODY>
  142. </HTML>