MutablePropertyGraph.html 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  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>MutablePropertyGraph</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>
  16. <A NAME="sec:MutablePropertyGraph"></A>
  17. MutablePropertyGraph
  18. </H2>
  19. A MutablePropertyGraph is a <a
  20. href="./MutableGraph.html">MutableGraph</a> with properties attached
  21. internally to the vertices and edges. When adding vertices and edges
  22. the value of the properties can be given.
  23. <H3>Refinement of</H3>
  24. <a href="./MutableGraph.html">MutableGraph</a> and
  25. <a href="./PropertyGraph.html">PropertyGraph</a>
  26. <H3>Notation</H3>
  27. <TABLE>
  28. <TR>
  29. <TD><tt>G</tt></TD>
  30. <TD>A type that is a model of Graph.</TD>
  31. </TR>
  32. <TR>
  33. <TD><tt>g</tt></TD>
  34. <TD>An object of type <tt>G</tt>.</TD>
  35. </TR>
  36. <TR>
  37. <TD><tt>e</tt></TD>
  38. <TD>An object of type <tt>boost::graph_traits&lt;G&gt;::edge_descriptor</tt>.</TD>
  39. </TR>
  40. <TR>
  41. <TD><tt>u,v</tt></TD>
  42. <TD>are objects of type <tt>boost::graph_traits&lt;G&gt;::vertex_descriptor</tt>.</TD>
  43. </TR>
  44. <TR>
  45. <TD><TT>ep</TT></TD><TD>is an object of type <TT>G::edge_property_type</TT></TD>
  46. </TR>
  47. <TR>
  48. <TD><TT>vp</TT></TD><TD>is an object of type <TT>G::vertex_property_type</TT></TD>
  49. </TR>
  50. </TABLE>
  51. <P>
  52. <H3>Associated Types</H3>
  53. <table border>
  54. <tr>
  55. <td>Edge Property Type </td>
  56. <td><TT>graph_traits&lt;G&gt;::edge_property_type</TT></td>
  57. </tr>
  58. <tr>
  59. <td>Vertex Property Type </td>
  60. <td><TT>graph_traits&lt;G&gt;::vertex_property_type</TT> </td>
  61. </tr>
  62. </table>
  63. <H3>Valid Expressions</h3>
  64. <table border>
  65. <tr>
  66. <TD><TT>add_edge(u,&nbsp;v,&nbsp;ep,&nbsp;g)</TT></TD>
  67. <TD>Inserts the edge <i>(u,v)</i> into the graph, and
  68. copies object <TT>ep</TT> into the property for that edge.<br>
  69. Return type: <TT>std::pair&lt;edge_descriptor, bool&gt;</TT></TD>
  70. </TR>
  71. <tr>
  72. <TD><TT>add_vertex(vp,&nbsp;g)</TT></TD>
  73. <TD>
  74. Add a new vertex to the graph and copy <TT>vp</TT> into the
  75. property for the new vertex. The <TT>vertex_descriptor</TT> for the new
  76. vertex is returned.<br>
  77. Return type: <TT>vertex_descriptor</TT>
  78. </TD>
  79. </TR>
  80. </TABLE>
  81. <H3>Models</H3>
  82. <UL>
  83. <LI><TT>adjacency_list</TT></LI>
  84. </UL>
  85. <H3>Concept Checking Class</H3>
  86. <P>
  87. <PRE>
  88. template &lt;class G&gt;
  89. struct MutablePropertyGraphConcept
  90. {
  91. typedef typename boost::graph_traits&lt;G&gt;::edge_descriptor edge_descriptor;
  92. void constraints() {
  93. BOOST_CONCEPT_ASSERT(( MutableGraphConcept&lt;G&gt; ));
  94. v = add_vertex(vp, g);
  95. p = add_edge(u, v, ep, g);
  96. }
  97. G g;
  98. std::pair&lt;edge_descriptor, bool&gt; p;
  99. typename boost::graph_traits&lt;G&gt;::vertex_descriptor u, v;
  100. typename boost::graph_traits&lt;G&gt;::vertex_property_type vp;
  101. typename boost::graph_traits&lt;G&gt;::edge_property_type ep;
  102. };
  103. </PRE>
  104. <br>
  105. <HR>
  106. <TABLE>
  107. <TR valign=top>
  108. <TD nowrap>Copyright &copy; 2000-2001</TD><TD>
  109. <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>)
  110. </TD></TR></TABLE>
  111. </BODY>
  112. </HTML>