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<Head> 10<Title>MutablePropertyGraph</Title> 11<BODY BGCOLOR="#ffffff" LINK="#0000ee" TEXT="#000000" VLINK="#551a8b" 12 ALINK="#ff0000"> 13<IMG SRC="../../../boost.png" 14 ALT="C++ Boost" width="277" height="86"> 15 16<BR Clear> 17 18 19 20<H2> 21<A NAME="sec:MutablePropertyGraph"></A> 22MutablePropertyGraph 23</H2> 24 25A MutablePropertyGraph is a <a 26href="./MutableGraph.html">MutableGraph</a> with properties attached 27internally to the vertices and edges. When adding vertices and edges 28the value of the properties can be given. 29 30 31<H3>Refinement of</H3> 32 33<a href="./MutableGraph.html">MutableGraph</a> and 34<a href="./PropertyGraph.html">PropertyGraph</a> 35 36<H3>Notation</H3> 37 38 39<TABLE> 40 41<TR> 42<TD><tt>G</tt></TD> 43<TD>A type that is a model of Graph.</TD> 44</TR> 45 46<TR> 47<TD><tt>g</tt></TD> 48<TD>An object of type <tt>G</tt>.</TD> 49</TR> 50 51<TR> 52<TD><tt>e</tt></TD> 53<TD>An object of type <tt>boost::graph_traits<G>::edge_descriptor</tt>.</TD> 54</TR> 55 56<TR> 57<TD><tt>u,v</tt></TD> 58<TD>are objects of type <tt>boost::graph_traits<G>::vertex_descriptor</tt>.</TD> 59</TR> 60 61<TR> 62<TD><TT>ep</TT></TD><TD>is an object of type <TT>G::edge_property_type</TT></TD> 63</TR> 64 65<TR> 66<TD><TT>vp</TT></TD><TD>is an object of type <TT>G::vertex_property_type</TT></TD> 67</TR> 68 69</TABLE> 70 71<P> 72 73<H3>Associated Types</H3> 74 75<table border> 76 77<tr> 78<td>Edge Property Type </td> 79<td><TT>graph_traits<G>::edge_property_type</TT></td> 80</tr> 81 82<tr> 83<td>Vertex Property Type </td> 84<td><TT>graph_traits<G>::vertex_property_type</TT> </td> 85</tr> 86 87</table> 88 89<H3>Valid Expressions</h3> 90 91<table border> 92 93<tr> 94<TD><TT>add_edge(u, v, ep, g)</TT></TD> 95<TD>Inserts the edge <i>(u,v)</i> into the graph, and 96copies object <TT>ep</TT> into the property for that edge.<br> 97Return type: <TT>std::pair<edge_descriptor, bool></TT></TD> 98</TR> 99 100<tr> 101<TD><TT>add_vertex(vp, g)</TT></TD> 102<TD> 103Add a new vertex to the graph and copy <TT>vp</TT> into the 104property for the new vertex. The <TT>vertex_descriptor</TT> for the new 105vertex is returned.<br> 106Return type: <TT>vertex_descriptor</TT> 107</TD> 108</TR> 109 110</TABLE> 111 112 113<H3>Models</H3> 114 115<UL> 116<LI><TT>adjacency_list</TT></LI> 117</UL> 118 119<H3>Concept Checking Class</H3> 120 121<P> 122<PRE> 123 template <class G> 124 struct MutablePropertyGraphConcept 125 { 126 typedef typename boost::graph_traits<G>::edge_descriptor edge_descriptor; 127 void constraints() { 128 BOOST_CONCEPT_ASSERT(( MutableGraphConcept<G> )); 129 v = add_vertex(vp, g); 130 p = add_edge(u, v, ep, g); 131 } 132 G g; 133 std::pair<edge_descriptor, bool> p; 134 typename boost::graph_traits<G>::vertex_descriptor u, v; 135 typename boost::graph_traits<G>::vertex_property_type vp; 136 typename boost::graph_traits<G>::edge_property_type ep; 137 }; 138</PRE> 139 140 141<br> 142<HR> 143<TABLE> 144<TR valign=top> 145<TD nowrap>Copyright © 2000-2001</TD><TD> 146<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>) 147</TD></TR></TABLE> 148 149</BODY> 150</HTML> 151