| <HTML> |
| <!-- |
| Copyright (c) Jeremy Siek, Lie-Quan Lee, and Andrew Lumsdaine 2000 |
| |
| Distributed under the Boost Software License, Version 1.0. |
| (See accompanying file LICENSE_1_0.txt or copy at |
| http://www.boost.org/LICENSE_1_0.txt) |
| --> |
| <Head> |
| <Title>Boost Graph Library: opposite</Title> |
| <BODY BGCOLOR="#ffffff" LINK="#0000ee" TEXT="#000000" VLINK="#551a8b" |
| ALINK="#ff0000"> |
| <IMG SRC="../../../boost.png" |
| ALT="C++ Boost" width="277" height="86"> |
| |
| <BR Clear> |
| |
| <H1><A NAME="sec:opposite"></A> |
| <TT>opposite</TT> |
| </H1> |
| |
| <P> |
| <DIV ALIGN="left"> |
| <TABLE CELLPADDING=3 border> |
| |
| <TR><TH ALIGN="LEFT"><B>Complexity:</B></TH> |
| <TD ALIGN="LEFT"><i>O(1)</i> |
| </TD> |
| </TR> |
| |
| <TR><TH ALIGN="LEFT"><B>Where Defined:</B></TH> |
| <TD ALIGN="LEFT"> |
| <a href="../../../boost/graph/graph_utility.hpp"><TT>boost/graph/graph_utility.hpp</TT></a> |
| </TD> |
| |
| </TABLE> |
| </DIV> |
| |
| <P> |
| <PRE> |
| template <class Graph> |
| typename graph_traits<Graph>::vertex_descriptor |
| opposite(typename graph_traits<Graph>::edge_descriptor e, |
| typename graph_traits<Graph>::vertex_descriptor v, |
| const Graph& g) |
| </pre> |
| |
| Given an edge and a vertex which must be incident to the edge, this |
| function returns the opposite vertex. So if <tt>v</tt> is the source |
| vertex, this function returns the target vertex. If <tt>v</tt> is the |
| target, then this function returns the source vertex. |
| |
| <h3>Example</h3> |
| |
| <pre> |
| edge_descriptor e; |
| ... |
| vertex_descriptor u, v; |
| tie(u, v) = incident(e, g); |
| assert(v == opposite(e, u, g)); |
| assert(u == opposite(e, v, g)); |
| </pre> |
| |
| <br> |
| <HR> |
| <TABLE> |
| <TR valign=top> |
| <TD nowrap>Copyright © 2000-2001</TD><TD> |
| <A HREF="http://www.boost.org/people/jeremy_siek.htm">Jeremy Siek</A>, |
| Indiana University (<A |
| HREF="mailto:jsiek@osl.iu.edu">jsiek@osl.iu.edu</A>)<br> |
| <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> |
| <A HREF="http://www.osl.iu.edu/~lums">Andrew Lumsdaine</A>, |
| Indiana University (<A |
| HREF="mailto:lums@osl.iu.edu">lums@osl.iu.edu</A>) |
| </TD></TR></TABLE> |
| |
| </BODY> |
| </HTML> |