mirror of
https://github.com/boostorg/graph.git
synced 2026-01-31 08:12:14 +00:00
102 lines
2.6 KiB
HTML
102 lines
2.6 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">
|
|
|
|
<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 ID</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 <class VertexListGraph, class MutableGraph>
|
|
void transpose_graph(const VertexListGraph& G1, MutableGraph& G2);
|
|
|
|
(2)
|
|
template <class VertexListGraph, class MutableGraph, class ID>
|
|
void transpose_graph(const VertexListGraph& G1, MutableGraph& G2, ID id);
|
|
</PRE>
|
|
|
|
<P>
|
|
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 with all its edges reversed.
|
|
|
|
<P>
|
|
Graph <TT>G2</TT> passed into the algorithm must have the same number of
|
|
vertices as <TT>G1</TT> and no edges. The edges will be added
|
|
by <tt>transpose_graph()</tt> by calling <TT>add_edge(G2,u,v)</TT>.
|
|
|
|
<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>G1</TT> must be a model of <a
|
|
href="./VertexListGraph.html">VertexListGraph</a>.
|
|
</LI>
|
|
<LI>The graph type for argument <TT>G2</TT> must be a model of
|
|
<a href="./MutableGraph.html">MutableGraph</a>.
|
|
</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 © 2000</TD><TD>
|
|
<A HREF=http://www.boost.org/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>
|