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

#define max(a,b) a>b?a:b
#define min(a,b) a<b?a:b
#define clamp(a,b,c) max(a,min(b, c))
#define array(name, size) name[size]; for(int i=0; i<size; i++) name[i]=0;

using namespace std;

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

    void GetDistancesFrom(int node, int* distance);
21
    void KillMachines(float proportion);
22 23 24 25 26 27 28
   
    vector<int>* adjacency;
    int size;
private:
    uniform_int_distribution<int> distrib;
};