def test_no_single_node_is_total_dominating_set_of_star(): G = gp.star_graph(3) for v in gp.nodes(G): assert (gp.is_total_dominating_set(G, [v]) is False)
def test_center_and_two_leaves_of_star_is_not_2_independent_set(): G = gp.star_graph(3) assert (gp.is_independent_set(G, [0, 1, 2]) is False)
def test_leaf_is_not_power_dominating_set_of_star(self): for i in range(3, 13): G = gp.star_graph(i) for j in range(1, i + 1): assert (gp.is_power_dominating_set(G, [j]) == False)
def test_min_maximal_matching_number_of_star_is_1(): for i in range(1, 11): G = gp.star_graph(i) assert(gp.min_maximal_matching_number(G) == 1)
def test_adjacent_vertices_of_star_is_not_independent_set(): G = gp.star_graph(3) assert (gp.is_independent_set(G, [0, 1]) is False) assert (gp.is_independent_set(G, [0, 2]) is False)
def test_0_value_for_k_raises_ValueError_in_is_k_forcing(self): with pytest.raises(ValueError, message="Excepted non-positive value for k to throw ValueError."): G = gp.star_graph(2) gp.is_k_forcing_vertex(G, 1, [1], 0)
def test_non_int_value_for_k_raises_error_in_is_connected_k_forcing(self): with pytest.raises(TypeError, message="Excepted non-integral value for k to throw TypeError."): G = gp.star_graph(2) gp.is_connected_k_forcing_set(G, [0], 1.5)
def test_center_is_not_zero_forcing_vertex_for_star(self): G = gp.star_graph(2) assert(gp.is_zero_forcing_vertex(G, 0, [0]) == False)
def test_no_vertex_is_zero_forcing_vertex_for_empty_set(self): G = gp.star_graph(2) assert(gp.is_zero_forcing_vertex(G, 0, set()) == False) assert(gp.is_zero_forcing_vertex(G, 1, set()) == False) assert(gp.is_zero_forcing_vertex(G, 2, set()) == False)
def test_integral_float_for_k_works(self): G = gp.star_graph(2) assert(gp.is_k_forcing_vertex(G, 1, [1], 1.0) == True)
def test_leaf_is_zero_forcing_vertex_for_star(self): G = gp.star_graph(2) assert(gp.is_zero_forcing_vertex(G, 1, [1]) == True)
def test_0_value_for_k_raises_error_in_connected_k_forcing_num(self): with pytest.raises(ValueError, message="Excepted non-positive value for k to throw ValueError."): G = gp.star_graph(2) gp.connected_k_forcing_number(G, 0)
def test_irregularity_star(self): for i in range(2, 10): G = gp.star_graph(i) assert (gp.irregularity(G) == 2.0)
def test_S4_is_not_claw_free(self): G = gp.star_graph(4) assert(gp.is_claw_free(G) == False)
def test_leaf_is_max_degree_minus_one_forcing_set_for_star(self): for i in range(3, 13): G = gp.star_graph(i) D = gp.max_degree(G) assert(gp.is_k_forcing_set(G, [1], D-1) == True)
def test_center_of_S3_is_3_forcing_vertex(self): G = gp.star_graph(3) assert(gp.is_k_forcing_vertex(G, 0, [0], 3) == True)
def test_zero_forcing_number_of_star_is_order_minus_2(self): for i in range(2, 12): G = gp.star_graph(i) assert(gp.zero_forcing_number(G) == G.order() - 2)
def test_center_of_S3_is_not_2_forcing_vertex(self): G = gp.star_graph(3) assert(gp.is_k_forcing_vertex(G, 0, [0], 2) == False)
def test_connected_zero_forcing_number_of_monster_is_4(self): G = gp.star_graph(3) G.add_edge(3, 4) G.add_edge(3, 5) assert(gp.connected_zero_forcing_number(G) == 4)
def test_non_integral_value_for_k_raises_TypeError_in_is_k_forcing(self): with pytest.raises(TypeError, message="Excepted non-integral value for k to throw TypeError."): G = gp.star_graph(2) gp.is_k_forcing_vertex(G, 1, [1], 1.5)
def test_matching_number_of_star_is_1(): for i in range(1, 11): G = gp.star_graph(i) assert(gp.matching_number(G, method='bf') == 1) assert(gp.matching_number(G, method='ilp') == 1)
def test_leaf_of_star_is_zero_forcing_active_set(self): G = gp.star_graph(2) assert(gp.is_zero_forcing_active_set(G, [1]) == True)
def test_star_is_not_2_regular(self): G = gp.star_graph(2) assert(gp.is_k_regular(G, 2) == False)
def test_center_of_star_is_not_zero_forcing_active_set(self): G = gp.star_graph(2) assert(gp.is_zero_forcing_active_set(G, [0]) == False)
def test_set_of_leaves_of_star_is_2_independent_set(): for i in range(2, 10): G = gp.star_graph(i) ind_set = set(j for j in range(1, i + 1)) assert (gp.is_k_independent_set(G, ind_set, 2) is True)
def test_empy_set_is_not_zero_forcing_active_set(self): G = gp.star_graph(2) assert(gp.is_zero_forcing_active_set(G, set()) == False)
def test_independence_number_of_star_is_order_minus_1(): for i in range(1, 10): G = gp.star_graph(i) assert (gp.independence_number(G, method='bf') == G.order() - 1) assert (gp.independence_number(G, method='ilp') == G.order() - 1)
def test_leaf_is_not_zero_forcing_set_of_S3(self): G = gp.star_graph(3) assert(gp.is_zero_forcing_set(G, [1]) == False)
def test_center_node_is_power_dominating_set_of_star(self): for i in range(1, 11): G = gp.star_graph(i) assert (gp.is_power_dominating_set(G, [0]) == True)
def test_2_dominating_set_with_nodes_not_in_graph(): G = gp.star_graph(3) nodes = [1, 2, 3, 4] assert (gp.is_k_dominating_set(G, [4], 1) is False) assert (gp.is_k_dominating_set(G, nodes, 1) is True)