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>Boost Graph Library: Transpose Graph
</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 <H1><TT>transpose_graph
</TT></H1>
21 template
<class
<a href=
"./VertexListGraph.html">VertexListGraph
</a>, class
<a href=
"./MutableGraph.html">MutableGraph
</a>>
22 void transpose_graph(const VertexListGraph
& G, MutableGraph
& G_T,
23 const bgl_named_params
<P, T, R
>& params =
<i>all defaults
</i>)
27 This function computes the transpose of a directed graph. The
28 transpose of a directed graph
<i>G = (V, E)
</i>is the graph
29 <i>G
<sup>T
</sup> = (V, E
<sup>T
</sup>)
</i> , where
<i>E
<sup>T
</sup> =
30 {(v, u) in V x V: (u, v) in E}
</i> . i.e.,
<i>G
<sup>T
</sup></i> is
31 <i>G
</i> with all its edges reversed. Graph
<TT>G_T
</TT> passed into
32 the algorithm must have no vertices and
33 no edges. The vertices and edges will be added by
<tt>transpose_graph()
</tt> by
34 calling
<tt>add_vertex
</tt> and
<tt>add_edge
</tt> as follows for each edge
35 <i>(u,v)
</i> in
<tt>G
</tt>.
39 Here's an example of transposing a graph:
40 <a href=
"../example/transpose-example.cpp"><tt>example/transpose-example.cpp
</tt></a>.
42 <H3>Where Defined
</H3>
45 <a href=
"../../../boost/graph/transpose_graph.hpp"><TT>boost/graph/transpose_graph.hpp
</TT></a>
51 IN:
<tt>const VertexListGraph
& G
</tt>
53 A directed graph. The graph type must be a model of
<a href=
"./VertexListGraph.html">Vertex List Graph
</a>.
56 OUT:
<tt>const MutableGraph
& G_T
</tt>
58 The transposed graph. The graph type must be a model of
<a
59 href=
"./MutableGraph.html">Mutable Graph
</a>.
62 <h3>Named Parameters
</h3>
64 IN:
<tt>vertex_copy(VertexCopier vc)
</tt>
66 This is a
<a href=
"http://www.sgi.com/tech/stl/BinaryFunction.html">Binary Function
</a> that copies the properties of a vertex in the original graph
67 into the corresponding vertex in the copy.
<br>
69 <b>Default:
</b> <tt>vertex_copier
<VertexListGraph, MutableGraph
></tt>
70 which uses the property tag
<tt>vertex_all
</tt> to access a property
74 IN:
<tt>edge_copy(EdgeCopier ec)
</tt>
76 This is a
<a href=
"http://www.sgi.com/tech/stl/BinaryFunction.html">Binary Function
</a> that copies the properties of an edge in the original graph
77 into the corresponding edge in the copy.
<br>
79 <b>Default:
</b> <tt>edge_copier
<VertexListGraph, MutableGraph
></tt>
80 which uses the property tag
<tt>edge_all
</tt> to access a property
84 IN:
<tt>vertex_index_map(VertexIndexMap i_map)
</tt>
86 The vertex index map type must be a model of
<a
87 href=
"../../property_map/ReadablePropertyMap.html">Readable Property
88 Map
</a> and must map the vertex descriptors of
<tt>G
</tt> to the
89 integers from
0 to
<tt>num_vertices(G)
</tt>.
<br>
91 <b>Default:
</b> <tt>get(vertex_index, G)
</tt>
92 Note: if you use this default, make sure your graph has
93 an internal
<tt>vertex_index
</tt> property. For example,
94 <tt>adjacenty_list
</tt> with
<tt>VertexList=listS
</tt> does
95 not have an internal
<tt>vertex_index
</tt> property.
99 UTIL/OUT:
<tt>orig_to_copy(Orig2CopyMap c)
</tt>
101 This maps vertices in the original graph to vertices in the copy.
103 <b>Default:
</b> an
<a
104 href=
"../../property_map/iterator_property_map.html">
105 </tt>iterator_property_map
</tt></a> created from a
106 <tt>std::vector
</tt> of the output graph's vertex descriptor type of size
107 <tt>num_vertices(g)
</tt> and using the
<tt>i_map
</tt> for the index
114 The time complexity is
<i>O(V + E)
</i>.
122 <TD nowrap
>Copyright ©
2000-
2001</TD><TD>
123 <A HREF=
"../../../people/jeremy_siek.htm">Jeremy Siek
</A>, Indiana University (
<A HREF=
"mailto:jsiek@osl.iu.edu">jsiek@osl.iu.edu
</A>)