Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/boost_1_34_1/libs/graph/doc/transpose_graph.html @ 29

Last change on this file since 29 was 29, checked in by landauf, 16 years ago

updated boost from 1_33_1 to 1_34_1

File size: 4.1 KB
Line 
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"> 
15
16<BR Clear>
17
18<H1><TT>transpose_graph</TT></H1>
19
20<PRE>
21template &lt;class <a href="./VertexListGraph.html">VertexListGraph</a>, class <a href="./MutableGraph.html">MutableGraph</a>&gt; 
22void 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>
25
26<P>
27This function computes the transpose of a directed graph. The
28transpose 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
32the algorithm must have no vertices and
33no edges. The vertices and edges will be added by <tt>transpose_graph()</tt> by
34calling <tt>add_vertex</tt> and  <tt>add_edge</tt> as follows for each edge
35<i>(u,v)</i> in <tt>G</tt>.
36
37<H3>Example</H3>
38
39Here's an example of transposing a graph:
40<a href="../example/transpose-example.cpp"><tt>example/transpose-example.cpp</tt></a>.
41
42<H3>Where Defined</H3>
43
44<P>
45<a href="../../../boost/graph/transpose_graph.hpp"><TT>boost/graph/transpose_graph.hpp</TT></a>
46
47<P>
48
49<H3>Parameters</H3>
50
51IN: <tt>const VertexListGraph&amp; G</tt>
52<blockquote>
53A directed graph. The graph type must be a model of <a href="./VertexListGraph.html">Vertex List Graph</a>.
54</blockquote>
55
56OUT: <tt>const MutableGraph&amp; G_T</tt>
57<blockquote>
58The transposed graph.  The graph type must be a model of <a
59href="./MutableGraph.html">Mutable Graph</a>.
60</blockquote>
61
62<h3>Named Parameters</h3>
63
64IN: <tt>vertex_copy(VertexCopier vc)</tt>
65<blockquote>
66This 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
67into the corresponding vertex in the copy.<br>
68
69<b>Default:</b> <tt>vertex_copier&lt;VertexListGraph, MutableGraph&gt;</tt>
70which uses the property tag <tt>vertex_all</tt> to access a property
71map from the graph.
72</blockquote>
73
74IN: <tt>edge_copy(EdgeCopier ec)</tt>
75<blockquote>
76This 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
77into the corresponding edge in the copy.<br>
78
79<b>Default:</b> <tt>edge_copier&lt;VertexListGraph, MutableGraph&gt;</tt>
80which uses the property tag <tt>edge_all</tt> to access a property
81map from the graph.
82</blockquote>
83
84IN: <tt>vertex_index_map(VertexIndexMap i_map)</tt>
85<blockquote>
86The vertex index map type must be a model of <a
87href="../../property_map/ReadablePropertyMap.html">Readable Property
88Map</a> and must map the vertex descriptors of <tt>G</tt> to the
89integers from 0 to <tt>num_vertices(G)</tt>.<br>
90
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>
97
98
99UTIL/OUT: <tt>orig_to_copy(Orig2CopyMap c)</tt>
100<blockquote>
101This maps vertices in the original graph to vertices in the copy.
102
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>
110
111<H3>Complexity</H3>
112
113<P>
114The time complexity is <i>O(V + E)</i>.
115
116
117
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>
125
126</BODY>
127</HTML> 
Note: See TracBrowser for help on using the repository browser.