Completed
Push — master ( 6ecd56...a35e0e )
by Xianshun
01:17
created

LazyPrimMSTUnitTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 9
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 9
rs 10
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A test_mst() 0 8 2
1
import unittest
2
3
from pyalgs.algorithms.graphs.minimum_spanning_trees import KruskalMST, LazyPrimMST
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
class LazyPrimMSTUnitTest(unittest.TestCase):
18
    def test_mst(self):
19
        g = create_edge_weighted_graph()
20
        mst = LazyPrimMST(g)
21
22
        tree = mst.spanning_tree()
23
24
        for e in tree:
25
            print(e)
26
27
if __name__ == '__main__':
28
    unittest.main()