File: graph_traits.html

package info (click to toggle)
boost 1.27.0-3
  • links: PTS
  • area: main
  • in suites: woody
  • size: 19,908 kB
  • ctags: 26,546
  • sloc: cpp: 122,225; ansic: 10,956; python: 4,412; sh: 855; yacc: 803; makefile: 257; perl: 165; lex: 90; csh: 6
file content (256 lines) | stat: -rw-r--r-- 6,149 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
<HTML>
<!--
  -- Copyright (c) Jeremy Siek, Lie-Quan Lee, and Andrew Lumsdaine 2000
  --
  -- Permission to use, copy, modify, distribute and sell this software
  -- and its documentation for any purpose is hereby granted without fee,
  -- provided that the above copyright notice appears in all copies and
  -- that both that copyright notice and this permission notice appear
  -- in supporting documentation.  We make no
  -- representations about the suitability of this software for any
  -- purpose.  It is provided "as is" without express or implied warranty.
  -->
<Head>
<Title>Boost Graph Library: Graph Traits</Title>
<BODY BGCOLOR="#ffffff" LINK="#0000ee" TEXT="#000000" VLINK="#551a8b" 
        ALINK="#ff0000"> 
<IMG SRC="../../../c++boost.gif" 
     ALT="C++ Boost" width="277" height="86"> 

<BR Clear>

<H1><A NAME=""></A>
<pre>
graph_traits&lt;<a href="./Graph.html">Graph</a>&gt;
</pre>
</H1>

Just like the <a
href="http://www.sgi.com/tech/stl/iterator_traits.html">
iterators</a> of STL, graphs have <b>associated types</b>.  As stated
in the various <a href="./graph_concepts.html">graph concepts</a>, a
graph has quite a few associated types: <tt>vertex_descriptor</tt>,
<tt>edge_descriptor</tt>, <tt>out_edge_iterator</tt>, etc..  Any
particular graph concepts will not require that all of the following
associated types be defined. When implementing a graph class that
fullfils one or more graph concepts, for associated types that are not
required by the concepts, it is ok to use <tt>void</tt> as the type
(when using nested typedefs inside the graph class), or to leave the
typedef out of the <tt>graph_traits</tt> specialization for the graph
class.

<pre>
  template &lt;typename Graph&gt;
  struct graph_traits {
    typedef typename Graph::vertex_descriptor      vertex_descriptor;
    typedef typename Graph::edge_descriptor        edge_descriptor;
    typedef typename Graph::adjacency_iterator     adjacency_iterator;
    typedef typename Graph::out_edge_iterator      out_edge_iterator;
    typedef typename Graph::in_edge_iterator       in_edge_iterator;
    typedef typename Graph::vertex_iterator        vertex_iterator;
    typedef typename Graph::edge_iterator          edge_iterator;

    typedef typename Graph::directed_category      directed_category;
    typedef typename Graph::edge_parallel_category edge_parallel_category;
    typedef typename Graph::traversal_category     traversal_category;

    typedef typename Graph::vertices_size_type     vertices_size_type;
    typedef typename Graph::edges_size_type        edges_size_type;
    typedef typename Graph::degree_size_type       degree_size_type;
  };
</pre>

<h3>Where Defined</h3>

<a href="../../../boost/graph/graph_traits.hpp"><tt>boost/graph/graph_traits.hpp</tt></a>

<H3>Template Parameters</H3>

<P>
<TABLE border>
<TR>
<th>Parameter</th><th>Description</th>
</tr>

<TR><TD><TT>Graph</TT></TD>
<TD>
The graph type whose associated types are being accessed.
</TD>
</TR>

</table>

<h3>Model of</h3>

<a
href="http://www.sgi.com/tech/stl/DefaultConstructible.html">DefaultConstructible</a> and
<a href="http://www.sgi.com/tech/stl/Assignable.html">Assignable</a>

<h3>Type Requirements</h3>

<ul>
  <li><tt>Graph</tt> is a model of one of the <a
  href="./graph_concepts.html">graph concepts</a>.
</ul>

<H2>Members</H2>

<p>

<table border>
<tr>
<th>Member</th><th>Description</th>
</tr>

<tr>
<td><tt>
vertex_descriptor
</tt></td>
<td>
The type for the objects used to identity vertices in the graph.
</td>
</tr>

<tr>
<td><tt>
edge_descriptor
</tt></td>
<td>
The type for the objects used to identity edges in the graph.
</td>
</tr>

<tr>
<td><tt>
adjacency_iterator
</tt></td>
<td>
The type for the iterators that traverse the vertices adjacent
to a vertex.
</td>
</tr>

<tr>
<td><tt>
out_edge_iterator
</tt></td>
<td>
The type for the iterators that traverse through the out-edges
of a vertex.
</td>
</tr>

<tr>
<td><tt>
in_edge_iterator
</tt></td>
<td>
The type for the iterators that traverse through the in-edges
of a vertex.
</td>
</tr>

<tr>
<td><tt>
vertex_iterator
</tt></td>
<td>
The type for the iterators that traverse through the complete vertex
set of the graph.
</td>
</tr>

<tr>
<td><tt>
edge_iterator
</tt></td>
<td>
The type for the iterators that traverse through the complete edge
set of the graph.
</td>
</tr>

<tr>
<td><tt>
directed_category
</tt></td>
<td>
This says whether the graph is undirected (<tt>undirected_tag</tt>)
or directed (<tt>directed_tag</tt>).
</td>
</tr>

<tr>
<td><tt>
edge_parallel_category
</tt></td>
<td>
This says whether the graph allows parallel edges to be inserted
(<tt>allow_parallel_edge_tag</tt>) or if it automatically removes
parallel edges (<tt>disallow_parallel_edge_tag</tt>).
</td>
</tr>

<tr>
<td><tt>
traversal_category
</tt></td>
<td>
The ways in which the vertices in the graph can be traversed.
The traversal category tags are: 
<tt>incidence_graph_tag, adjacency_graph_tag,
bidirectional_graph_tag, vertex_list_graph_tag,
edge_list_graph_tag, vertex_and_edge_list_graph_tag,
adjacency_matrix_tag</tt>. You can also create your own
tag which should inherit from one of the above. 
</td>
</tr>

<tr>
<td><tt>
vertices_size_type
</tt></td>
<td>
The unsigned integer type used for representing the number of
vertices in the graph.
</td>
</tr>

<tr>
<td><tt>
edge_size_type
</tt></td>
<td>
The unsigned integer type used for representing the number of
edge in the graph.
</td>
</tr>

<tr>
<td><tt>
degree_size_type
</tt></td>
<td>
The unsigned integer type used for representing the degree
of vertices in the graph.
</td>
</tr>

</table>

<br>
<HR>
<TABLE>
<TR valign=top>
<TD nowrap>Copyright &copy 2000-2001</TD><TD>
<A HREF="../../../people/jeremy_siek.htm">Jeremy Siek</A>,
Indiana University (<A
HREF="mailto:jsiek@osl.iu.edu">jsiek@osl.iu.edu</A>)<br>
<A HREF="../../../people/liequan_lee.htm">Lie-Quan Lee</A>, Indiana University (<A HREF="mailto:llee@cs.indiana.edu">llee@cs.indiana.edu</A>)<br>
<A HREF=http://www.osl.iu.edu/~lums>Andrew Lumsdaine</A>,
Indiana University (<A
HREF="mailto:lums@osl.iu.edu">lums@osl.iu.edu</A>)
</TD></TR></TABLE>

</BODY>
</HTML>