3 Copyright (c) Jeremy Siek, Lie-Quan Lee, and Andrew Lumsdaine 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>Boost Graph Library: Graph Traits
</Title>
11 <BODY BGCOLOR=
"#ffffff" LINK=
"#0000ee" TEXT=
"#000000" VLINK=
"#551a8b"
13 <IMG SRC=
"../../../boost.png"
14 ALT=
"C++ Boost" width=
"277" height=
"86">
20 graph_traits
<<a href=
"./Graph.html">Graph
</a>>
25 href=
"http://www.sgi.com/tech/stl/iterator_traits.html">
26 iterators
</a> of STL, graphs have
<b>associated types
</b>. As stated
27 in the various
<a href=
"./graph_concepts.html">graph concepts
</a>, a
28 graph has quite a few associated types:
<tt>vertex_descriptor
</tt>,
29 <tt>edge_descriptor
</tt>,
<tt>out_edge_iterator
</tt>, etc.. Any
30 particular graph concepts will not require that all of the following
31 associated types be defined. When implementing a graph class that
32 fullfils one or more graph concepts, for associated types that are not
33 required by the concepts, it is ok to use
<tt>void
</tt> as the type
34 (when using nested typedefs inside the graph class), or to leave the
35 typedef out of the
<tt>graph_traits
</tt> specialization for the graph
37 Note that because of the use of traits classes rather than member
38 types, it is not safe (and often will not work) to define subclasses of BGL
39 graph types; those types may be missing important traits and properties that
40 were defined externally to the class definition.
43 template
<typename Graph
>
45 typedef typename Graph::vertex_descriptor vertex_descriptor;
46 typedef typename Graph::edge_descriptor edge_descriptor;
47 typedef typename Graph::adjacency_iterator adjacency_iterator;
48 typedef typename Graph::out_edge_iterator out_edge_iterator;
49 typedef typename Graph::in_edge_iterator in_edge_iterator;
50 typedef typename Graph::vertex_iterator vertex_iterator;
51 typedef typename Graph::edge_iterator edge_iterator;
53 typedef typename Graph::directed_category directed_category;
54 typedef typename Graph::edge_parallel_category edge_parallel_category;
55 typedef typename Graph::traversal_category traversal_category;
57 typedef typename Graph::vertices_size_type vertices_size_type;
58 typedef typename Graph::edges_size_type edges_size_type;
59 typedef typename Graph::degree_size_type degree_size_type;
63 <h3>Where Defined
</h3>
65 <a href=
"../../../boost/graph/graph_traits.hpp"><tt>boost/graph/graph_traits.hpp
</tt></a>
67 <H3>Template Parameters
</H3>
72 <th>Parameter
</th><th>Description
</th>
75 <TR><TD><TT>Graph
</TT></TD>
77 The graph type whose associated types are being accessed.
86 href=
"http://www.sgi.com/tech/stl/DefaultConstructible.html">DefaultConstructible
</a> and
87 <a href=
"http://www.sgi.com/tech/stl/Assignable.html">Assignable
</a>
89 <h3>Type Requirements
</h3>
92 <li><tt>Graph
</tt> is a model of one of the
<a
93 href=
"./graph_concepts.html">graph concepts
</a>.
102 <th>Member
</th><th>Description
</th>
110 The type for the objects used to identity vertices in the graph.
119 The type for the objects used to identity edges in the graph.
128 The type for the iterators that traverse the vertices adjacent
138 The type for the iterators that traverse through the out-edges
148 The type for the iterators that traverse through the in-edges
158 The type for the iterators that traverse through the complete vertex
168 The type for the iterators that traverse through the complete edge
178 This says whether the graph is undirected (
<tt>undirected_tag
</tt>)
179 or directed (
<tt>directed_tag
</tt>).
185 edge_parallel_category
188 This says whether the graph allows parallel edges to be inserted
189 (
<tt>allow_parallel_edge_tag
</tt>) or if it automatically removes
190 parallel edges (
<tt>disallow_parallel_edge_tag
</tt>).
199 The ways in which the vertices in the graph can be traversed.
200 The traversal category tags are:
201 <tt>incidence_graph_tag, adjacency_graph_tag,
202 bidirectional_graph_tag, vertex_list_graph_tag,
203 edge_list_graph_tag, vertex_and_edge_list_graph_tag,
204 adjacency_matrix_tag
</tt>. You can also create your own
205 tag which should inherit from one of the above.
214 The unsigned integer type used for representing the number of
215 vertices in the graph.
224 The unsigned integer type used for representing the number of
234 The unsigned integer type used for representing the degree
235 of vertices in the graph.
245 <TD nowrap
>Copyright
© 2000-
2001</TD><TD>
246 <A HREF=
"http://www.boost.org/people/jeremy_siek.htm">Jeremy Siek
</A>,
247 Indiana University (
<A
248 HREF=
"mailto:jsiek@osl.iu.edu">jsiek@osl.iu.edu
</A>)
<br>
249 <A HREF=
"http://www.boost.org/people/liequan_lee.htm">Lie-Quan Lee
</A>, Indiana University (
<A HREF=
"mailto:llee@cs.indiana.edu">llee@cs.indiana.edu
</A>)
<br>
250 <A HREF=
"http://www.osl.iu.edu/~lums">Andrew Lumsdaine
</A>,
251 Indiana University (
<A
252 HREF=
"mailto:lums@osl.iu.edu">lums@osl.iu.edu
</A>)