# `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 | Jeremy Siek, Univ.of Notre Dame (jsiek@lsc.nd.edu) Lie-Quan Lee, Univ.of Notre Dame (llee1@lsc.nd.edu) Andrew Lumsdaine, Univ.of Notre Dame (lums@lsc.nd.edu)