File: transpose_graph.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 (127 lines) | stat: -rw-r--r-- 4,316 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
<HTML>
<!--
  -- Copyright (c) Jeremy Siek 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.  Jeremy Siek makes 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: Transpose Graph</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><TT>transpose_graph</TT></H1>

<PRE>
template &lt;class <a href="./VertexListGraph.html">VertexListGraph</a>, class <a href="./MutableGraph.html">MutableGraph</a>&gt; 
void transpose_graph(const VertexListGraph&amp; G, MutableGraph&amp; G_T,
    const bgl_named_params&lt;P, T, R&gt;&amp; params = <i>all defaults</i>)
</PRE>

<P>
This function computes the transpose of a directed graph. The
transpose of a directed graph <i>G = (V, E)</i>is the graph
<i>G<sup>T</sup> = (V, E<sup>T</sup>)</i> , where <i>E<sup>T</sup> =
{(v, u) in V x V: (u, v) in E}</i> . i.e., <i>G<sup>T</sup></i> is
<i>G</i> with all its edges reversed.  Graph <TT>G_T</TT> passed into
the algorithm must have the same number of vertices as <TT>G</TT> and
no edges. The edges will be added by <tt>transpose_graph()</tt> by
calling <tt>add_edge</tt> as follows for each edge <i>(u,v)</i> in
<tt>G</tt>.

<H3>Example</H3>

Here's an example of transposing a graph:
<a href="../example/transpose-example.cpp"><tt>example/transpose-example.cpp</tt></a>.

<H3>Where Defined</H3>

<P>
<a href="../../../boost/graph/transpose_graph.hpp"><TT>boost/graph/transpose_graph.hpp</TT></a>

<P>

<H3>Parameters</H3>

IN: <tt>const VertexListGraph&amp; G</tt>
<blockquote>
A directed graph. The graph type must be a model of <a href="./VertexListGraph.html">Vertex List Graph</a>.
</blockquote>

OUT: <tt>const MutableGraph&amp; G_T</tt>
<blockquote>
The transposed graph.  The graph type must be a model of <a
href="./MutableGraph.html">Mutable Graph</a>.
</blockquote>

<h3>Named Parameters</h3>

IN: <tt>vertex_copy(VertexCopier vc)</tt>
<blockquote>
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
into the corresponding vertex in the copy.<br>

<b>Default:</b> <tt>vertex_copier&lt;VertexListGraph, MutableGraph&gt;</tt>
which uses the property tag <tt>vertex_all</tt> to access a property
map from the graph.
</blockquote>

IN: <tt>edge_copy(EdgeCopier ec)</tt>
<blockquote>
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
into the corresponding edge in the copy.<br>

<b>Default:</b> <tt>edge_copier&lt;VertexListGraph, MutableGraph&gt;</tt>
which uses the property tag <tt>edge_all</tt> to access a property
map from the graph.
</blockquote>

IN: <tt>vertex_index_map(VertexIndexMap i_map)</tt>
<blockquote>
The vertex index map type must be a model of <a
href="../../property_map/ReadablePropertyMap.html">Readable Property
Map</a> and must map the vertex descriptors of <tt>G</tt> to the
integers from 0 to <tt>num_vertices(G)</tt>.<br>

<b>Default:</b> <tt>get(vertex_index, G)</tt>
</blockquote>


UTIL/OUT: <tt>orig_to_copy(Orig2CopyMap c)</tt>
<blockquote>
This maps vertices in the original graph to vertices in the copy.

<b>Default:</b> an <a
  href="../../property_map/iterator_property_map.html">
  </tt>iterator_property_map</tt></a> created from a
  <tt>std::vector</tt> of the output graph's vertex descriptor type of size
  <tt>num_vertices(g)</tt> and using the <tt>i_map</tt> for the index
  map.
</blockquote>

<H3>Complexity</H3>

<P>
The time complexity is <i>O(V + E)</i>.



<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>)
</TD></TR></TABLE>

</BODY>
</HTML>