diff --git a/include/boost/graph/kamada_kawai_spring_layout.hpp b/include/boost/graph/kamada_kawai_spring_layout.hpp index d5727759..d486dbeb 100644 --- a/include/boost/graph/kamada_kawai_spring_layout.hpp +++ b/include/boost/graph/kamada_kawai_spring_layout.hpp @@ -16,6 +16,7 @@ #include #include #include +#include namespace boost { namespace detail { namespace graph { @@ -103,6 +104,8 @@ namespace boost { deriv_type compute_partial_derivative(vertex_descriptor m, vertex_descriptor i) { + using std::sqrt; + deriv_type result(0, 0); if (i != m) { weight_type x_diff = position[m].x - position[i].x; @@ -140,6 +143,8 @@ namespace boost { // The actual Kamada-Kawai spring layout algorithm implementation bool run() { + using std::sqrt; + // Compute d_{ij} and place it in the distance matrix if (!johnson_all_pairs_shortest_paths(g, distance, index, weight, weight_type(0))) diff --git a/test/brandes_betweenness_centrality_test.cpp b/test/brandes_betweenness_centrality_test.cpp index c56fefbe..4e927d9a 100644 --- a/test/brandes_betweenness_centrality_test.cpp +++ b/test/brandes_betweenness_centrality_test.cpp @@ -6,8 +6,8 @@ #include #include #include -#include -#include +#include +#include using namespace boost; @@ -219,6 +219,9 @@ void randomly_add_edges(MutableGraph& g, double edge_probability) const bool is_undirected = is_same::value; + minstd_rand gen; + uniform_01 rand_gen(gen); + typedef typename graph_traits::vertex_descriptor vertex; typename graph_traits::vertex_iterator vi, vi_end; for (tie(vi, vi_end) = vertices(g); vi != vi_end; ++vi) { @@ -228,7 +231,7 @@ void randomly_add_edges(MutableGraph& g, double edge_probability) while (wi != vi_end) { vertex w = *wi++; if (v != w) { - if (drand48() < edge_probability) add_edge(v, w, g); + if (rand_gen() < edge_probability) add_edge(v, w, g); } } } @@ -459,11 +462,6 @@ int test_main(int, char*[]) run_wheel_test((Graph*)0, 15); - - long seed = time(0); - std::cout << "Random seed = " << seed << std::endl; - srand48(seed); - random_unweighted_test((Graph*)0, 500); return 0;