1 #ifndef __MINLCA_UTILS_GENERATORS_CLIQUES_HH
2 #define __MINLCA_UTILS_GENERATORS_CLIQUES_HH
4 #include <lemon/smart_graph.h>
5 #include <lemon/random.h>
17 template<
typename BaseGraph = lemon::SmartGraph>
52 virtual void generate()
55 this->reserveNode(_c * _s);
57 for (
int i = 0; i <
_c; ++i) {
58 for (
int j = 0; j <
_s; ++j) {
61 for (
int l = i * _s; l < i * _s + j; ++l) {
62 this->addEdge(this->nodeFromId(l), this->nodeFromId(i * _s + j));
73 template<
typename BaseGraph = lemon::SmartGraph>
83 virtual Graph &
init(
int s,
int c)
90 virtual void generate()
94 for (
int i = 0; i < _c - 1; ++i) {
95 this->addEdge(this->nodeFromId(i * _s), this->nodeFromId(i * _s + 1));
98 this->addEdge(this->nodeFromId((_c - 1) * _s), this->nodeFromId(1));
106 template<
typename BaseGraph = lemon::SmartGraph>
120 template<
typename Number =
int>
147 _p = std::max(0.0, std::min(1.0, p));
156 for (
int i = 0; i <
_c; ++i) {
157 for (
int j = i + 1; j <
_c; ++j)
159 this->addEdge(this->nodeFromId(i * _s +
_r->integer(_s)),
160 this->nodeFromId(j * _s +
_r->integer(_s)));
CliqueGraph(Number seed=0)
Constructor with seed.
Class describing a cycle of cliques.
lemon::Random * _r
Random number generator.
void seed(Number seed)
Change the random number generator seed.
int cliqueOrder() const
Retrieve the order of each clique.
virtual Graph & init(int s, int c)
Initialise the generator.
virtual Graph & init(int s, int c, double p)
Initialise the generator.
virtual void generate()
Generate graph.
Contains base definitions for defining particular random graphs.
Default namespace Default namespace for MinLCA algorithms.
int cliques() const
Retrieve the number of cliques.
Class describing a random graph with cliques.
int _s
Order of each clique.
virtual Graph & init(int s, int c)
Initialise the generator.
double _p
Probability of edge between cliques.
Class describing a set of non-adjacent cliques.
Base class for random graph generators.
CliqueGraph(lemon::Random &r)
Constructor with custom random number generator.