-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMaxFlow.h
37 lines (31 loc) · 1.12 KB
/
MaxFlow.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
#ifndef _MAX_FLOW_HPP_
#define _MAX_FLOW_HPP_
#include <boost/config.hpp>
#include <boost/graph/adjacency_list.hpp>
#include <boost/graph/graph_utility.hpp>
using namespace std;
using namespace boost;
class Network {
private:
typedef adjacency_list_traits < vecS, vecS, directedS > Traits;
public:
typedef Traits::vertex_descriptor Vertex;
Network();
Vertex AddVertex();
void AddEdge(Vertex& v1, Vertex& v2, const long capacity);
void dfs(int v, std::vector<bool>& visited);
unsigned long long MaxFlow(Vertex& s, Vertex& t);
private:
typedef adjacency_list < vecS, vecS, directedS,
property < vertex_name_t, std::string,
property < vertex_index_t, long,
property < vertex_color_t, boost::default_color_type,
property < vertex_distance_t, long,
property < vertex_predecessor_t, Traits::edge_descriptor > > > > >,
property < edge_capacity_t, long long,
property < edge_residual_capacity_t, long long,
property < edge_reverse_t, Traits::edge_descriptor > > > > Graph;
Graph g;
property_map < Graph, edge_reverse_t >::type rev;
};
#endif