예제 #1
0
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
예제 #2
0
def test_single_vertex_is_independent_set():
    G = gp.trivial_graph()
    assert gp.is_independent_set(G, [0]) is True
예제 #3
0
def test_empty_set_is_independent_set_of_trivial_graph():
    G = gp.trivial_graph()
    assert gp.is_independent_set(G, set()) is True
예제 #4
0
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
예제 #5
0
def test_set_of_leaves_of_star_is_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_independent_set(G, ind_set) is True