Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

Click here to view the latest version of this page.
C++ Boost

opposite

Complexity: O(1)
Where Defined: boost/graph/graph_utility.hpp

  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)
Given an edge and a vertex which must be incident to the edge, this function returns the opposite vertex. So if v is the source vertex, this function returns the target vertex. If v is the target, then this function returns the source vertex.

Example

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));


Copyright © 2000-2001 Jeremy Siek, Indiana University (jsiek@osl.iu.edu)
Lie-Quan Lee, Indiana University (llee@cs.indiana.edu)
Andrew Lumsdaine, Indiana University (lums@osl.iu.edu)