-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFlowNetwork.h
51 lines (33 loc) · 1.05 KB
/
FlowNetwork.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
#ifndef LhCDSCVX_FLOWNETWORK_H
#define LhCDSCVX_FLOWNETWORK_H
#include <vector>
#include <queue>
#include "EdgeFN.h"
#include <cmath>
#include <map>
using namespace std;
class FlowNetwork {
public:
int n;
vector <vector <EdgeFN>> adj;
vector <double> excess;
vector <int> dist, count;
vector <bool> active;
vector <vector <int>> B;
vector<int> nums;
map<int, int> mapping;
std::vector<int> ori_id;
int b;
double m;
FlowNetwork(vector<pair<int, int>> edges, double g, bool LhCDSvalidate = false);
FlowNetwork(vector<pair<int, int>> edges, vector<pair<int, int>>clique_edges, vector<pair<int, int>>dtr, vector<pair<int, double>>cap, double g);
void add_edge(int from, int to, double cap);
void enqueue (int v);
void push (EdgeFN &e);
void gap (int k);
void relabel (int v);
void discharge (int v);
double get_maxflow(int s, int t, bool need_initial = true);
double get_mincut(int s, int t, std::vector<int> &S, bool need_initial = true);
};
#endif //LhCDSCVX_FLOWNETWORK_H