random_layout.hpp 981 B

123456789101112131415161718192021222324252627282930313233343536
  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. template<typename Topology,
  18. typename Graph, typename PositionMap>
  19. void
  20. random_graph_layout
  21. (const Graph& g, PositionMap position_map,
  22. const Topology& topology)
  23. {
  24. BGL_FORALL_VERTICES_T(v, g, Graph) {
  25. put(position_map, v, topology.random_point());
  26. }
  27. }
  28. } // end namespace boost
  29. #endif // BOOST_GRAPH_RANDOM_LAYOUT_HPP