opposite.html 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. <HTML>
  2. <!--
  3. Copyright (c) Jeremy Siek, Lie-Quan Lee, and Andrew Lumsdaine 2000
  4. Distributed under the Boost Software License, Version 1.0.
  5. (See accompanying file LICENSE_1_0.txt or copy at
  6. http://www.boost.org/LICENSE_1_0.txt)
  7. -->
  8. <Head>
  9. <Title>Boost Graph Library: opposite</Title>
  10. <BODY BGCOLOR="#ffffff" LINK="#0000ee" TEXT="#000000" VLINK="#551a8b"
  11. ALINK="#ff0000">
  12. <IMG SRC="../../../boost.png"
  13. ALT="C++ Boost" width="277" height="86">
  14. <BR Clear>
  15. <H1><A NAME="sec:opposite"></A>
  16. <TT>opposite</TT>
  17. </H1>
  18. <P>
  19. <DIV ALIGN="left">
  20. <TABLE CELLPADDING=3 border>
  21. <TR><TH ALIGN="LEFT"><B>Complexity:</B></TH>
  22. <TD ALIGN="LEFT"><i>O(1)</i>
  23. </TD>
  24. </TR>
  25. <TR><TH ALIGN="LEFT"><B>Where Defined:</B></TH>
  26. <TD ALIGN="LEFT">
  27. <a href="../../../boost/graph/graph_utility.hpp"><TT>boost/graph/graph_utility.hpp</TT></a>
  28. </TD>
  29. </TABLE>
  30. </DIV>
  31. <P>
  32. <PRE>
  33. template &lt;class Graph&gt;
  34. typename graph_traits&lt;Graph&gt;::vertex_descriptor
  35. opposite(typename graph_traits&lt;Graph&gt;::edge_descriptor e,
  36. typename graph_traits&lt;Graph&gt;::vertex_descriptor v,
  37. const Graph& g)
  38. </pre>
  39. Given an edge and a vertex which must be incident to the edge, this
  40. function returns the opposite vertex. So if <tt>v</tt> is the source
  41. vertex, this function returns the target vertex. If <tt>v</tt> is the
  42. target, then this function returns the source vertex.
  43. <h3>Example</h3>
  44. <pre>
  45. edge_descriptor e;
  46. ...
  47. vertex_descriptor u, v;
  48. boost::tie(u, v) = incident(e, g);
  49. assert(v == opposite(e, u, g));
  50. assert(u == opposite(e, v, g));
  51. </pre>
  52. <br>
  53. <HR>
  54. <TABLE>
  55. <TR valign=top>
  56. <TD nowrap>Copyright &copy; 2000-2001</TD><TD>
  57. <A HREF="http://www.boost.org/people/jeremy_siek.htm">Jeremy Siek</A>,
  58. Indiana University (<A
  59. HREF="mailto:jsiek@osl.iu.edu">jsiek@osl.iu.edu</A>)<br>
  60. <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>
  61. <A HREF="https://homes.cs.washington.edu/~al75">Andrew Lumsdaine</A>,
  62. Indiana University (<A
  63. HREF="mailto:lums@osl.iu.edu">lums@osl.iu.edu</A>)
  64. </TD></TR></TABLE>
  65. </BODY>
  66. </HTML>