// Copyright 2004 The Trustees of Indiana University. // Use, modification and distribution is subject to the Boost Software // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) // Authors: Douglas Gregor // Andrew Lumsdaine #ifndef BOOST_GRAPH_RANDOM_LAYOUT_HPP #define BOOST_GRAPH_RANDOM_LAYOUT_HPP #include #include #include #include #include #include namespace boost { template void random_graph_layout(const Graph& g, PositionMap position_map, Dimension minX, Dimension maxX, Dimension minY, Dimension maxY, RandomNumberGenerator& gen) { typedef typename mpl::if_, uniform_int, uniform_real >::type distrib_t; typedef typename mpl::if_, RandomNumberGenerator&, uniform_01 > ::type gen_t; gen_t my_gen(gen); distrib_t x(minX, maxX); distrib_t y(minY, maxY); typename graph_traits::vertex_iterator vi, vi_end; for(tie(vi, vi_end) = vertices(g); vi != vi_end; ++vi) { position_map[*vi].x = x(my_gen); position_map[*vi].y = y(my_gen); } } } // end namespace boost #endif // BOOST_GRAPH_RANDOM_LAYOUT_HPP