Exemple #1
0
 def test_create_using_keyword_arguments(self):
     assert_raises(networkx.exception.NetworkXError,
                   gn_graph,
                   100,
                   create_using=Graph())
     assert_raises(networkx.exception.NetworkXError,
                   gnr_graph,
                   100,
                   0.5,
                   create_using=Graph())
     assert_raises(networkx.exception.NetworkXError,
                   gnc_graph,
                   100,
                   create_using=Graph())
     assert_raises(networkx.exception.NetworkXError,
                   scale_free_graph,
                   100,
                   create_using=Graph())
     G = gn_graph(100, seed=1)
     MG = gn_graph(100, create_using=MultiDiGraph(), seed=1)
     assert_equal(sorted(G.edges()), sorted(MG.edges()))
     G = gnr_graph(100, 0.5, seed=1)
     MG = gnr_graph(100, 0.5, create_using=MultiDiGraph(), seed=1)
     assert_equal(sorted(G.edges()), sorted(MG.edges()))
     G = gnc_graph(100, seed=1)
     MG = gnc_graph(100, create_using=MultiDiGraph(), seed=1)
     assert_equal(sorted(G.edges()), sorted(MG.edges()))
Exemple #2
0
    def test_create_using_keyword_arguments(self):
        assert_raises(nx.NetworkXError, gn_graph, 100, create_using=Graph())
        assert_raises(nx.NetworkXError,
                      gnr_graph,
                      100,
                      0.5,
                      create_using=Graph())
        assert_raises(nx.NetworkXError, gnc_graph, 100, create_using=Graph())
        assert_raises(nx.NetworkXError,
                      scale_free_graph,
                      100,
                      create_using=Graph())
        G = gn_graph(100, seed=1)
        MG = gn_graph(100, create_using=MultiDiGraph(), seed=1)
        assert_equal(sorted(G.edges()), sorted(MG.edges()))
        G = gnr_graph(100, 0.5, seed=1)
        MG = gnr_graph(100, 0.5, create_using=MultiDiGraph(), seed=1)
        assert_equal(sorted(G.edges()), sorted(MG.edges()))
        G = gnc_graph(100, seed=1)
        MG = gnc_graph(100, create_using=MultiDiGraph(), seed=1)
        assert_equal(sorted(G.edges()), sorted(MG.edges()))

        G = scale_free_graph(100,
                             alpha=0.3,
                             beta=0.4,
                             gamma=0.3,
                             delta_in=0.3,
                             delta_out=0.1,
                             create_using=MultiDiGraph,
                             seed=1)
        assert_raises(ValueError, scale_free_graph, 100, 0.5, 0.4, 0.3)
        assert_raises(ValueError, scale_free_graph, 100, alpha=-0.3)
        assert_raises(ValueError, scale_free_graph, 100, beta=-0.3)
        assert_raises(ValueError, scale_free_graph, 100, gamma=-0.3)
Exemple #3
0
    def test_create_using_keyword_arguments(self):
        assert_raises(nx.NetworkXError,
                      gn_graph, 100, create_using=Graph())
        assert_raises(nx.NetworkXError,
                      gnr_graph, 100, 0.5, create_using=Graph())
        assert_raises(nx.NetworkXError,
                      gnc_graph, 100, create_using=Graph())
        assert_raises(nx.NetworkXError,
                      scale_free_graph, 100, create_using=Graph())
        G = gn_graph(100, seed=1)
        MG = gn_graph(100, create_using=MultiDiGraph(), seed=1)
        assert_equal(sorted(G.edges()), sorted(MG.edges()))
        G = gnr_graph(100, 0.5, seed=1)
        MG = gnr_graph(100, 0.5, create_using=MultiDiGraph(), seed=1)
        assert_equal(sorted(G.edges()), sorted(MG.edges()))
        G = gnc_graph(100, seed=1)
        MG = gnc_graph(100, create_using=MultiDiGraph(), seed=1)
        assert_equal(sorted(G.edges()), sorted(MG.edges()))

        G = scale_free_graph(100, alpha=0.3, beta=0.4, gamma=0.3,
                             delta_in=0.3, delta_out=0.1,
                             create_using=MultiDiGraph, seed=1)
        assert_raises(ValueError, scale_free_graph, 100, 0.5, 0.4, 0.3)
        assert_raises(ValueError, scale_free_graph, 100, alpha=-0.3)
        assert_raises(ValueError, scale_free_graph, 100, beta=-0.3)
        assert_raises(ValueError, scale_free_graph, 100, gamma=-0.3)
Exemple #4
0
    def test_smoke_test_random_graphs(self):
        gn_graph(100)
        gnr_graph(100, 0.5)
        gnc_graph(100)
        scale_free_graph(100)

        gn_graph(100, seed=42)
        gnr_graph(100, 0.5, seed=42)
        gnc_graph(100, seed=42)
        scale_free_graph(100, seed=42)
Exemple #5
0
    def test_smoke_test_random_graphs(self):
        gn_graph(100)
        gnr_graph(100, 0.5)
        gnc_graph(100)
        scale_free_graph(100)

        gn_graph(100, seed=42)
        gnr_graph(100, 0.5, seed=42)
        gnc_graph(100, seed=42)
        scale_free_graph(100, seed=42)
 def test_create_using_keyword_arguments(self):
     assert_raises(networkx.exception.NetworkXError,
                   gn_graph, 100, create_using=Graph())
     assert_raises(networkx.exception.NetworkXError,
                   gnr_graph, 100, 0.5, create_using=Graph())
     assert_raises(networkx.exception.NetworkXError,
                   gnc_graph, 100, create_using=Graph())
     assert_raises(networkx.exception.NetworkXError,
                   scale_free_graph, 100, create_using=Graph())
     G=gn_graph(100,seed=1)
     MG=gn_graph(100,create_using=MultiDiGraph(),seed=1)
     assert_equal(sorted(G.edges()), sorted(MG.edges()))
     G=gnr_graph(100,0.5,seed=1)
     MG=gnr_graph(100,0.5,create_using=MultiDiGraph(),seed=1)
     assert_equal(sorted(G.edges()), sorted(MG.edges()))
     G=gnc_graph(100,seed=1)
     MG=gnc_graph(100,create_using=MultiDiGraph(),seed=1)
     assert_equal(sorted(G.edges()), sorted(MG.edges()))