コード例 #1
0
ファイル: test_threshold.py プロジェクト: blublud/networkx
    def test_threshold_sequence_graph_test(self):
        G=nx.star_graph(10)
        assert_true(nxt.is_threshold_graph(G))
        assert_true(nxt.is_threshold_sequence(list(d for n, d in G.degree())))

        G=nx.complete_graph(10)
        assert_true(nxt.is_threshold_graph(G))
        assert_true(nxt.is_threshold_sequence(list(d for n, d in G.degree())))

        deg=[3,2,2,1,1,1]
        assert_false(nxt.is_threshold_sequence(deg))

        deg=[3,2,2,1]
        assert_true(nxt.is_threshold_sequence(deg))

        G=nx.generators.havel_hakimi_graph(deg)
        assert_true(nxt.is_threshold_graph(G))
コード例 #2
0
ファイル: test_threshold.py プロジェクト: zahra-mor/networkx
    def test_threshold_sequence_graph_test(self):
        G = nx.star_graph(10)
        assert nxt.is_threshold_graph(G)
        assert nxt.is_threshold_sequence(list(d for n, d in G.degree()))

        G = nx.complete_graph(10)
        assert nxt.is_threshold_graph(G)
        assert nxt.is_threshold_sequence(list(d for n, d in G.degree()))

        deg = [3, 2, 2, 1, 1, 1]
        assert not nxt.is_threshold_sequence(deg)

        deg = [3, 2, 2, 1]
        assert nxt.is_threshold_sequence(deg)

        G = nx.generators.havel_hakimi_graph(deg)
        assert nxt.is_threshold_graph(G)