-
Notifications
You must be signed in to change notification settings - Fork 0
/
graph.h
55 lines (36 loc) · 1.03 KB
/
graph.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
//
// Created by assasinfil and polyaria on 01.11.2020.
//
#ifndef GRAPH_H
#define GRAPH_H
#include <iostream>
#include <ostream>
#include <queue>
#include <vector>
#include <algorithm>
#include <climits>
class Graph {
public:
enum {
Ford_Fulkerson,
Edmonds_Karp,
Dinits_alg
};
explicit Graph(int n);
[[maybe_unused]] Graph(const Graph &other);
Graph &operator=(const Graph &op);
int EdmondsKarp(int source, int target);
int FordFulkerson(int source, int target);
std::vector<int> Bfs(int source);
int Dfs(int source, int flow, int target, std::vector<int> dist, std::vector<int> p);
int Dinits(int source, int target);
int maxFlow(int source, int target, int type);
virtual ~Graph();
friend std::ostream &operator<<(std::ostream &os, const Graph &graph);
friend std::istream &operator>>(std::istream &is, Graph &graph);
private:
int count;
std::vector<std::vector<int>> matrix;
std::vector<std::vector<int>> residualGraph;
};
#endif //GRAPH_H