transpose_graph.hpp 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. //
  2. //=======================================================================
  3. // Copyright 1997, 1998, 1999, 2000 University of Notre Dame.
  4. // Authors: Andrew Lumsdaine, Lie-Quan Lee, Jeremy G. Siek
  5. //
  6. // Distributed under the Boost Software License, Version 1.0. (See
  7. // accompanying file LICENSE_1_0.txt or copy at
  8. // http://www.boost.org/LICENSE_1_0.txt)
  9. //=======================================================================
  10. //
  11. #ifndef BOOST_GRAPH_TRANSPOSE_HPP
  12. #define BOOST_GRAPH_TRANSPOSE_HPP
  13. #include <boost/config.hpp>
  14. #include <boost/graph/graph_traits.hpp>
  15. #include <boost/graph/reverse_graph.hpp>
  16. #include <boost/graph/copy.hpp>
  17. namespace boost {
  18. template <class VertexListGraph, class MutableGraph>
  19. void transpose_graph(const VertexListGraph& G, MutableGraph& G_T)
  20. {
  21. reverse_graph<VertexListGraph> R(G);
  22. copy_graph(R, G_T);
  23. }
  24. template <class VertexListGraph, class MutableGraph,
  25. class P, class T, class R>
  26. void transpose_graph(const VertexListGraph& G, MutableGraph& G_T,
  27. const bgl_named_params<P, T, R>& params)
  28. {
  29. reverse_graph<VertexListGraph> Rev(G);
  30. copy_graph(Rev, G_T, params);
  31. }
  32. } // namespace boost
  33. #endif // BOOST_GRAPH_TRANSPOSE_HPP