random_layout.hpp 988 B

1234567891011121314151617181920212223242526272829303132333435
  1. // Copyright 2004 The Trustees of Indiana University.
  2. // Distributed under the Boost Software License, Version 1.0.
  3. // (See accompanying file LICENSE_1_0.txt or copy at
  4. // http://www.boost.org/LICENSE_1_0.txt)
  5. // Authors: Douglas Gregor
  6. // Andrew Lumsdaine
  7. #ifndef BOOST_GRAPH_RANDOM_LAYOUT_HPP
  8. #define BOOST_GRAPH_RANDOM_LAYOUT_HPP
  9. #include <boost/graph/graph_traits.hpp>
  10. #include <boost/random/uniform_int.hpp>
  11. #include <boost/random/uniform_01.hpp>
  12. #include <boost/random/uniform_real.hpp>
  13. #include <boost/type_traits/is_integral.hpp>
  14. #include <boost/mpl/if.hpp>
  15. #include <boost/graph/iteration_macros.hpp>
  16. namespace boost
  17. {
  18. template < typename Topology, typename Graph, typename PositionMap >
  19. void random_graph_layout(
  20. const Graph& g, PositionMap position_map, const Topology& topology)
  21. {
  22. BGL_FORALL_VERTICES_T(v, g, Graph)
  23. {
  24. put(position_map, v, topology.random_point());
  25. }
  26. }
  27. } // end namespace boost
  28. #endif // BOOST_GRAPH_RANDOM_LAYOUT_HPP