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
def test_max_degree_vertex_is_not_2_dominating_set_of_star(): for i in range(1, 9): G = gp.star_graph(i) assert gp.is_k_dominating_set(G, [0], 2) is False
def test_min_degree_vertices_are_2_dominating_set_of_star(): for i in range(2, 9): G = gp.star_graph(i) nodes = [i for i in range(1, i + 2)] assert gp.is_k_dominating_set(G, nodes, 2) is True
def test_dominating_set_with_nodes_not_in_graph(): G = gp.star_graph(3) assert gp.is_k_dominating_set(G, [4], 1) is False assert gp.is_k_dominating_set(G, [0, 4], 1) is True
def test_min_degree_vertex_is_not_dominating_set_of_star(): for i in range(2, 9): G = gp.star_graph(i) assert gp.is_k_dominating_set(G, [1], 1) is False
def test_integral_float_for_k_works(): G = gp.star_graph(2) assert gp.is_k_dominating_set(G, [0], 1.0) is True
def test_non_integral_value_for_k_raises_error_in_is_k_dom_set(): with pytest.raises(TypeError): G = gp.star_graph(2) gp.is_k_dominating_set(G, [0], 1.5)
def test_0_value_for_k_raises_error_in_is_k_dom_set(): with pytest.raises(ValueError): G = gp.star_graph(2) gp.is_k_dominating_set(G, [0], 0)