-
Notifications
You must be signed in to change notification settings - Fork 2
/
DynDSAlg.h
71 lines (53 loc) · 1.26 KB
/
DynDSAlg.h
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
/*
* DynDSAlg.h
*
* Created on: Oct 15, 2014
* Author: aepasto
*/
#ifndef DYNDSALG_H_
#define DYNDSALG_H_
#include "DynGraph.h"
#include "UDynGraph.h"
#include "DSAlgs.h"
#include "DynGraphUtils.h"
// Class implementing the dynamic densest subgraph
class DynDSAdd {
public:
const double EPS_ERR;
explicit DynDSAdd(const double epsilon);
virtual ~DynDSAdd();
bool add_edge(const int u, const int v);
double beta() const {
return beta_;
}
double density_subgraph() const {
if (densest_subgraph_set_.size() == 0) {
return 0.0;
}
return static_cast<double>(edges_densest_subgraph_)
/ static_cast<double>(densest_subgraph_set_.size());
}
inline int max_in_degree_upperbound() const {
return orientation_.max_in_deg_upperbound();
}
inline const unordered_set<int>& densest_subgraph() const {
return densest_subgraph_set_;
}
inline long num_edges() const {
return graph_.num_edges();
}
inline unsigned int size_densest() const {
return densest_subgraph_set_.size();
}
private:
void Construct();
void Check(int node);
DynGraph orientation_;
UDynGraph graph_;
double epsilon_;
unordered_set<int> densest_subgraph_set_;
double beta_;
int edges_densest_subgraph_;
unordered_map<int, int> level_map_;
};
#endif /* DYNDSALG_H_ */