-
Notifications
You must be signed in to change notification settings - Fork 90
Expand file tree
/
Copy pathtemporal_network.h
More file actions
51 lines (37 loc) · 1.36 KB
/
temporal_network.h
File metadata and controls
51 lines (37 loc) · 1.36 KB
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
#ifndef RPI_TEMPORAL_NETWORK
#define RPI_TEMPORAL_NETWORK
#include <set>
#include <map>
#include <iostream>
#include <vector>
#include <memory>
#include "../util/io_helper.h"
#include "../util/string_helper.h"
#include "network.h"
using namespace std;
typedef set<shared_ptr<string>, cmp_str_ptr> community;
/**
*@class TemporalNetwork
*
*/
class temporal_network {
public:
temporal_network() {};
~temporal_network() {};
shared_ptr<network>
AddNetwork(const string &filename, const string &delimiters, const bool &directed); //Add new network to series
void AddCommunities(const string &filename, const string &delimiters); //Add new community structure
set<string>::const_iterator getFirstVertex() { return vertex_set.begin(); }
set<string>::const_iterator getLastVertex() { return vertex_set.end(); }
int CommSteps() { return communities.size(); }
int NetSteps() { return networks.size(); }
set<community, cmp_set_str> &ComStructure(int timestep) {
if ((timestep < 0) || ((unsigned int) timestep >= communities.size())) return communities[0];
return communities[timestep];
}
private:
set<string> vertex_set; //List of vertices in any of the networks
vector<shared_ptr<network> > networks; //List of networks (in order from earliest to latest)
vector<set<community, cmp_set_str> > communities;
};
#endif