Improve vacpp support.
[boost.git] / boost / libs / graph / doc / transpose_graph.html
blob726a6946b0d0a1e448bbf20b3ddc00895fa930ef
1 <HTML>
2 <!--
3 -- Copyright (c) Jeremy Siek 2000
4 --
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)
8 -->
9 <Head>
10 <Title>Boost Graph Library: Transpose Graph</Title>
11 <BODY BGCOLOR="#ffffff" LINK="#0000ee" TEXT="#000000" VLINK="#551a8b"
12 ALINK="#ff0000">
13 <IMG SRC="../../../boost.png"
14 ALT="C++ Boost" width="277" height="86">
16 <BR Clear>
18 <H1><TT>transpose_graph</TT></H1>
20 <PRE>
21 template &lt;class <a href="./VertexListGraph.html">VertexListGraph</a>, class <a href="./MutableGraph.html">MutableGraph</a>&gt;
22 void transpose_graph(const VertexListGraph&amp; G, MutableGraph&amp; G_T,
23 const bgl_named_params&lt;P, T, R&gt;&amp; params = <i>all defaults</i>)
24 </PRE>
26 <P>
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>.
37 <H3>Example</H3>
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>
44 <P>
45 <a href="../../../boost/graph/transpose_graph.hpp"><TT>boost/graph/transpose_graph.hpp</TT></a>
47 <P>
49 <H3>Parameters</H3>
51 IN: <tt>const VertexListGraph&amp; G</tt>
52 <blockquote>
53 A directed graph. The graph type must be a model of <a href="./VertexListGraph.html">Vertex List Graph</a>.
54 </blockquote>
56 OUT: <tt>const MutableGraph&amp; G_T</tt>
57 <blockquote>
58 The transposed graph. The graph type must be a model of <a
59 href="./MutableGraph.html">Mutable Graph</a>.
60 </blockquote>
62 <h3>Named Parameters</h3>
64 IN: <tt>vertex_copy(VertexCopier vc)</tt>
65 <blockquote>
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&lt;VertexListGraph, MutableGraph&gt;</tt>
70 which uses the property tag <tt>vertex_all</tt> to access a property
71 map from the graph.
72 </blockquote>
74 IN: <tt>edge_copy(EdgeCopier ec)</tt>
75 <blockquote>
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&lt;VertexListGraph, MutableGraph&gt;</tt>
80 which uses the property tag <tt>edge_all</tt> to access a property
81 map from the graph.
82 </blockquote>
84 IN: <tt>vertex_index_map(VertexIndexMap i_map)</tt>
85 <blockquote>
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.
96 </blockquote>
99 UTIL/OUT: <tt>orig_to_copy(Orig2CopyMap c)</tt>
100 <blockquote>
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
108 map.
109 </blockquote>
111 <H3>Complexity</H3>
114 The time complexity is <i>O(V + E)</i>.
118 <br>
119 <HR>
120 <TABLE>
121 <TR valign=top>
122 <TD nowrap>Copyright &copy 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>)
124 </TD></TR></TABLE>
126 </BODY>
127 </HTML>