KruskalMSTUnitTest.test_mst()   A
last analyzed

Complexity

Conditions 2

Size

Total Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
c 1
b 0
f 0
dl 0
loc 8
rs 9.4285
1
import unittest
2
3
from pyalgs.algorithms.graphs.minimum_spanning_trees import KruskalMST, LazyPrimMST, EagerPrimMST
4
from tests.algorithms.graphs.util import create_edge_weighted_graph
5
6
7
class KruskalMSTUnitTest(unittest.TestCase):
8
    def test_mst(self):
9
        g = create_edge_weighted_graph()
10
        mst = KruskalMST(g)
11
12
        tree = mst.spanning_tree()
13
14
        for e in tree:
15
            print(e)
16
17
18
class LazyPrimMSTUnitTest(unittest.TestCase):
19
    def test_mst(self):
20
        g = create_edge_weighted_graph()
21
        mst = LazyPrimMST(g)
22
23
        tree = mst.spanning_tree()
24
25
        for e in tree:
26
            print(e)
27
28
29
class EagerPrimMSTUnitTest(unittest.TestCase):
30
    def test_mst(self):
31
        g = create_edge_weighted_graph()
32
        mst = EagerPrimMST(g)
33
34
        tree = mst.spanning_tree()
35
36
        for e in tree:
37
            print(e)
38
39
40
if __name__ == '__main__':
41
    unittest.main()
42