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. {
  19. template < class VertexListGraph, class MutableGraph >
  20. void transpose_graph(const VertexListGraph& G, MutableGraph& G_T)
  21. {
  22. reverse_graph< VertexListGraph > R(G);
  23. copy_graph(R, G_T);
  24. }
  25. template < class VertexListGraph, class MutableGraph, class P, class T,
  26. class R >
  27. void transpose_graph(const VertexListGraph& G, MutableGraph& G_T,
  28. const bgl_named_params< P, T, R >& params)
  29. {
  30. reverse_graph< VertexListGraph > Rev(G);
  31. copy_graph(Rev, G_T, params);
  32. }
  33. } // namespace boost
  34. #endif // BOOST_GRAPH_TRANSPOSE_HPP