main.h 973 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
#include <iostream>
#include <vector>
#include <random>
#include <queue>
#include <set>

using namespace std;

class Graph
{
public:
    Graph(int size, int k, int maxPeers, mt19937 rng);
    ~Graph() { delete[] adjacency; };

    void GetDistancesFrom(int node, int* distance);
16
    void KillMachines(float proportion);
17 18 19 20 21 22 23
   
    vector<int>* adjacency;
    int size;
private:
    uniform_int_distribution<int> distrib;
};

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
class Results
{
public:
    Results(int maxArity, int maxDistance);
    ~Results();

    void UpdateArity(const Graph& graph);
    void UpdateDistance(int* distance, int nSamples);
    void Finalise();

    double* arityDistrib;
    double* distanceDistrib;
    double disconnectionProba;
    double arityTooBig;
    double distanceTooBig;
    int64_t disconnected;
    int64_t nAritySample;
    int64_t nDistanceSample;
    int maxArity;
    int maxDistance;

private:
    void AddAritySample(int arity);
    void AddDistanceSample(int distance);
};