<s> from nose . tools import * <EOL> from networkx import * <EOL> from networkx . algorithms . isomorphism . isomorph import graph_could_be_isomorphic <EOL> is_isomorphic = graph_could_be_isomorphic <EOL> """<STR_LIT>""" <EOL> null = null_graph ( ) <EOL> class TestGeneratorsSmall ( ) : <EOL> def test_make_small_graph ( self ) : <EOL> d = [ "<STR_LIT>" , "<STR_LIT>" , <NUM_LIT:5> , [ [ <NUM_LIT:2> , <NUM_LIT:3> ] , [ <NUM_LIT:1> , <NUM_LIT:3> , <NUM_LIT:4> ] , [ <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:5> ] , [ <NUM_LIT:2> ] , [ <NUM_LIT:3> ] ] ] <EOL> G = make_small_graph ( d ) <EOL> assert_true ( is_isomorphic ( G , bull_graph ( ) ) ) <EOL> def test__LCF_graph ( self ) : <EOL> G = LCF_graph ( - <NUM_LIT:10> , [ <NUM_LIT:1> , <NUM_LIT:2> ] , <NUM_LIT:100> ) <EOL> assert_true ( is_isomorphic ( G , null ) ) <EOL> G = LCF_graph ( <NUM_LIT:0> , [ <NUM_LIT:1> , <NUM_LIT:2> ] , <NUM_LIT:3> ) <EOL> assert_true ( is_isomorphic ( G , null ) ) <EOL> G = LCF_graph ( <NUM_LIT:0> , [ <NUM_LIT:1> , <NUM_LIT:2> ] , <NUM_LIT:10> ) <EOL> assert_true ( is_isomorphic ( G , null ) ) <EOL> for a , b , c in [ ( <NUM_LIT:5> , [ ] , <NUM_LIT:0> ) , ( <NUM_LIT:10> , [ ] , <NUM_LIT:0> ) , ( <NUM_LIT:5> , [ ] , <NUM_LIT:1> ) , ( <NUM_LIT:10> , [ ] , <NUM_LIT:10> ) ] : <EOL> G = LCF_graph ( a , b , c ) <EOL> assert_true ( is_isomorphic ( G , cycle_graph ( a ) ) ) <EOL> G = LCF_graph ( <NUM_LIT:6> , [ <NUM_LIT:3> , - <NUM_LIT:3> ] , <NUM_LIT:3> ) <EOL> utility_graph = complete_bipartite_graph ( <NUM_LIT:3> , <NUM_LIT:3> ) <EOL> assert_true ( is_isomorphic ( G , utility_graph ) ) <EOL> def test_properties_named_small_graphs ( self ) : <EOL> G = bull_graph ( ) <EOL> assert_equal ( G . number_of_nodes ( ) , <NUM_LIT:5> ) <EOL> assert_equal ( G . number_of_edges ( ) , <NUM_LIT:5> ) <EOL> assert_equal ( sorted ( G . degree ( ) . values ( ) ) , [ <NUM_LIT:1> , <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:3> , <NUM_LIT:3> ] ) <EOL> assert_equal ( diameter ( G ) , <NUM_LIT:3> ) <EOL> assert_equal ( radius ( G ) , <NUM_LIT:2> ) <EOL> G = chvatal_graph ( ) <EOL> assert_equal ( G . number_of_nodes ( ) , <NUM_LIT:12> ) <EOL> assert_equal ( G . number_of_edges ( ) , <NUM_LIT> ) <EOL> assert_equal ( list ( G . degree ( ) . values ( ) ) , <NUM_LIT:12> * [ <NUM_LIT:4> ] ) <EOL> assert_equal ( diameter ( G ) , <NUM_LIT:2> ) <EOL> assert_equal ( radius ( G ) , <NUM_LIT:2> ) <EOL> G = cubical_graph ( ) <EOL> assert_equal ( G . number_of_nodes ( ) , <NUM_LIT:8> ) <EOL> assert_equal ( G . number_of_edges ( ) , <NUM_LIT:12> ) <EOL> assert_equal ( list ( G . degree ( ) . values ( ) ) , <NUM_LIT:8> * [ <NUM_LIT:3> ] ) <EOL> assert_equal ( diameter ( G ) , <NUM_LIT:3> ) <EOL> assert_equal ( radius ( G ) , <NUM_LIT:3> ) <EOL> G = desargues_graph ( ) <EOL> assert_equal ( G . number_of_nodes ( ) , <NUM_LIT:20> ) <EOL> assert_equal ( G . number_of_edges ( ) , <NUM_LIT:30> ) <EOL> assert_equal ( list ( G . degree ( ) . values ( ) ) , <NUM_LIT:20> * [ <NUM_LIT:3> ] ) <EOL> G = diamond_graph ( ) <EOL> assert_equal ( G . number_of_nodes ( ) , <NUM_LIT:4> ) <EOL> assert_equal ( sorted ( G . degree ( ) . values ( ) ) , [ <NUM_LIT:2> , <NUM_LIT:2> , <NUM_LIT:3> , <NUM_LIT:3> ] ) <EOL> assert_equal ( diameter ( G ) , <NUM_LIT:2> ) <EOL> assert_equal ( radius ( G ) , <NUM_LIT:1> ) <EOL> G = dodecahedral_graph ( ) <EOL> assert_equal ( G . number_of_nodes ( ) , <NUM_LIT:20> ) <EOL> assert_equal ( G . number_of_edges ( ) , <NUM_LIT:30> ) <EOL> assert_equal ( list ( G . degree ( ) . values ( ) ) , <NUM_LIT:20> * [ <NUM_LIT:3> ] ) <EOL> assert_equal ( diameter ( G ) , <NUM_LIT:5> ) <EOL> assert_equal ( radius ( G ) , <NUM_LIT:5> ) <EOL> G = frucht_graph ( ) <EOL> assert_equal ( G . number_of_nodes ( ) , <NUM_LIT:12> ) <EOL> assert_equal ( G . number_of_edges ( ) , <NUM_LIT> ) <EOL> assert_equal ( list ( G . degree ( ) . values ( ) ) , <NUM_LIT:12> * [ <NUM_LIT:3> ] ) <EOL> assert_equal ( diameter ( G ) , <NUM_LIT:4> ) <EOL> assert_equal ( radius ( G ) , <NUM_LIT:3> ) <EOL> G = heawood_graph ( ) <EOL> assert_equal ( G . number_of_nodes ( ) , <NUM_LIT> ) <EOL> assert_equal ( G . number_of_edges ( ) , <NUM_LIT> ) <EOL> assert_equal ( list ( G . degree ( ) . values ( ) ) , <NUM_LIT> * [ <NUM_LIT:3> ] ) <EOL> assert_equal ( diameter ( G ) , <NUM_LIT:3> ) <EOL> assert_equal ( radius ( G ) , <NUM_LIT:3> ) <EOL> G = house_graph ( ) <EOL> assert_equal ( G . number_of_nodes ( ) , <NUM_LIT:5> ) <EOL> assert_equal ( G . number_of_edges ( ) , <NUM_LIT:6> ) <EOL> assert_equal ( sorted ( G . degree ( ) . values ( ) ) , [ <NUM_LIT:2> , <NUM_LIT:2> , <NUM_LIT:2> , <NUM_LIT:3> , <NUM_LIT:3> ] ) <EOL> assert_equal ( diameter ( G ) , <NUM_LIT:2> ) <EOL> assert_equal ( radius ( G ) , <NUM_LIT:2> ) <EOL> G = house_x_graph ( ) <EOL> assert_equal ( G . number_of_nodes ( ) , <NUM_LIT:5> ) <EOL> assert_equal ( G . number_of_edges ( ) , <NUM_LIT:8> ) <EOL> assert_equal ( sorted ( G . degree ( ) . values ( ) ) , [ <NUM_LIT:2> , <NUM_LIT:3> , <NUM_LIT:3> , <NUM_LIT:4> , <NUM_LIT:4> ] ) <EOL> assert_equal ( diameter ( G ) , <NUM_LIT:2> ) <EOL> assert_equal ( radius ( G ) , <NUM_LIT:1> ) <EOL> G = icosahedral_graph ( ) <EOL> assert_equal ( G . number_of_nodes ( ) , <NUM_LIT:12> ) <EOL> assert_equal ( G . number_of_edges ( ) , <NUM_LIT:30> ) <EOL> assert_equal ( list ( G . degree ( ) . values ( ) ) , <EOL> [ <NUM_LIT:5> , <NUM_LIT:5> , <NUM_LIT:5> , <NUM_LIT:5> , <NUM_LIT:5> , <NUM_LIT:5> , <NUM_LIT:5> , <NUM_LIT:5> , <NUM_LIT:5> , <NUM_LIT:5> , <NUM_LIT:5> , <NUM_LIT:5> ] ) <EOL> assert_equal ( diameter ( G ) , <NUM_LIT:3> ) <EOL> assert_equal ( radius ( G ) , <NUM_LIT:3> ) <EOL> G = krackhardt_kite_graph ( ) <EOL> assert_equal ( G . number_of_nodes ( ) , <NUM_LIT:10> ) <EOL> assert_equal ( G . number_of_edges ( ) , <NUM_LIT> ) <EOL> assert_equal ( sorted ( G . degree ( ) . values ( ) ) , <EOL> [ <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:3> , <NUM_LIT:3> , <NUM_LIT:3> , <NUM_LIT:4> , <NUM_LIT:4> , <NUM_LIT:5> , <NUM_LIT:5> , <NUM_LIT:6> ] ) <EOL> G = moebius_kantor_graph ( ) <EOL> assert_equal ( G . number_of_nodes ( ) , <NUM_LIT:16> ) <EOL> assert_equal ( G . number_of_edges ( ) , <NUM_LIT> ) <EOL> assert_equal ( list ( G . degree ( ) . values ( ) ) , <NUM_LIT:16> * [ <NUM_LIT:3> ] ) <EOL> assert_equal ( diameter ( G ) , <NUM_LIT:4> ) <EOL> G = octahedral_graph ( ) <EOL> assert_equal ( G . number_of_nodes ( ) , <NUM_LIT:6> ) <EOL> assert_equal ( G . number_of_edges ( ) , <NUM_LIT:12> ) <EOL> assert_equal ( list ( G . degree ( ) . values ( ) ) , <NUM_LIT:6> * [ <NUM_LIT:4> ] ) <EOL> assert_equal ( diameter ( G ) , <NUM_LIT:2> ) <EOL> assert_equal ( radius ( G ) , <NUM_LIT:2> ) <EOL> G = pappus_graph ( ) <EOL> assert_equal ( G . number_of_nodes ( ) , <NUM_LIT> ) <EOL> assert_equal ( G . number_of_edges ( ) , <NUM_LIT> ) <EOL> assert_equal ( list ( G . degree ( ) . values ( ) ) , <NUM_LIT> * [ <NUM_LIT:3> ] ) <EOL> assert_equal ( diameter ( G ) , <NUM_LIT:4> ) <EOL> G = petersen_graph ( ) <EOL> assert_equal ( G . number_of_nodes ( ) , <NUM_LIT:10> ) <EOL> assert_equal ( G . number_of_edges ( ) , <NUM_LIT:15> ) <EOL> assert_equal ( list ( G . degree ( ) . values ( ) ) , <NUM_LIT:10> * [ <NUM_LIT:3> ] ) <EOL> assert_equal ( diameter ( G ) , <NUM_LIT:2> ) <EOL> assert_equal ( radius ( G ) , <NUM_LIT:2> ) <EOL> G = sedgewick_maze_graph ( ) <EOL> assert_equal ( G . number_of_nodes ( ) , <NUM_LIT:8> ) <EOL> assert_equal ( G . number_of_edges ( ) , <NUM_LIT:10> ) <EOL> assert_equal ( sorted ( G . degree ( ) . values ( ) ) , [ <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:2> , <NUM_LIT:2> , <NUM_LIT:3> , <NUM_LIT:3> , <NUM_LIT:3> , <NUM_LIT:4> ] ) <EOL> G = tetrahedral_graph ( ) <EOL> assert_equal ( G . number_of_nodes ( ) , <NUM_LIT:4> ) <EOL> assert_equal ( G . number_of_edges ( ) , <NUM_LIT:6> ) <EOL> assert_equal ( list ( G . degree ( ) . values ( ) ) , [ <NUM_LIT:3> , <NUM_LIT:3> , <NUM_LIT:3> , <NUM_LIT:3> ] ) <EOL> assert_equal ( diameter ( G ) , <NUM_LIT:1> ) <EOL> assert_equal ( radius ( G ) , <NUM_LIT:1> ) <EOL> G = truncated_cube_graph ( ) <EOL> assert_equal ( G . number_of_nodes ( ) , <NUM_LIT> ) <EOL> assert_equal ( G . number_of_edges ( ) , <NUM_LIT> ) <EOL> assert_equal ( list ( G . degree ( ) . values ( ) ) , <NUM_LIT> * [ <NUM_LIT:3> ] ) <EOL> G = truncated_tetrahedron_graph ( ) <EOL> assert_equal ( G . number_of_nodes ( ) , <NUM_LIT:12> ) <EOL> assert_equal ( G . number_of_edges ( ) , <NUM_LIT> ) <EOL> assert_equal ( list ( G . degree ( ) . values ( ) ) , <NUM_LIT:12> * [ <NUM_LIT:3> ] ) <EOL> G = tutte_graph ( ) <EOL> assert_equal ( G . number_of_nodes ( ) , <NUM_LIT> ) <EOL> assert_equal ( G . number_of_edges ( ) , <NUM_LIT> ) <EOL> assert_equal ( list ( G . degree ( ) . values ( ) ) , <NUM_LIT> * [ <NUM_LIT:3> ] ) <EOL> assert_raises ( networkx . exception . NetworkXError , tutte_graph , <EOL> create_using = DiGraph ( ) ) <EOL> MG = tutte_graph ( create_using = MultiGraph ( ) ) <EOL> assert_equal ( MG . edges ( ) , G . edges ( ) ) </s>
