Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion test/Jamfile.v2
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ alias graph_test_regular :
[ run rcsp_custom_vertex_id.cpp ]
[ run rcsp_single_solution.cpp ]
[ run is_straight_line_draw_test.cpp ]
[ run metric_tsp_approx.cpp /boost/timer//boost_timer : metric_tsp_approx.graph : : ]
[ run metric_tsp_approx.cpp /boost/timer//boost_timer ]
[ compile dimacs.cpp ]
[ run bron_kerbosch_all_cliques.cpp ]
[ run tiernan_all_cycles.cpp ]
Expand Down
3 changes: 1 addition & 2 deletions test/astar_search_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
#include <list>
#include <iostream>
#include <math.h> // for sqrt
#include <time.h>

using namespace boost;
using namespace std;
Expand Down Expand Up @@ -196,7 +195,7 @@ int main(int, char**)
}

// pick random start/goal
boost::minstd_rand gen(time(0));
boost::minstd_rand gen(42);
vertex start = gen() % num_vertices(g);
vertex goal = gen() % num_vertices(g);

Expand Down
2 changes: 1 addition & 1 deletion test/betweenness_centrality_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ void randomly_add_edges(MutableGraph& g, double edge_probability)
typedef typename graph_traits< MutableGraph >::directed_category
directed_category;

minstd_rand gen;
minstd_rand gen(42);
uniform_01< minstd_rand, double > rand_gen(gen);

typedef typename graph_traits< MutableGraph >::vertex_descriptor vertex;
Expand Down
2 changes: 1 addition & 1 deletion test/bfs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ template < class Graph > struct bfs_test
typename Traits::edges_size_type j;
typename Traits::vertex_iterator ui, ui_end;

boost::mt19937 gen;
boost::mt19937 gen(42);

for (i = 0; i < max_V; ++i)
for (j = 0; j < i * i; ++j)
Expand Down
4 changes: 1 addition & 3 deletions test/biconnected_components_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,14 +123,12 @@ int main(int argc, char* argv[])
{
std::size_t n = 100;
std::size_t m = 500;
std::size_t seed = 1;
std::size_t seed = 42;

if (argc > 1)
n = lexical_cast< std::size_t >(argv[1]);
if (argc > 2)
m = lexical_cast< std::size_t >(argv[2]);
if (argc > 3)
seed = lexical_cast< std::size_t >(argv[3]);

{
Graph g(n);
Expand Down
4 changes: 1 addition & 3 deletions test/boykov_kolmogorov_max_flow_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -589,14 +589,12 @@ int main(int argc, char* argv[])
{
int n_verts = 10;
int n_edges = 500;
std::size_t seed = 1;
std::size_t seed = 42;

if (argc > 1)
n_verts = lexical_cast< int >(argv[1]);
if (argc > 2)
n_edges = lexical_cast< int >(argv[2]);
if (argc > 3)
seed = lexical_cast< std::size_t >(argv[3]);

// we need at least 2 vertices to create src and sink in random graphs
// this case is also caught in boykov_kolmogorov_max_flow
Expand Down
2 changes: 1 addition & 1 deletion test/bron_kerbosch_all_cliques.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ template < typename Graph > void test()
static const size_t N = 20;
static const double P = 0.1;

boost::minstd_rand rng;
boost::minstd_rand rng(42);
Graph g(er(rng, N, P), er(), N);
renumber_indices(g);
print_edges(g, get(vertex_index, g));
Expand Down
10 changes: 3 additions & 7 deletions test/csr_graph_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
#include <iostream>
#include <vector>
#include <algorithm>
#include <ctime>
#include <boost/lexical_cast.hpp>
#include <boost/iterator/transform_iterator.hpp>
#include <boost/limits.hpp>
Expand Down Expand Up @@ -269,7 +268,7 @@ template < typename OrigGraph > void graph_test(const OrigGraph& g)
targets[idx] = target(e, g2);
++idx;
}
boost::minstd_rand gen(1);
boost::minstd_rand gen(42);
if (num_edges(g) != 0)
{
for (std::size_t i = num_edges(g) - 1; i > 0; --i)
Expand Down Expand Up @@ -409,12 +408,9 @@ void test_vertex_and_edge_properties()
BOOST_TEST(g[v].centrality == centrality[v]);
}

int main(int argc, char* argv[])
int main()
{
// Optionally accept a seed value
int seed = int(std::time(0));
if (argc > 1)
seed = boost::lexical_cast< int >(argv[1]);
int seed = 42;

std::cout << "Seed = " << seed << std::endl;
{
Expand Down
2 changes: 1 addition & 1 deletion test/dfs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ template < typename Graph > struct dfs_test
typename Traits::edges_size_type j;
typename Traits::vertex_iterator vi, vi_end, ui, ui_end;

boost::mt19937 gen;
boost::mt19937 gen(42);

for (i = 0; i < max_V; ++i)
for (j = 0; j < i * i; ++j)
Expand Down
2 changes: 1 addition & 1 deletion test/dijkstra_heap_performance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ int main(int argc, char* argv[])
{
unsigned n = (argc > 1 ? lexical_cast< unsigned >(argv[1]) : 10000u);
unsigned m = (argc > 2 ? lexical_cast< unsigned >(argv[2]) : 10 * n);
int seed = (argc > 3 ? lexical_cast< int >(argv[3]) : 1);
int seed = 42;

// Build random graph
typedef adjacency_list< vecS, vecS, directedS, no_property,
Expand Down
8 changes: 1 addition & 7 deletions test/dijkstra_no_color_map_compare.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
#include <iostream>
#include <map>
#include <vector>
#include <ctime>
#include <boost/config.hpp>

#ifdef BOOST_MSVC
Expand Down Expand Up @@ -81,7 +80,7 @@ int main(int argc, char* argv[])

int vertices_to_create = 10;
int edges_to_create = 500;
std::size_t random_seed = std::time(0);
std::size_t random_seed = 42;

if (argc > 1)
{
Expand All @@ -93,11 +92,6 @@ int main(int argc, char* argv[])
edges_to_create = lexical_cast< int >(argv[2]);
}

if (argc > 3)
{
random_seed = lexical_cast< std::size_t >(argv[3]);
}

minstd_rand generator(random_seed);

// Set up graph
Expand Down
4 changes: 2 additions & 2 deletions test/floyd_warshall_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ template < typename T > inline const T& my_min(const T& x, const T& y)

template < typename Graph > bool acceptance_test(Graph& g, int vec, int e)
{
boost::minstd_rand ran(vec);
boost::minstd_rand ran(42);

{
typename boost::property_map< Graph, boost::vertex_name_t >::type index
Expand Down Expand Up @@ -226,7 +226,7 @@ template < typename Graph > bool acceptance_test(Graph& g, int vec, int e)

template < typename Graph > bool acceptance_test2(Graph& g, int vec, int e)
{
boost::minstd_rand ran(vec);
boost::minstd_rand ran(42);

{

Expand Down
2 changes: 1 addition & 1 deletion test/generator_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ int main(int argc, char** argv)

typedef adjacency_list< vecS, vecS, directedS > Graph;

RandomGenerator gen;
RandomGenerator gen(42);

size_t N = 100;
size_t M = 1000;
Expand Down
2 changes: 1 addition & 1 deletion test/graph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ int main(int, char*[])
add_vertex(current_vertex_id++, g);

// also need to test EdgeIterator graph constructor -JGS
mt19937 gen;
mt19937 gen(42);

for (j = 0; j < 10; ++j)
{
Expand Down
11 changes: 2 additions & 9 deletions test/grid_graph_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
#include <fstream>
#include <iostream>
#include <set>
#include <ctime>

#include <boost/foreach.hpp>
#include <boost/lexical_cast.hpp>
Expand Down Expand Up @@ -222,15 +221,9 @@ template < unsigned int Dims > void do_test(minstd_rand& generator)
BOOST_TEST(edge_count == num_edges(graph));
}

int main(int argc, char* argv[])
int main()
{

std::size_t random_seed = std::time(0);

if (argc > 1)
{
random_seed = lexical_cast< std::size_t >(argv[1]);
}
std::size_t random_seed = 42;

minstd_rand generator(random_seed);

Expand Down
6 changes: 3 additions & 3 deletions test/gursoy_atun_layout_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ int main(int, char*[])
// Make grid, like Gursoy and Atun used
std::map< int, std::map< int, vertex_descriptor > > verts;
const int grid_size = 20;
boost::minstd_rand edge_weight_gen;
boost::minstd_rand edge_weight_gen(42);
boost::uniform_01< boost::minstd_rand > random_edge_weight(edge_weight_gen);
for (int i = 0; i < grid_size; ++i)
for (int j = 0; j < grid_size; ++j)
Expand Down Expand Up @@ -99,15 +99,15 @@ int main(int, char*[])
int n = 10000;
double alpha = 0.4;
double beta = 50;
minstd_rand gen;
minstd_rand gen(42);
graph_type graph(plod_iterator<minstd_rand, graph_type>(gen, n, alpha, beta),
plod_iterator<minstd_rand, graph_type>(),
n);
#else
int n = 1000;
int k = 6;
double p = 0.001;
minstd_rand gen;
minstd_rand gen(42);
graph_type graph(small_world_iterator< minstd_rand >(gen, n, k, p),
small_world_iterator< minstd_rand >(n, k), n);
#endif
Expand Down
8 changes: 1 addition & 7 deletions test/incremental_components_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
#include <iostream>
#include <map>
#include <set>
#include <ctime>

#include <boost/foreach.hpp>
#include <boost/graph/adjacency_list.hpp>
Expand Down Expand Up @@ -128,7 +127,7 @@ template < typename Graph > void test_graph(const Graph& graph)
int main(int argc, char* argv[])
{
std::size_t vertices_to_generate = 100, edges_to_generate = 50,
random_seed = std::time(0);
random_seed = 42;

// Parse command-line arguments

Expand All @@ -142,11 +141,6 @@ int main(int argc, char* argv[])
edges_to_generate = lexical_cast< std::size_t >(argv[2]);
}

if (argc > 3)
{
random_seed = lexical_cast< std::size_t >(argv[3]);
}

minstd_rand generator(random_seed);

// Generate random vector and list graphs
Expand Down
6 changes: 3 additions & 3 deletions test/isomorphism.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ randomly_permute_graph(const Graph1& g1, Graph2& g2)
typedef typename graph_traits< Graph2 >::vertex_descriptor vertex2;
typedef typename graph_traits< Graph1 >::edge_iterator edge_iterator;

random_generator_type gen;
random_generator_type gen(42);

// Decide new order
std::vector< vertex1 > orig_vertices;
Expand All @@ -100,7 +100,7 @@ template < typename Graph >
void generate_random_digraph(Graph& g, double edge_probability)
{
typedef typename graph_traits< Graph >::vertex_iterator vertex_iterator;
random_generator_type random_gen;
random_generator_type random_gen(42);
boost::uniform_real< double > distrib(0.0, 1.0);
boost::variate_generator< random_generator_type&,
boost::uniform_real< double > >
Expand Down Expand Up @@ -292,7 +292,7 @@ void test_colored_isomorphism(int n, double edge_probability)
std::fill(colors.begin(), midpoint, 0);
std::fill(midpoint, colors.end(), 1);

random_generator_type gen;
random_generator_type gen(42);

std::shuffle(colors.begin(), colors.end(), gen);

Expand Down
6 changes: 3 additions & 3 deletions test/layout_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ template < typename Graph > void test_cube(Graph*)

dump_graph_layout("cube", g, get(vertex_position, g));

minstd_rand gen;
minstd_rand gen(42);
typedef square_topology<> Topology;
Topology topology(gen, 50.0);
std::vector< Topology::point_difference_type > displacements(
Expand Down Expand Up @@ -291,7 +291,7 @@ template < typename Graph > void test_triangular(Graph*)
std::cerr << std::endl;

typedef square_topology<> Topology;
minstd_rand gen;
minstd_rand gen(42);
Topology topology(gen, 50.0);
Topology::point_type origin;
origin[0] = origin[1] = 50.0;
Expand Down Expand Up @@ -371,7 +371,7 @@ template < typename Graph > void test_disconnected(Graph*)
kamada_kawai_done());
BOOST_TEST(!ok);

minstd_rand gen;
minstd_rand gen(42);
rectangle_topology<> rect_top(gen, -25, -25, 25, 25);
random_graph_layout(g, get(vertex_position, g), rect_top);

Expand Down
3 changes: 1 addition & 2 deletions test/matching_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
#include <boost/graph/adjacency_list.hpp>
#include <boost/graph/adjacency_matrix.hpp>
#include <boost/graph/random.hpp>
#include <ctime>
#include <boost/random.hpp>
#include <boost/core/lightweight_test.hpp>

Expand Down Expand Up @@ -309,7 +308,7 @@ void matching_test(std::size_t num_v, const std::string& graph_name)
vertex_index_installer< Graph >::install(j);

typedef boost::mt19937 base_generator_type;
base_generator_type generator(static_cast< unsigned int >(std::time(0)));
base_generator_type generator(42);
boost::uniform_int<> distribution(0, double_num_v - 1);
boost::variate_generator< base_generator_type&, boost::uniform_int<> >
rand_num(generator, distribution);
Expand Down
4 changes: 1 addition & 3 deletions test/max_flow_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,14 +77,12 @@ int main(int argc, char* argv[])

graph_traits< Graph >::vertices_size_type n_verts = 100;
graph_traits< Graph >::edges_size_type n_edges = 1000;
std::size_t seed = 1;
std::size_t seed = 42;

if (argc > 1)
n_verts = lexical_cast< std::size_t >(argv[1]);
if (argc > 2)
n_edges = lexical_cast< std::size_t >(argv[2]);
if (argc > 3)
seed = lexical_cast< std::size_t >(argv[3]);

Graph g;
const int cap_low = 1;
Expand Down
8 changes: 1 addition & 7 deletions test/mcgregor_subgraphs_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
#include <fstream>
#include <sstream>
#include <vector>
#include <ctime>

#include <boost/lexical_cast.hpp>
#include <boost/random.hpp>
Expand Down Expand Up @@ -312,7 +311,7 @@ int main(int argc, char* argv[])
{
int vertices_to_create = 10;
int max_edges_per_vertex = 2;
std::size_t random_seed = std::time(0);
std::size_t random_seed = 42;

if (argc > 1)
{
Expand All @@ -329,11 +328,6 @@ int main(int argc, char* argv[])
output_graphs = boost::lexical_cast< bool >(argv[3]);
}

if (argc > 4)
{
random_seed = boost::lexical_cast< std::size_t >(argv[4]);
}

boost::minstd_rand generator(random_seed);

// Using a vecS graph here so that we don't have to mess around with
Expand Down
Loading
Loading