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 __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
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
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")
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")
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
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")
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")
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")
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"
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"
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"
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"
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")
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"
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)
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")
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")
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")
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")