-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMKMAlgo.h
More file actions
51 lines (32 loc) · 1.04 KB
/
MKMAlgo.h
File metadata and controls
51 lines (32 loc) · 1.04 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 MKMÀlgo_h
#define MKMÀlgo_h
#include <vector>
#include <queue>
#include <list>
#include "Network.h"
#include "BFSforAll.h"
#include "MaxFlowFinder.h"
using namespace std;
class MKMAlgo : public MaxFlowFinder {
private:
std::vector <bool> deletedVerteces;
std::vector <long long> inPotential, outPotential, potential;
std::vector <size_t> currentEdge, level;
static const long long INF = 1e16;
void updatePotential(size_t v);
void calculateVertexPotential(size_t u);
long long pushByEdge(size_t u, size_t number, long long flowToPush);
void sendFlow(size_t v, long long sizeFlow, bool toStart);
void makeFlowThrough(size_t v);
void deleteVertex(size_t u);
void resizePotentials();
public:
Network networkGraph;
vector < pair <size_t, size_t> > inputEdgesOrder;
~MKMAlgo() {}
MKMAlgo(vector < pair <size_t, size_t> > &inputEdgesOrderIN);
void findMaxFlow(Network networkGraphInput);
void output(std::vector < std::pair <size_t, size_t> > inputEdgesOrder);
};
ostream& operator << (ostream& stream, MKMAlgo algo);
#endif