Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/boost_1_33_1/libs/graph/doc/PropertyGraph.html @ 14

Last change on this file since 14 was 12, checked in by landauf, 17 years ago

added boost

File size: 5.7 KB
Line 
1<HTML>
2<!--
3  -- Copyright (c) Jeremy Siek 2000
4  --
5  -- Permission to use, copy, modify, distribute and sell this software
6  -- and its documentation for any purpose is hereby granted without fee,
7  -- provided that the above copyright notice appears in all copies and
8  -- that both that copyright notice and this permission notice appear
9  -- in supporting documentation.  Silicon Graphics makes no
10  -- representations about the suitability of this software for any
11  -- purpose.  It is provided "as is" without express or implied warranty.
12  -->
13<Head>
14<Title>PropertyGraph</Title>
15<BODY BGCOLOR="#ffffff" LINK="#0000ee" TEXT="#000000" VLINK="#551a8b" 
16        ALINK="#ff0000"> 
17<IMG SRC="../../../boost.png" 
18     ALT="C++ Boost" width="277" height="86"> 
19
20<BR Clear>
21
22<H2><A NAME="concept:PropertyGraph"></A>
23PropertyGraph
24</H2>
25
26A PropertyGraph is a graph that has some property associated with each
27of the vertices or edges in the graph. As a given graph may have
28several properties associated with each vertex or edge, a tag is used
29to identity which property is being accessed.  The graph provides a
30function which returns a property map object.
31
32<P>
33
34<H3>Refinement of</H3>
35
36<a href="./Graph.html">Graph</a>
37
38<h3>Notation</h3>
39
40<Table>
41<TR>
42<TD><tt>G</tt></TD>
43<TD>A type that is a model of PropertyGraph.</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>X</tt></TD>
53<TD>Either the vertex or edge descriptor type for <tt>G</tt>.</TD>
54</TR>
55
56<TR>
57<TD><tt>x</tt></TD>
58<TD>An object of type <tt>X</tt>.</TD>
59</TR>
60
61
62<TR>
63<TD><tt>Map</tt></TD>
64<TD>The type <tt>boost::property_map&lt;G, Property&gt;::const_type</tt>.</TD>
65</TR>
66
67<TR>
68<TD><tt>v</tt></TD>
69<TD>An object of type <tt>boost::property_traits&lt;Map&gt;::value_type</tt>.</TD>
70</TR>
71
72<TR>
73<TD><tt>PropertyTag</tt></TD>
74<TD>A type that models the <a href="./PropertyTag.html">PropertyTag</a> concept.</TD>
75</TR>
76
77<TR>
78<TD><tt>p</tt></TD>
79<TD>An object of type <tt>PropertyTag</tt>.</td>
80</TR>
81
82<TR>
83<TD><tt>pmap</tt></TD>
84<TD>An object of type <tt>Map</tt>.</td>
85</TR>
86
87</table>
88
89<H3>Associated types</H3>
90
91<table border>
92
93<tr>
94<td><pre>boost::property_map&lt;G, PropertyTag&gt;::type</pre>
95The type of the property map for the property specified by
96<TT>PropertyTag</TT>.  This type must be a model of <a
97href="../../property_map/ReadWritePropertyMap.html">ReadWritePropertyMap</a> 
98with a key type the same as the graph's vertex or edge descriptor type.
99</td>
100</tr>
101
102<tr>
103<td><pre>boost::property_map&lt;G, PropertyTag&gt;::const_type</pre>
104The type of the const property map for the property specified by
105<TT>PropertyTag</TT>. This type must be a model of <a
106href="../../property_map/ReadablePropertyMap.html">ReadablePropertyMap</a>
107with a key type the same as the graph's vertex or edge descriptor type.
108</td>
109</tr>
110
111</table>
112
113<h3>Valid Expressions</h3>
114
115<table border>
116
117<tr>
118<td> <TT>get(p,&nbsp;g)</TT> </td>
119<td>
120Returns the property map for the property specified by the
121<tt>PropertyTag</tt> type. The object <tt>p</tt> is only used to
122carry the type.<br>
123Return type: <TT>boost::property_map&lt;G,&nbsp;PropertyTag&gt;::type</TT> if <TT>g</TT> is mutable and <br><TT>boost::property_map&lt;G,&nbsp;PropertyTag&gt;::const_type</TT> otherwise.
124</td>
125</TR>
126
127<tr>
128<td> <TT>get(p,&nbsp;g,&nbsp;x)</TT> </td>
129<td>
130Returns the property value (specified by the <tt>PropertyTag</tt> type)
131associated with object <tt>x</tt> (a vertex or edge).
132The object <tt>p</tt> is only used to carry the type.
133This function is equivalent to:<br>
134<tt>get(get(p, g), x)</tt><br>
135Return type: <tt>boost::property_traits&lt;Map&gt;::value_type</tt>
136</td>
137</TR>
138
139<tr>
140<td> <TT>put(p,&nbsp;g,&nbsp;x,&nbsp;v)</TT> </td>
141<td>
142Set the property (specified by the <tt>PropertyTag</tt> type)
143associated with object <tt>x</tt> (a vertex or edge) to
144the value <tt>v</tt>. The object <tt>p</tt> is only used to carry the type.
145This function is equivalent to:<br>
146<tt>
147pmap = get(p, g);<br>
148put(pmap, x, v)
149</tt><br>
150Return type: <TT>void</TT>
151</td>
152</TR>
153
154
155</TABLE>
156
157<H3>Complexity</H3>
158
159The <tt>get()</tt> property map function must be constant time.
160
161
162<H3>Models</H3>
163
164
165<UL>
166<LI><tt>adjacency_list</tt> with <tt>VertexProperty=property&lt;vertex_distance_t,int,property&lt;vertex_in_degree_t,int&gt; &gt;</tt> and <tt>PropertyTag=vertex_distance_t</tt>.</li>
167<li><tt>adjacency_list</tt> with <tt>VertexPropertyTag=property&lt;vertex_distance_t,int,property&lt;vertex_in_degree_t,int&gt; &gt;</TT> and <tt>PropertyTag=vertex_in_degree_t</tt>.</li>
168</UL>
169
170
171<H3>Concept Checking Class</H3>
172
173<PRE>
174  template &lt;class Graph, class X, class PropertyTag&gt;
175  struct PropertyGraphConcept
176  {
177    typedef typename property_map&lt;G, PropertyTag&gt;::type Map;
178    typedef typename property_map&lt;G, PropertyTag&gt;::const_type const_Map;
179    void constraints() {
180      function_requires&lt; GraphConcept&lt;G&gt; &gt;();
181      function_requires&lt; ReadWritePropertyMapConcept&lt;Map, X&gt; &gt;();
182      function_requires&lt; ReadablePropertyMapConcept&lt;const_Map, X&gt; &gt;();
183
184      Map pmap = get(PropertyTag(), g);
185      pval = get(PropertyTag(), g, x);
186      put(PropertyTag(), g, x, pval);
187      ignore_unused_variable_warning(pmap);
188    }
189    void const_constraints(const G&amp; g) {
190      const_Map pmap = get(PropertyTag(), g);
191      pval = get(PropertyTag(), g, x);
192      ignore_unused_variable_warning(pmap);
193    }
194    G g;
195    X x;
196    typename property_traits&lt;Map&gt;::value_type pval;
197  };
198</PRE>
199
200
201<h3>See Also</h3>
202
203<a href="./property_map.html"><tt>property_map</tt></a>
204
205<br>
206<HR>
207<TABLE>
208<TR valign=top>
209<TD nowrap>Copyright &copy 2000-2001</TD><TD>
210<A HREF="../../../people/jeremy_siek.htm">Jeremy Siek</A>, Indiana University (<A HREF="mailto:jsiek@osl.iu.edu">jsiek@osl.iu.edu</A>)
211</TD></TR></TABLE>
212
213</BODY>
214</HTML> 
Note: See TracBrowser for help on using the repository browser.