<s> from nose . tools import * <EOL> from networkx import * <EOL> from networkx . generators . random_graphs import * <EOL> class TestGeneratorsRandom ( ) : <EOL> def smoke_test_random_graph ( self ) : <EOL> seed = <NUM_LIT> <EOL> G = gnp_random_graph ( <NUM_LIT:100> , <NUM_LIT> , seed ) <EOL> G = binomial_graph ( <NUM_LIT:100> , <NUM_LIT> , seed ) <EOL> G = erdos_renyi_graph ( <NUM_LIT:100> , <NUM_LIT> , seed ) <EOL> G = fast_gnp_random_graph ( <NUM_LIT:100> , <NUM_LIT> , seed ) <EOL> G = gnm_random_graph ( <NUM_LIT:100> , <NUM_LIT:20> , seed ) <EOL> G = dense_gnm_random_graph ( <NUM_LIT:100> , <NUM_LIT:20> , seed ) <EOL> G = watts_strogatz_graph ( <NUM_LIT:10> , <NUM_LIT:2> , <NUM_LIT> , seed ) <EOL> assert_equal ( len ( G ) , <NUM_LIT:10> ) <EOL> assert_equal ( G . number_of_edges ( ) , <NUM_LIT:10> ) <EOL> G = connected_watts_strogatz_graph ( <NUM_LIT:10> , <NUM_LIT:2> , <NUM_LIT:0.1> , seed ) <EOL> assert_equal ( len ( G ) , <NUM_LIT:10> ) <EOL> assert_equal ( G . number_of_edges ( ) , <NUM_LIT:10> ) <EOL> G = watts_strogatz_graph ( <NUM_LIT:10> , <NUM_LIT:4> , <NUM_LIT> , seed ) <EOL> assert_equal ( len ( G ) , <NUM_LIT:10> ) <EOL> assert_equal ( G . number_of_edges ( ) , <NUM_LIT:20> ) <EOL> G = newman_watts_strogatz_graph ( <NUM_LIT:10> , <NUM_LIT:2> , <NUM_LIT:0.0> , seed ) <EOL> assert_equal ( len ( G ) , <NUM_LIT:10> ) <EOL> assert_equal ( G . number_of_edges ( ) , <NUM_LIT:10> ) <EOL> G = newman_watts_strogatz_graph ( <NUM_LIT:10> , <NUM_LIT:4> , <NUM_LIT> , seed ) <EOL> assert_equal ( len ( G ) , <NUM_LIT:10> ) <EOL> assert_true ( G . number_of_edges ( ) >= <NUM_LIT:20> ) <EOL> G = barabasi_albert_graph ( <NUM_LIT:100> , <NUM_LIT:1> , seed ) <EOL> G = barabasi_albert_graph ( <NUM_LIT:100> , <NUM_LIT:3> , seed ) <EOL> assert_equal ( G . number_of_edges ( ) , ( <NUM_LIT> * <NUM_LIT:3> ) ) <EOL> G = powerlaw_cluster_graph ( <NUM_LIT:100> , <NUM_LIT:1> , <NUM_LIT:1.0> , seed ) <EOL> G = powerlaw_cluster_graph ( <NUM_LIT:100> , <NUM_LIT:3> , <NUM_LIT:0.0> , seed ) <EOL> assert_equal ( G . number_of_edges ( ) , ( <NUM_LIT> * <NUM_LIT:3> ) ) <EOL> G = random_regular_graph ( <NUM_LIT:10> , <NUM_LIT:20> , seed ) <EOL> assert_raises ( networkx . exception . NetworkXError , <EOL> random_regular_graph , <NUM_LIT:3> , <NUM_LIT> ) <EOL> constructor = [ ( <NUM_LIT:10> , <NUM_LIT:20> , <NUM_LIT> ) , ( <NUM_LIT:20> , <NUM_LIT> , <NUM_LIT> ) ] <EOL> G = random_shell_graph ( constructor , seed ) <EOL> G = nx . random_lobster ( <NUM_LIT:10> , <NUM_LIT:0.1> , <NUM_LIT:0.5> , seed ) <EOL> def test_gnp ( self ) : <EOL> G = gnp_random_graph ( <NUM_LIT:10> , <NUM_LIT:0.1> ) <EOL> assert_equal ( len ( G ) , <NUM_LIT:10> ) <EOL> G = gnp_random_graph ( <NUM_LIT:10> , <NUM_LIT:0.1> , seed = <NUM_LIT> ) <EOL> assert_equal ( len ( G ) , <NUM_LIT:10> ) <EOL> G = gnp_random_graph ( <NUM_LIT:10> , <NUM_LIT> ) <EOL> assert_equal ( len ( G ) , <NUM_LIT:10> ) <EOL> assert_equal ( len ( G . edges ( ) ) , <NUM_LIT> ) <EOL> G = gnp_random_graph ( <NUM_LIT:10> , <NUM_LIT> , directed = True ) <EOL> assert_equal ( len ( G ) , <NUM_LIT:10> ) <EOL> assert_equal ( len ( G . edges ( ) ) , <NUM_LIT> ) <EOL> G = gnp_random_graph ( <NUM_LIT:10> , - <NUM_LIT> ) <EOL> assert_equal ( len ( G ) , <NUM_LIT:10> ) <EOL> assert_equal ( len ( G . edges ( ) ) , <NUM_LIT:0> ) <EOL> G = binomial_graph ( <NUM_LIT:10> , <NUM_LIT:0.1> ) <EOL> assert_equal ( len ( G ) , <NUM_LIT:10> ) <EOL> G = erdos_renyi_graph ( <NUM_LIT:10> , <NUM_LIT:0.1> ) <EOL> assert_equal ( len ( G ) , <NUM_LIT:10> ) <EOL> def test_fast_gnp ( self ) : <EOL> G = fast_gnp_random_graph ( <NUM_LIT:10> , <NUM_LIT:0.1> ) <EOL> assert_equal ( len ( G ) , <NUM_LIT:10> ) <EOL> G = fast_gnp_random_graph ( <NUM_LIT:10> , <NUM_LIT:0.1> , seed = <NUM_LIT> ) <EOL> assert_equal ( len ( G ) , <NUM_LIT:10> ) <EOL> G = fast_gnp_random_graph ( <NUM_LIT:10> , <NUM_LIT> ) <EOL> assert_equal ( len ( G ) , <NUM_LIT:10> ) <EOL> assert_equal ( len ( G . edges ( ) ) , <NUM_LIT> ) <EOL> G = fast_gnp_random_graph ( <NUM_LIT:10> , - <NUM_LIT> ) <EOL> assert_equal ( len ( G ) , <NUM_LIT:10> ) <EOL> assert_equal ( len ( G . edges ( ) ) , <NUM_LIT:0> ) <EOL> G = fast_gnp_random_graph ( <NUM_LIT:10> , <NUM_LIT:0.1> , directed = True ) <EOL> assert_true ( G . is_directed ( ) ) <EOL> assert_equal ( len ( G ) , <NUM_LIT:10> ) <EOL> def test_gnm ( self ) : <EOL> G = gnm_random_graph ( <NUM_LIT:10> , <NUM_LIT:3> ) <EOL> assert_equal ( len ( G ) , <NUM_LIT:10> ) <EOL> assert_equal ( len ( G . edges ( ) ) , <NUM_LIT:3> ) <EOL> G = gnm_random_graph ( <NUM_LIT:10> , <NUM_LIT:3> , seed = <NUM_LIT> ) <EOL> assert_equal ( len ( G ) , <NUM_LIT:10> ) <EOL> assert_equal ( len ( G . edges ( ) ) , <NUM_LIT:3> ) <EOL> G = gnm_random_graph ( <NUM_LIT:10> , <NUM_LIT:100> ) <EOL> assert_equal ( len ( G ) , <NUM_LIT:10> ) <EOL> assert_equal ( len ( G . edges ( ) ) , <NUM_LIT> ) <EOL> G = gnm_random_graph ( <NUM_LIT:10> , <NUM_LIT:100> , directed = True ) <EOL> assert_equal ( len ( G ) , <NUM_LIT:10> ) <EOL> assert_equal ( len ( G . edges ( ) ) , <NUM_LIT> ) <EOL> G = gnm_random_graph ( <NUM_LIT:10> , - <NUM_LIT> ) <EOL> assert_equal ( len ( G ) , <NUM_LIT:10> ) <EOL> assert_equal ( len ( G . edges ( ) ) , <NUM_LIT:0> ) <EOL> def test_watts_strogatz_big_k ( self ) : <EOL> assert_raises ( networkx . exception . NetworkXError , <EOL> watts_strogatz_graph , <NUM_LIT:10> , <NUM_LIT:10> , <NUM_LIT> ) <EOL> assert_raises ( networkx . exception . NetworkXError , <EOL> newman_watts_strogatz_graph , <NUM_LIT:10> , <NUM_LIT:10> , <NUM_LIT> ) <EOL> watts_strogatz_graph ( <NUM_LIT:10> , <NUM_LIT:9> , <NUM_LIT> , seed = <NUM_LIT:0> ) <EOL> newman_watts_strogatz_graph ( <NUM_LIT:10> , <NUM_LIT:9> , <NUM_LIT:0.5> , seed = <NUM_LIT:0> ) </s>
