-
Notifications
You must be signed in to change notification settings - Fork 5
/
example.py
32 lines (25 loc) · 903 Bytes
/
example.py
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
### example ###
from MaxFlow import *
invalid_data = np.array([[0, 10, 0, 8, 0, 0],
[1, 0, 5, 2, 0, 0],
[0, 0, 0, 0, 0, 7],
[0, 0, 0, 0, 10, 0],
[0, 0, 8, 0, 0, 10],
[0, 0, 0, 0, 0, 0]])
# invalid_attempt = Graph(invalid_data)
valid_data = np.array([[0, 10, 0, 8, 0, 0],
[0, 0, 5, 2, 0, 0],
[0, 0, 0, 0, 0, 7],
[0, 0, 0, 0, 10, 0],
[0, 0, 8, 0, 0, 10],
[0, 0, 0, 0, 0, 0]])
EdmondKarp_graph = Graph(valid_data)
Dinic_graph = Graph(valid_data)
PushRelable_graph = Graph(valid_data)
print "Max flow for the given valid graph."
print "\nmax flow using Edmond Karp :"
print EdmondKarp_graph.EdmondKarp()
print "\nmax flow using Dinic :"
print Dinic_graph.Dinic()
print "\nmax flow using Push Relable :"
print PushRelable_graph.PushRelable()