AdjacencyMatrix.html 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  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>AdjacencyMatrix</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:AdjacencyMatrix"></A>
  16. AdjacencyMatrix
  17. </H2>
  18. <P>
  19. The AdjacencyMatrix concept refines <a href="./Graph.html">Graph</a>
  20. concept and adds the requirement for efficient access to any edge in
  21. the graph given the source and target vertices. No Boost Graph Library
  22. algorithms currently use this concept. However there are algorithms
  23. not yet implemented such as Floyd-Warshall that would require this
  24. concept.
  25. <H3>Refinement of</H3>
  26. <a href="./Graph.html">Graph</a>
  27. <H3>Associated Types</H3>
  28. <Table border>
  29. <tr>
  30. <td><tt>boost::graph_traits&lt;G&gt;::traversal_category</tt><br><br>
  31. This tag type must be convertible to <tt>adjacency_matrix_tag</tt>.
  32. </td>
  33. </tr>
  34. </table>
  35. <H3>Valid Expressions</H3>
  36. <table border>
  37. <tr>
  38. <th>Name</th><th>Expression</th><th>Return Type</th><th>Description</th>
  39. </tr>
  40. <tr>
  41. <td>Direct Edge Access</td>
  42. <TD><TT>edge(u,v,g)</TT></TD>
  43. <TD><TT>std::pair&lt;edge_descriptor, bool&gt;</TT></TD>
  44. <TD>
  45. Returns a pair consisting of a flag saying whether there exists an
  46. edge between <TT>u</TT> and <TT>v</TT> in graph <TT>g</TT>, and
  47. consisting of the edge descriptor if the edge was found.
  48. </TD>
  49. </TR>
  50. </TABLE>
  51. <H3>Complexity guarantees</H3>
  52. The <TT>edge()</TT> function must return in constant time.
  53. <H3>Models</H3>
  54. <a href="./adjacency_matrix.html"><tt>adjacency_matrix</tt></a>
  55. <H3>Concept Checking Class</H3>
  56. <PRE>
  57. template &lt;class G&gt;
  58. struct AdjacencyMatrix
  59. {
  60. typedef typename boost::graph_traits&lt;G&gt;::edge_descriptor edge_descriptor;
  61. void constraints() {
  62. p = edge(u, v, g);
  63. }
  64. typename boost::graph_traits&lt;G&gt;::vertex_descriptor u, v;
  65. std::pair&lt;bool, edge_descriptor&gt; p;
  66. G g;
  67. };
  68. </PRE>
  69. <br>
  70. <HR>
  71. <TABLE>
  72. <TR valign=top>
  73. <TD nowrap>Copyright &copy; 2000-2001</TD><TD>
  74. <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>)
  75. </TD></TR></TABLE>
  76. </BODY>
  77. </HTML>