28 #include "../exceptions.h"
31 #include "erdos_renyi.h"
33 namespace pagmo {
namespace topology {
45 if (prob < 0 || prob > 1) {
46 pagmo_throw(value_error,
"probability must be in the [0,1] range");
57 for (std::pair<v_iterator,v_iterator> vertices =
get_vertices(); vertices.first != vertices.second; ++vertices.first) {
59 if (*vertices.first != n && m_drng() < m_prob) {
68 std::ostringstream oss;
69 oss <<
"\tprobability: " << m_prob <<
'\n';
Generic thread-safe generator of pseudo-random number generators.
Erdős-Rényi graph topology.
base_ptr clone() const
Clone method.
boost::shared_ptr< base > base_ptr
Alias for shared pointer to base topology.
std::string get_name() const
Get name of the topology.
erdos_renyi(const double &prob=0.01)
Constructor from probability.
graph_type::vertices_size_type vertices_size_type
Vertices size type.
std::string human_readable_extra() const
Return extra information for human readable representation.
void add_edge(const vertices_size_type &, const vertices_size_type &)
Add an edge.
void connect(const vertices_size_type &)
Establish connections between islands during a push_back() operation.
This rng returns a double in the [0,1[ range.
std::pair< v_iterator, v_iterator > get_vertices() const
Return iterator range to vertices.