#NEWLINE# def test_complete_bipartite_graph( self ) : #NEWLINE# #INDENT# G = complete_bipartite_graph ( 0 , 0 ) #NEWLINE# assert_true ( is_isomorphic ( G , null_graph ( ) ) ) #NEWLINE# for i in [ 1 , 5 ] : #NEWLINE# #INDENT# G = complete_bipartite_graph ( i , 0 ) #NEWLINE# assert_true ( is_isomorphic ( G , empty_graph ( i ) ) ) #NEWLINE# G = complete_bipartite_graph ( 0 , i ) #NEWLINE# assert_true ( is_isomorphic ( G , empty_graph ( i ) ) ) #NEWLINE# #UNINDENT# G = complete_bipartite_graph ( 2 , 2 ) #NEWLINE# assert_true ( is_isomorphic ( G , cycle_graph ( 4 ) ) ) #NEWLINE# G = complete_bipartite_graph ( 1 , 5 ) #NEWLINE# assert_true ( is_isomorphic ( G , star_graph ( 5 ) ) ) #NEWLINE# G = complete_bipartite_graph ( 5 , 1 ) #NEWLINE# assert_true ( is_isomorphic ( G , star_graph ( 5 ) ) ) #NEWLINE# for ( m1 , m2 ) in [ ( 5 , 11 ) , ( 7 , 3 ) ] : #NEWLINE# #INDENT# G = complete_bipartite_graph ( m1 , m2 ) #NEWLINE# assert_equal ( number_of_nodes ( G ) , ( m1 + m2 ) ) #NEWLINE# assert_equal ( number_of_edges ( G ) , ( m1 * m2 ) ) #NEWLINE# #UNINDENT# assert_raises ( networkx . exception . NetworkXError , complete_bipartite_graph , 7 , 3 , create_using = DiGraph ( ) ) #NEWLINE# mG = complete_bipartite_graph ( 7 , 3 , create_using = MultiGraph ( ) ) #NEWLINE# assert_equal ( sorted ( mG . edges ( ) ) , sorted ( G . edges ( ) ) ) #NEWLINE# G = complete_bipartite_graph ( [ 1 , 2 ] , [ 'a' , 'b' ] ) #NEWLINE# has_edges = ( ( ( G . has_edge ( 1 , 'a' ) & G . has_edge ( 1 , 'b' ) ) & G . has_edge ( 2 , 'a' ) ) & G . has_edge ( 2 , 'b' ) ) #NEWLINE# assert_true ( has_edges ) #NEWLINE# assert_equal ( G . size ( ) , 4 )