Example #1
0
 def __check_for_circles(self):
     '''This does check if there is a directed circle (e.g. an strongly
        connected component) in the modules graph.'''
     scc = strongly_connected_components(self)
     if check_for_strongly_connected_components(scc):
         raise RMTException(26, "There is a strongly connected "
                            "component in the modules graph '%s'"
                            % scc)
Example #2
0
 def __check_for_circles(self):
     '''This does check if there is a directed circle (e.g. an strongly
        connected component) in the modules graph.'''
     scc = strongly_connected_components(self)
     if check_for_strongly_connected_components(scc):
         raise RMTException(
             26, "There is a strongly connected "
             "component in the modules graph '%s'" % scc)
 def rewrite(self, reqset):
     scc = strongly_connected_components(reqset)
     result = check_for_strongly_connected_components(scc)
     if result == True:
         print("+++ ERROR: There is at least one circular "
               "dependency component: '%s'" %
               remove_single_element_lists_name_rest(scc))
         return False
     return True
Example #4
0
 def rewrite(self, reqset):
     scc = strongly_connected_components(reqset)
     result = check_for_strongly_connected_components(scc)
     if result == True:
         print("+++ ERROR: There is at least one circular "
               "dependency component: '%s'" %
               remove_single_element_lists_name_rest(scc))
         return False
     return True
Example #5
0
 def test_scc_006(self):
     "Check for scc in a three node digraph with scc"
     dg = digraph_create_from_dict({
         "A": ["B", "C"],
         "B": ["A"],
         "C": ["B"]
     })
     sccs = strongly_connected_components(dg)
     scc_exists = check_for_strongly_connected_components(sccs)
     self.assertEqual(scc_exists, True, "incorrect")
Example #6
0
 def test_scc_005(self):
     "Simple three node digraph with one scc II"
     dg = digraph_create_from_dict({
         "A": ["B", "C"],
         "B": ["A"],
         "C": ["B"]
     })
     sccs = strongly_connected_components(dg)
     sccsnames = node_sl_to_node_name_sl(sccs)
     self.assertEqual(sccsnames, [set(['A', 'C', 'B'])], "incorrect")
Example #7
0
 def rewrite(reqset):
     """The rewrite function here does mostly a search for strongly
     connected components.  It uses the algorithm from Trajan for
     this - which is implemented in the digraph library.
     """
     scc = strongly_connected_components(reqset)
     result = check_for_strongly_connected_components(scc)
     if result:
         print("+++ ERROR: There is at least one circular "
               "dependency component: '%s'" %
               remove_single_element_lists_name_rest(scc))
         return False
     return True
Example #8
0
 def rmttest_scc_008(self):
     "Check for scc in a three node digraph with a two node scc"
     dg = Digraph({"A": ["B"], "B": ["A"], "C": []})
     sccs = strongly_connected_components(dg)
     scc_exists = check_for_strongly_connected_components(sccs)
     self.assertEqual(scc_exists, True, "incorrect")
Example #9
0
 def rmttest_scc_002(self):
     "Simple two node digraph with no scc"
     dg = Digraph({"A": ["B"], "B": []})
     sccs = strongly_connected_components(dg)
     sccsnames = node_sl_to_node_name_sl(sccs)
     self.assertEqual(sccsnames, [set(['B']), set(['A'])], "incorrect")
Example #10
0
 def rmttest_scc_003(self):
     "Simple three node digraph with one scc and an extra node"
     dg = Digraph({"A": ["B", "C"], "B": ["A"], "C": []})
     sccs = strongly_connected_components(dg)
     sccsnames = node_sl_to_node_name_sl(sccs)
     self.assertEqual(sccsnames, [set(['C']), set(['A', 'B'])], "incorrect")
Example #11
0
 def rmttest_scc_005(self):
     "Simple three node digraph with one scc II"
     dg = Digraph({"A": ["B", "C"], "B": ["A"], "C": ["B"]})
     sccs = strongly_connected_components(dg)
     sccsnames = node_sl_to_node_name_sl(sccs)
     assert sccsnames == [set(['A', 'C', 'B'])], "incorrect"
Example #12
0
 def rmttest_scc_008(self):
     "Check for scc in a three node digraph with a two node scc"
     dg = Digraph({"A": ["B"], "B": ["A"], "C": []})
     sccs = strongly_connected_components(dg)
     scc_exists = check_for_strongly_connected_components(sccs)
     assert scc_exists is True, "incorrect"
Example #13
0
 def rmttest_scc_007(self):
     "Check for scc in a three node digraph without scc"
     dg = Digraph({"A": ["B"], "B": ["C"], "C": []})
     sccs = strongly_connected_components(dg)
     scc_exists = check_for_strongly_connected_components(sccs)
     assert scc_exists is False, "incorrect"
Example #14
0
 def rmttest_scc_002(self):
     "Simple two node digraph with no scc"
     dg = Digraph({"A": ["B"], "B": []})
     sccs = strongly_connected_components(dg)
     sccsnames = node_sl_to_node_name_sl(sccs)
     assert sccsnames == [set(['B']), set(['A'])], "incorrect"
Example #15
0
 def test_scc_007(self):
     "Check for scc in a three node digraph without scc"
     dg = Digraph({"A": ["B"], "B": ["C"], "C": []})
     sccs = strongly_connected_components(dg)
     scc_exists = check_for_strongly_connected_components(sccs)
     self.assertEqual(scc_exists, False, "incorrect")
Example #16
0
 def rmttest_scc_005(self):
     "Simple three node digraph with one scc II"
     dg = Digraph({"A": ["B", "C"], "B": ["A"], "C": ["B"]})
     sccs = strongly_connected_components(dg)
     sccsnames = node_sl_to_node_name_sl(sccs)
     assert sccsnames == [set(['A', 'C', 'B'])], "incorrect"
Example #17
0
 def check_for_circles(self):
     scc = strongly_connected_components(self)
     if check_for_strongly_connected_components(scc):
         raise RMTException(26, "There is a strongly connected "
                            "component in the modules graph '%s'"
                            % scc)
Example #18
0
 def test_scc_004(self):
     "Simple three node digraph with one scc I"
     dg = Digraph({"A": ["B", "C"], "B": ["A"], "C": ["A"]})
     sccs = strongly_connected_components(dg)
     sccsnames = node_sl_to_node_name_sl(sccs)
     self.assertEqual(sccsnames, [set(["A", "C", "B"])], "incorrect")
Example #19
0
 def test_scc_002(self):
     "Simple two node digraph with no scc"
     dg = digraph_create_from_dict({"A": ["B"], "B": [] })
     sccs = strongly_connected_components(dg)
     sccsnames = node_sl_to_node_name_sl(sccs)
     self.assertEqual(sccsnames, [set(['B']), set(['A'])], "incorrect")
Example #20
0
 def test_scc_005(self):
     "Simple three node digraph with one scc II"
     dg = digraph_create_from_dict({"A": ["B", "C"], "B": ["A"], "C": ["B"] })
     sccs = strongly_connected_components(dg)
     sccsnames = node_sl_to_node_name_sl(sccs)
     self.assertEqual(sccsnames, [set(['A', 'C', 'B'])], "incorrect")
Example #21
0
 def test_scc_008(self):
     "Check for scc in a three node digraph with a two node scc"
     dg = digraph_create_from_dict({"A": ["B"], "B": ["A"], "C": [] })
     sccs = strongly_connected_components(dg)
     scc_exists = check_for_strongly_connected_components(sccs)
     self.assertEqual(scc_exists, True, "incorrect")