2
0
mirror of https://github.com/boostorg/graph.git synced 2026-01-24 18:02:19 +00:00
Files
graph/doc/transpose_graph.html
2000-12-08 22:18:53 +00:00

123 lines
3.4 KiB
HTML

<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>
<P>
<DIV ALIGN="left">
<TABLE CELLPADDING=3 border>
<TR><TH ALIGN="LEFT"><B>Graphs:</B></TH>
<TD ALIGN="LEFT">directed (and not undirected)</TD>
</TR>
<TR><TH ALIGN="LEFT"><B>Properties:</B></TH>
<TD ALIGN="LEFT">vertex index</TD>
</TR>
<TR><TH ALIGN="LEFT"><B>Complexity:</B></TH>
<TD ALIGN="LEFT"><i>O(V + E)</i></TD>
</TR>
</TABLE>
</DIV>
<P>
<PRE>
(1)
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);
(2)
template &lt;class <a href="./VertexListGraph.html">VertexListGraph</a>, class <a href="./MutableGraph.html">MutableGraph</a>, class VertexIndexMap&gt;
void transpose_graph(const VertexListGraph&amp; G, MutableGraph&amp; G_T,
VertexIndexMap index);
</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<sub>T</sub> = (V, E<sub>T</sub>)</i> , where <i>E<sub>T</sub> =
{(v, u) in V x V: (u, v) in E}</i> . i.e., <i>G<sub>T</sub></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>:
<pre>
add_edge(vertex(get(index, v), G_T), vertex(get(index, u), G_T), G_T);
</pre>
<P>
<H3>Where Defined</H3>
<P>
<a href="../../../boost/graph/transpose_graph.hpp"><TT>boost/graph/transpose_graph.hpp</TT></a>
<P>
<H3>Requirements on Types</H3>
<P>
<UL>
<LI>The graph type for argument <TT>G</TT> must be a model of <a
href="./VertexListGraph.html">VertexListGraph</a>.
</LI>
<LI>In version (1), the graph <TT>G</TT> must be a <a
href="./PropertyGraph.html">PropertyGraph</a> with respect to the
<tt>vertex_index_t</tt> property.
</LI>
<LI>The graph type for argument <TT>G_T</TT> must be a model of
<a href="./MutableGraph.html">MutableGraph</a>.
</LI>
<LI>The <tt>VertexIndexMap</tt> is a <a
href="../../property_map/ReadablePropertyMap.html">ReadablePropertyMap</a>
that must map the vertex descriptors of <tt>G</tt> to the integers
from 0 to <tt>num_vertices(G)</tt>.
</LI>
</UL>
<P>
<H3>Complexity</H3>
<P>
The time complexity is <i>O(V + E)</i>.
<br>
<HR>
<TABLE>
<TR valign=top>
<TD nowrap>Copyright &copy 2000</TD><TD>
<A HREF="../../../people/jeremy_siek.htm">Jeremy Siek</A>, Univ.of Notre Dame (<A HREF="mailto:jsiek@lsc.nd.edu">jsiek@lsc.nd.edu</A>)
</TD></TR></TABLE>
</BODY>
</HTML>