-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSimulation.h
More file actions
56 lines (35 loc) · 992 Bytes
/
Simulation.h
File metadata and controls
56 lines (35 loc) · 992 Bytes
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
/*
Definition of the Naive Simulation Class.
Author : Nan Du (dunan@gatech.edu)
*/
#ifndef SIMULATION_H
#define SIMULATION_H
#include "Common.h"
#include "Graph.h"
using namespace std;
struct Node2Time{
unsigned nodeID;
double time;
bool operator < (const Node2Time& n2t) const{
if (time < n2t.time) {
return true;
}else {
return false;
}
}
};
class Simulation{
private:
Graph* G;
SimpleRNG RNG;
private:
void GenerateCascade(vector<Node2Time>& cascade, vector<Node2Time>& visitedNodes, set<unsigned>& initialSet, double TimeHorizon, map<unsigned, unsigned>& infectedBy);
public:
Simulation(Graph *G);
Simulation(const Graph &G);
~Simulation(){};
double RandomSimulation(double T, set<unsigned>& initialSet, unsigned C);
void OutputCascadeBySingleNode(const double &T, const unsigned &C, const string &filename, const string &visitedFile);
void LoadCascade(const string &filename, vector<vector<set<unsigned> > > &node_to_cascades);
};
#endif