1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124
|
// Copyright 2009 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: Nicholas Edmonds
// Andrew Lumsdaine
#include <boost/random.hpp>
#include <boost/test/minimal.hpp>
#include <boost/graph/rmat_graph_generator.hpp>
#include <boost/graph/small_world_generator.hpp>
#include <boost/graph/ssca_graph_generator.hpp>
#include <boost/graph/erdos_renyi_generator.hpp>
#include <boost/graph/mesh_graph_generator.hpp>
#include <boost/graph/adjacency_list.hpp>
using namespace boost;
int test_main(int argc, char** argv) {
typedef rand48 RandomGenerator;
typedef adjacency_list<vecS, vecS, directedS> Graph;
RandomGenerator gen;
size_t N = 100;
size_t M = 1000;
double p = 0.05;
// Test Erdos-Renyi generator
{
erdos_renyi_iterator<RandomGenerator, Graph> start(gen, N, p);
erdos_renyi_iterator<RandomGenerator, Graph> end;
while (start != end) ++start;
BOOST_CHECK(start == end);
}
{
sorted_erdos_renyi_iterator<RandomGenerator, Graph> start(gen, N, p);
sorted_erdos_renyi_iterator<RandomGenerator, Graph> end;
while (start != end) ++start;
BOOST_CHECK(start == end);
}
// Test Small World generator
{
small_world_iterator<RandomGenerator, Graph> start(gen, N, M, p);
small_world_iterator<RandomGenerator, Graph> end;
while (start != end) ++start;
BOOST_CHECK(start == end);
}
// Test SSCA generator
{
ssca_iterator<RandomGenerator, Graph> start(gen, N, 5, 0.5, 5, p);
ssca_iterator<RandomGenerator, Graph> end;
while (start != end) ++start;
BOOST_CHECK(start == end);
}
// Test Mesh generator
{
mesh_iterator<Graph> start(N, N);
mesh_iterator<Graph> end;
while (start != end) ++start;
BOOST_CHECK(start == end);
}
// Test R-MAT generator
double a = 0.57, b = 0.19, c = 0.19, d = 0.05;
{
rmat_iterator<RandomGenerator, Graph> start(gen, N, M, a, b, c, d);
rmat_iterator<RandomGenerator, Graph> end;
while (start != end) ++start;
BOOST_CHECK(start == end);
}
{
unique_rmat_iterator<RandomGenerator, Graph> start(gen, N, M, a, b, c, d);
unique_rmat_iterator<RandomGenerator, Graph> end;
while (start != end) ++start;
BOOST_CHECK(start == end);
}
{
sorted_unique_rmat_iterator<RandomGenerator, Graph> start(gen, N, M, a, b, c, d);
sorted_unique_rmat_iterator<RandomGenerator, Graph> end;
while (start != end) ++start;
BOOST_CHECK(start == end);
}
{
sorted_unique_rmat_iterator<RandomGenerator, Graph> start(gen, N, M, a, b, c, d, true);
sorted_unique_rmat_iterator<RandomGenerator, Graph> end;
while (start != end) ++start;
BOOST_CHECK(start == end);
}
return 0;
}
|