FordFulkersonMaxFlowUnitTest.test_max_flow()   A
last analyzed

Complexity

Conditions 2

Size

Total Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
cc 2
c 2
b 0
f 0
dl 0
loc 7
rs 9.4285
1
import unittest
2
3
from pyalgs.algorithms.graphs.max_flow import FordFulkersonMaxFlow
4
from tests.algorithms.graphs.util import create_flow_network
5
6
7
class FordFulkersonMaxFlowUnitTest(unittest.TestCase):
8
    def test_max_flow(self):
9
        network = create_flow_network()
10
        ff = FordFulkersonMaxFlow(network, 0, 7)
11
        print('max-flow: '+str(ff.max_flow_value()))
12
        self.assertEqual(28, ff.max_flow_value())
13
        for e in ff.min_cut():
14
            print('min-cut: ' + str(e))
15
16
if __name__ == '__main__':
17
    unittest.main()
18