3 Copyright (c) Jeremy Siek 2000
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)
10 <Title>PropertyGraph
</Title>
11 <BODY BGCOLOR=
"#ffffff" LINK=
"#0000ee" TEXT=
"#000000" VLINK=
"#551a8b"
13 <IMG SRC=
"../../../boost.png"
14 ALT=
"C++ Boost" width=
"277" height=
"86">
18 <H2><A NAME=
"concept:PropertyGraph"></A>
22 A PropertyGraph is a graph that has some property associated with each
23 of the vertices or edges in the graph. As a given graph may have
24 several properties associated with each vertex or edge, a tag is used
25 to identify which property is being accessed. The graph provides a
26 function which returns a property map object.
30 <H3>Refinement of
</H3>
32 <a href=
"./Graph.html">Graph
</a>
39 <TD>A type that is a model of PropertyGraph.
</TD>
44 <TD>An object of type
<tt>G
</tt>.
</TD>
49 <TD>Either the vertex or edge descriptor type for
<tt>G
</tt>.
</TD>
54 <TD>An object of type
<tt>X
</tt>.
</TD>
60 <TD>The type
<tt>boost::property_map
<G, Property
>::const_type
</tt>.
</TD>
65 <TD>An object of type
<tt>boost::property_traits
<Map
>::value_type
</tt>.
</TD>
69 <TD><tt>PropertyTag
</tt></TD>
70 <TD>A type that models the
<a href=
"./PropertyTag.html">PropertyTag
</a> concept.
</TD>
75 <TD>An object of type
<tt>PropertyTag
</tt>.
</td>
79 <TD><tt>pmap
</tt></TD>
80 <TD>An object of type
<tt>Map
</tt>.
</td>
85 <H3>Associated types
</H3>
90 <td><pre>boost::property_map
<G, PropertyTag
>::type
</pre>
91 The type of the property map for the property specified by
92 <TT>PropertyTag
</TT>. This type must be a model of
<a
93 href=
"../../property_map/doc/ReadWritePropertyMap.html">ReadWritePropertyMap
</a>
94 with a key type the same as the graph's vertex or edge descriptor type.
99 <td><pre>boost::property_map
<G, PropertyTag
>::const_type
</pre>
100 The type of the const property map for the property specified by
101 <TT>PropertyTag
</TT>. This type must be a model of
<a
102 href=
"../../property_map/doc/ReadablePropertyMap.html">ReadablePropertyMap
</a>
103 with a key type the same as the graph's vertex or edge descriptor type.
109 <h3>Valid Expressions
</h3>
114 <td> <TT>get(p,
g)
</TT> </td>
116 Returns the property map for the property specified by the
117 <tt>PropertyTag
</tt> type. The object
<tt>p
</tt> is only used to
119 Return type:
<TT>boost::property_map
<G,
PropertyTag
>::type
</TT> if
<TT>g
</TT> is mutable and
<br><TT>boost::property_map
<G,
PropertyTag
>::const_type
</TT> otherwise.
124 <td> <TT>get(p,
g,
x)
</TT> </td>
126 Returns the property value (specified by the
<tt>PropertyTag
</tt> type)
127 associated with object
<tt>x
</tt> (a vertex or edge).
128 The object
<tt>p
</tt> is only used to carry the type.
129 This function is equivalent to:
<br>
130 <tt>get(get(p, g), x)
</tt><br>
131 Return type:
<tt>boost::property_traits
<Map
>::value_type
</tt>
136 <td> <TT>put(p,
g,
x,
v)
</TT> </td>
138 Set the property (specified by the
<tt>PropertyTag
</tt> type)
139 associated with object
<tt>x
</tt> (a vertex or edge) to
140 the value
<tt>v
</tt>. The object
<tt>p
</tt> is only used to carry the type.
141 This function is equivalent to:
<br>
143 pmap = get(p, g);
<br>
146 Return type:
<TT>void
</TT>
155 The
<tt>get()
</tt> property map function must be constant time.
162 <LI><tt>adjacency_list
</tt> with
<tt>VertexProperty=property
<vertex_distance_t,int,property
<vertex_in_degree_t,int
> ></tt> and
<tt>PropertyTag=vertex_distance_t
</tt>.
</li>
163 <li><tt>adjacency_list
</tt> with
<tt>VertexPropertyTag=property
<vertex_distance_t,int,property
<vertex_in_degree_t,int
> ></TT> and
<tt>PropertyTag=vertex_in_degree_t
</tt>.
</li>
167 <H3>Concept Checking Class
</H3>
170 template
<class Graph, class X, class PropertyTag
>
171 struct PropertyGraphConcept
173 typedef typename property_map
<G, PropertyTag
>::type Map;
174 typedef typename property_map
<G, PropertyTag
>::const_type const_Map;
176 BOOST_CONCEPT_ASSERT(( GraphConcept
<G
> ));
177 BOOST_CONCEPT_ASSERT(( ReadWritePropertyMapConcept
<Map, X
> ));
178 BOOST_CONCEPT_ASSERT(( ReadablePropertyMapConcept
<const_Map, X
> ));
180 Map pmap = get(PropertyTag(), g);
181 pval = get(PropertyTag(), g, x);
182 put(PropertyTag(), g, x, pval);
183 ignore_unused_variable_warning(pmap);
185 void const_constraints(const G
& g) {
186 const_Map pmap = get(PropertyTag(), g);
187 pval = get(PropertyTag(), g, x);
188 ignore_unused_variable_warning(pmap);
192 typename property_traits
<Map
>::value_type pval;
199 <a href=
"./property_map.html"><tt>property_map
</tt></a>
205 <TD nowrap
>Copyright
© 2000-
2001</TD><TD>
206 <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>)