Imported Upstream version 1.57.0
[platform/upstream/boost.git] / libs / graph / doc / opposite.html
1 <HTML>
2 <!--
3      Copyright (c) Jeremy Siek, Lie-Quan Lee, and Andrew Lumsdaine 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: opposite</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><A NAME="sec:opposite"></A>
19 <TT>opposite</TT>
20 </H1>
21
22 <P>
23 <DIV ALIGN="left">
24 <TABLE CELLPADDING=3 border>
25
26 <TR><TH ALIGN="LEFT"><B>Complexity:</B></TH>
27 <TD ALIGN="LEFT"><i>O(1)</i>
28 </TD>
29 </TR>
30
31 <TR><TH ALIGN="LEFT"><B>Where Defined:</B></TH>
32 <TD ALIGN="LEFT">
33 <a href="../../../boost/graph/graph_utility.hpp"><TT>boost/graph/graph_utility.hpp</TT></a>
34 </TD>
35
36 </TABLE>
37 </DIV>
38
39 <P>
40 <PRE>
41   template &lt;class Graph&gt;
42   typename graph_traits&lt;Graph&gt;::vertex_descriptor
43   opposite(typename graph_traits&lt;Graph&gt;::edge_descriptor e,
44            typename graph_traits&lt;Graph&gt;::vertex_descriptor v,
45            const Graph& g)
46 </pre>
47
48 Given an edge and a vertex which must be incident to the edge, this
49 function returns the opposite vertex. So if <tt>v</tt> is the source
50 vertex, this function returns the target vertex. If <tt>v</tt> is the
51 target, then this function returns the source vertex.
52
53 <h3>Example</h3>
54
55 <pre>
56 edge_descriptor e;
57 ...
58 vertex_descriptor u, v;
59 boost::tie(u, v) = incident(e, g);
60 assert(v == opposite(e, u, g));
61 assert(u == opposite(e, v, g));
62 </pre>
63
64 <br>
65 <HR>
66 <TABLE>
67 <TR valign=top>
68 <TD nowrap>Copyright &copy; 2000-2001</TD><TD>
69 <A HREF="http://www.boost.org/people/jeremy_siek.htm">Jeremy Siek</A>,
70 Indiana University (<A
71 HREF="mailto:jsiek@osl.iu.edu">jsiek@osl.iu.edu</A>)<br>
72 <A HREF="http://www.boost.org/people/liequan_lee.htm">Lie-Quan Lee</A>, Indiana University (<A HREF="mailto:llee@cs.indiana.edu">llee@cs.indiana.edu</A>)<br>
73 <A HREF="http://www.osl.iu.edu/~lums">Andrew Lumsdaine</A>,
74 Indiana University (<A
75 HREF="mailto:lums@osl.iu.edu">lums@osl.iu.edu</A>)
76 </TD></TR></TABLE>
77
78 </BODY>
79 </HTML>